diff --git a/src/api2/admin/datastore.rs b/src/api2/admin/datastore.rs index 54fa8c70..049e16ed 100644 --- a/src/api2/admin/datastore.rs +++ b/src/api2/admin/datastore.rs @@ -474,25 +474,25 @@ fn prune( Ok(json!(worker.to_string())) // return the UPID } -#[sortable] -pub const API_METHOD_START_GARBAGE_COLLECTION: ApiMethod = ApiMethod::new( - &ApiHandler::Sync(&start_garbage_collection), - &ObjectSchema::new( - "Start garbage collection.", - &sorted!([ - ("store", false, &DATASTORE_SCHEMA), - ]) - ) -); - +#[api( + input: { + properties: { + store: { + schema: DATASTORE_SCHEMA, + }, + }, + }, + returns: { + schema: UPID_SCHEMA, + }, +)] +/// Start garbage collection. fn start_garbage_collection( - param: Value, + store: String, _info: &ApiMethod, rpcenv: &mut dyn RpcEnvironment, ) -> Result { - let store = param["store"].as_str().unwrap().to_string(); - let datastore = DataStore::lookup_datastore(&store)?; println!("Starting garbage collection on store {}", store);