[pbs-devel] [PATCH proxmox-backup 1/1] cli: functionality for the removal of dirs from manager cli
Hannes Laimer
h.laimer at proxmox.com
Tue Aug 18 11:31:19 CEST 2020
Signed-off-by: Hannes Laimer <h.laimer at proxmox.com>
---
src/bin/proxmox_backup_manager/disk.rs | 33 ++++++++++++++++++++++++--
1 file changed, 31 insertions(+), 2 deletions(-)
diff --git a/src/bin/proxmox_backup_manager/disk.rs b/src/bin/proxmox_backup_manager/disk.rs
index a93a6f6b..d74b97ed 100644
--- a/src/bin/proxmox_backup_manager/disk.rs
+++ b/src/bin/proxmox_backup_manager/disk.rs
@@ -319,6 +319,34 @@ async fn create_datastore_disk(
Ok(Value::Null)
}
+#[api(
+ input: {
+ properties: {
+ name: {
+ schema: DATASTORE_SCHEMA,
+ },
+ },
+ },
+)]
+/// Remove a Filesystem mounted under '/mnt/datastore/<name>'.".
+async fn delete_datastore_disk(
+ mut param: Value,
+ rpcenv: &mut dyn RpcEnvironment,
+) -> Result<Value, Error> {
+
+ param["node"] = "localhost".into();
+
+ let info = &api2::node::disks::directory::API_METHOD_DELETE_DATASTORE_DISK;
+ let result = match info.handler {
+ ApiHandler::Sync(handler) => (handler)(param, info, rpcenv)?,
+ _ => unreachable!(),
+ };
+
+ crate::wait_for_local_worker(result.as_str().unwrap()).await?;
+
+ Ok(Value::Null)
+}
+
pub fn filesystem_commands() -> CommandLineInterface {
let cmd_def = CliCommandMap::new()
@@ -327,8 +355,9 @@ pub fn filesystem_commands() -> CommandLineInterface {
CliCommand::new(&API_METHOD_CREATE_DATASTORE_DISK)
.arg_param(&["name"])
.completion_cb("disk", complete_disk_name)
- );
-
+ ).insert("remove",
+ CliCommand::new(&API_METHOD_DELETE_DATASTORE_DISK)
+ .arg_param(&["name"]));
cmd_def.into()
}
--
2.20.1
More information about the pbs-devel
mailing list