From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 6E2CF20EC85 for ; Thu, 18 Apr 2024 12:17:13 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id F411C1A251; Thu, 18 Apr 2024 12:17:12 +0200 (CEST) From: Lukas Wagner To: pbs-devel@lists.proxmox.com Date: Thu, 18 Apr 2024 12:17:02 +0200 Message-Id: <20240418101706.237597-7-l.wagner@proxmox.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240418101706.237597-1-l.wagner@proxmox.com> References: <20240418101706.237597-1-l.wagner@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.002 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 Subject: [pbs-devel] [PATCH proxmox-backup v5 06/10] fix #4723: cli: list gc jobs with proxmox-backup-manager 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: , Reply-To: Proxmox Backup Server development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" From: Stefan Lendl proxmox-backup-manager garbage-collection list to list the garbage collection job status for all datastores, including datastores without gc jobs. Signed-off-by: Stefan Lendl [LW: add ref to bugzilla issue to commit message] Signed-off-by: Lukas Wagner Tested-by: Gabriel Goller Reviewd-by: Gabriel Goller Tested-by: Lukas Wagner Reviewed-by: Lukas Wagner --- src/bin/proxmox-backup-manager.rs | 33 +++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/bin/proxmox-backup-manager.rs b/src/bin/proxmox-backup-manager.rs index 115207f3..94fc6b2f 100644 --- a/src/bin/proxmox-backup-manager.rs +++ b/src/bin/proxmox-backup-manager.rs @@ -93,6 +93,35 @@ async fn garbage_collection_status(param: Value) -> Result { Ok(Value::Null) } +#[api( + input: { + properties: { + "output-format": { + schema: OUTPUT_FORMAT, + optional: true, + }, + } + } +)] +/// List garbage collection job status for all datastores, including datastores without gc jobs. +async fn garbage_collection_list_jobs(param: Value) -> Result { + let output_format = get_output_format(¶m); + + let client = connect_to_localhost()?; + + let path = "api2/json/admin/gc"; + + let mut result = client.get(&path, None).await?; + let mut data = result["data"].take(); + let return_type = &api2::admin::gc::API_METHOD_LIST_ALL_GC_JOBS.returns; + + let options = default_table_format_options(); + + format_and_print_result_full(&mut data, return_type, &output_format, &options); + + Ok(Value::Null) +} + fn garbage_collection_commands() -> CommandLineInterface { let cmd_def = CliCommandMap::new() .insert( @@ -106,6 +135,10 @@ fn garbage_collection_commands() -> CommandLineInterface { CliCommand::new(&API_METHOD_START_GARBAGE_COLLECTION) .arg_param(&["store"]) .completion_cb("store", pbs_config::datastore::complete_datastore_name), + ) + .insert( + "list", + CliCommand::new(&API_METHOD_GARBAGE_COLLECTION_LIST_JOBS), ); cmd_def.into() -- 2.39.2 _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel