src/api2/admin/datastore.rs: use api macro for start_garbage_collection
This commit is contained in:
parent
1dc117bbba
commit
dfc58d47ad
@ -474,25 +474,25 @@ fn prune(
|
|||||||
Ok(json!(worker.to_string())) // return the UPID
|
Ok(json!(worker.to_string())) // return the UPID
|
||||||
}
|
}
|
||||||
|
|
||||||
#[sortable]
|
#[api(
|
||||||
pub const API_METHOD_START_GARBAGE_COLLECTION: ApiMethod = ApiMethod::new(
|
input: {
|
||||||
&ApiHandler::Sync(&start_garbage_collection),
|
properties: {
|
||||||
&ObjectSchema::new(
|
store: {
|
||||||
"Start garbage collection.",
|
schema: DATASTORE_SCHEMA,
|
||||||
&sorted!([
|
},
|
||||||
("store", false, &DATASTORE_SCHEMA),
|
},
|
||||||
])
|
},
|
||||||
)
|
returns: {
|
||||||
);
|
schema: UPID_SCHEMA,
|
||||||
|
},
|
||||||
|
)]
|
||||||
|
/// Start garbage collection.
|
||||||
fn start_garbage_collection(
|
fn start_garbage_collection(
|
||||||
param: Value,
|
store: String,
|
||||||
_info: &ApiMethod,
|
_info: &ApiMethod,
|
||||||
rpcenv: &mut dyn RpcEnvironment,
|
rpcenv: &mut dyn RpcEnvironment,
|
||||||
) -> Result<Value, Error> {
|
) -> Result<Value, Error> {
|
||||||
|
|
||||||
let store = param["store"].as_str().unwrap().to_string();
|
|
||||||
|
|
||||||
let datastore = DataStore::lookup_datastore(&store)?;
|
let datastore = DataStore::lookup_datastore(&store)?;
|
||||||
|
|
||||||
println!("Starting garbage collection on store {}", store);
|
println!("Starting garbage collection on store {}", store);
|
||||||
|
Loading…
Reference in New Issue
Block a user