From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 2A04A98BD7 for ; Tue, 10 Oct 2023 08:40:09 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 10DC91F198 for ; Tue, 10 Oct 2023 08:39:39 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Tue, 10 Oct 2023 08:39:37 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id DACDF4493A for ; Tue, 10 Oct 2023 08:39:36 +0200 (CEST) From: Markus Frank To: pbs-devel@lists.proxmox.com Date: Tue, 10 Oct 2023 08:39:25 +0200 Message-Id: <20231010063926.2248-1-m.frank@proxmox.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.047 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [disk.rs] Subject: [pbs-devel] [PATCH proxmox-backup 1/2] cli: add option to remove systemd mount unit X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Oct 2023 06:40:09 -0000 add commandline option for api function: DELETE /api2/json/nodes/{node}/disks/directory/{name} $ proxmox-backup-manager disk fs delete Signed-off-by: Markus Frank --- src/bin/proxmox_backup_manager/disk.rs | 29 ++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/bin/proxmox_backup_manager/disk.rs b/src/bin/proxmox_backup_manager/disk.rs index c3259b65..73cb95e6 100644 --- a/src/bin/proxmox_backup_manager/disk.rs +++ b/src/bin/proxmox_backup_manager/disk.rs @@ -317,6 +317,31 @@ async fn create_datastore_disk( Ok(Value::Null) } +#[api( + input: { + properties: { + name: { + schema: DATASTORE_SCHEMA, + }, + }, + }, +)] +/// Remove a Filesystem mounted under '/mnt/datastore/'. +async fn delete_datastore_disk( + mut param: Value, + rpcenv: &mut dyn RpcEnvironment, +) -> Result { + 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!(), + }; + + Ok(Value::Null) +} + pub fn filesystem_commands() -> CommandLineInterface { let cmd_def = CliCommandMap::new() .insert("list", CliCommand::new(&API_METHOD_LIST_DATASTORE_MOUNTS)) @@ -325,6 +350,10 @@ pub fn filesystem_commands() -> CommandLineInterface { CliCommand::new(&API_METHOD_CREATE_DATASTORE_DISK) .arg_param(&["name"]) .completion_cb("disk", complete_disk_name), + ).insert( + "delete", + CliCommand::new(&API_METHOD_DELETE_DATASTORE_DISK) + .arg_param(&["name"]), ); cmd_def.into() -- 2.39.2