From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <g.goller@proxmox.com>
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 30E90B98AE
 for <pbs-devel@lists.proxmox.com>; Mon, 11 Dec 2023 14:01:01 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id A52D016AF3
 for <pbs-devel@lists.proxmox.com>; Mon, 11 Dec 2023 14:00:03 +0100 (CET)
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))
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS
 for <pbs-devel@lists.proxmox.com>; Mon, 11 Dec 2023 14:00:03 +0100 (CET)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id D388E452E4
 for <pbs-devel@lists.proxmox.com>; Mon, 11 Dec 2023 14:00:02 +0100 (CET)
Message-ID: <2bcb9be3-b4cf-450b-8cf1-1e74b49a58f2@proxmox.com>
Date: Mon, 11 Dec 2023 14:00:02 +0100
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Content-Language: en-US
To: Proxmox Backup Server development discussion
 <pbs-devel@lists.proxmox.com>, Hannes Laimer <h.laimer@proxmox.com>
References: <20230921125207.1301656-1-h.laimer@proxmox.com>
 <20230921125207.1301656-21-h.laimer@proxmox.com>
From: Gabriel Goller <g.goller@proxmox.com>
In-Reply-To: <20230921125207.1301656-21-h.laimer@proxmox.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL -0.146 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
 T_SCC_BODY_TEXT_LINE    -0.01 -
Subject: Re: [pbs-devel] [PATCH proxmox-backup v2 20/25] pb-manager: add
 (un)mount command
X-BeenThere: pbs-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox Backup Server development discussion
 <pbs-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pbs-devel/>
List-Post: <mailto:pbs-devel@lists.proxmox.com>
List-Help: <mailto:pbs-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Mon, 11 Dec 2023 13:01:01 -0000


On 9/21/23 14:52, Hannes Laimer wrote:
> Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
> ---
>   src/bin/proxmox_backup_manager/datastore.rs | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/src/bin/proxmox_backup_manager/datastore.rs b/src/bin/proxmox_backup_manager/datastore.rs
> index 383bcd24..88cea6b0 100644
> --- a/src/bin/proxmox_backup_manager/datastore.rs
> +++ b/src/bin/proxmox_backup_manager/datastore.rs
> @@ -1,4 +1,4 @@
> -use anyhow::Error;
> +use anyhow::{format_err, Error};
>   use serde_json::Value;
>   
>   use proxmox_router::{cli::*, ApiHandler, RpcEnvironment};
> @@ -8,6 +8,7 @@ use pbs_api_types::{DataStoreConfig, DATASTORE_SCHEMA, PROXMOX_CONFIG_DIGEST_SCH
>   use pbs_client::view_task_result;
>   
>   use proxmox_backup::api2;
> +use proxmox_backup::api2::admin::datastore::{API_METHOD_MOUNT, API_METHOD_UNMOUNT};
>   use proxmox_backup::client_helpers::connect_to_localhost;
>   
>   #[api(
> @@ -142,6 +143,7 @@ async fn delete_datastore(mut param: Value, rpcenv: &mut dyn RpcEnvironment) ->
>   pub fn datastore_commands() -> CommandLineInterface {
>       let cmd_def = CliCommandMap::new()
>           .insert("list", CliCommand::new(&API_METHOD_LIST_DATASTORES))
> +        .insert("mount", CliCommand::new(&API_METHOD_MOUNT))
>           .insert(
>               "show",
>               CliCommand::new(&API_METHOD_SHOW_DATASTORE)
> @@ -152,6 +154,7 @@ pub fn datastore_commands() -> CommandLineInterface {
>               "create",
>               CliCommand::new(&API_METHOD_CREATE_DATASTORE).arg_param(&["name", "path"]),
>           )
> +        .insert("unmount", CliCommand::new(&API_METHOD_UNMOUNT))
>           .insert(
>               "update",
>               CliCommand::new(&api2::config::datastore::API_METHOD_UPDATE_DATASTORE)
Sadly this won't work :(
We directly call the api here, which spawns a worker thread that gets 
killed instantly (because
the cli command is finished). It's better if we make an http api call as 
in the other commands.