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)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 1417570C48 for ; Tue, 8 Jun 2021 16:09:00 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 04F7E1B7F5 for ; Tue, 8 Jun 2021 16:08:30 +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 id BDD491B7EA for ; Tue, 8 Jun 2021 16:08:28 +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 917E542B36 for ; Tue, 8 Jun 2021 16:08:28 +0200 (CEST) From: Dominik Csapak To: pbs-devel@lists.proxmox.com Date: Tue, 8 Jun 2021 16:08:27 +0200 Message-Id: <20210608140827.24236-1-d.csapak@proxmox.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.961 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% 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. [datastore.rs] Subject: [pbs-devel] [PATCH proxmox-backup] proxmox-backup-manager: show task log on datastore create 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, 08 Jun 2021 14:09:00 -0000 since the output: Result: "" is not really interesting, show instead the task log while the datastore is creating, since it is now run in a worker Signed-off-by: Dominik Csapak --- src/bin/proxmox_backup_manager/datastore.rs | 82 ++++++++++++++++++++- 1 file changed, 81 insertions(+), 1 deletion(-) diff --git a/src/bin/proxmox_backup_manager/datastore.rs b/src/bin/proxmox_backup_manager/datastore.rs index 7e596a1b..7cbd8805 100644 --- a/src/bin/proxmox_backup_manager/datastore.rs +++ b/src/bin/proxmox_backup_manager/datastore.rs @@ -5,6 +5,11 @@ use proxmox::api::{api, cli::*, RpcEnvironment, ApiHandler}; use proxmox_backup::config; use proxmox_backup::api2::{self, types::* }; +use proxmox_backup::client::{ + connect_to_localhost, + view_task_result, +}; +use proxmox_backup::config::datastore::DIR_NAME_SCHEMA; #[api( input: { @@ -67,6 +72,81 @@ fn show_datastore(param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result Result { + + let output_format = extract_output_format(&mut param); + + let mut client = connect_to_localhost()?; + + let result = client.post(&"api2/json/config/datastore", Some(param)).await?; + + view_task_result(&mut client, result, &output_format).await?; + + Ok(Value::Null) +} + pub fn datastore_commands() -> CommandLineInterface { let cmd_def = CliCommandMap::new() @@ -77,7 +157,7 @@ pub fn datastore_commands() -> CommandLineInterface { .completion_cb("name", config::datastore::complete_datastore_name) ) .insert("create", - CliCommand::new(&api2::config::datastore::API_METHOD_CREATE_DATASTORE) + CliCommand::new(&API_METHOD_CREATE_DATASTORE) .arg_param(&["name", "path"]) ) .insert("update", -- 2.20.1