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 9BC49934D0 for ; Mon, 5 Feb 2024 13:00:45 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 66E85160EF for ; Mon, 5 Feb 2024 13:00:15 +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 ; Mon, 5 Feb 2024 13:00:14 +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 A42694431D for ; Mon, 5 Feb 2024 13:00:11 +0100 (CET) From: Stefan Lendl To: pbs-devel@lists.proxmox.com Date: Mon, 5 Feb 2024 12:58:30 +0100 Message-ID: <20240205115830.523721-9-s.lendl@proxmox.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240205115830.523721-2-s.lendl@proxmox.com> References: <20240205115830.523721-2-s.lendl@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.039 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: [pbs-devel] [PATCH proxmox-backup 7/8] 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: , X-List-Received-Date: Mon, 05 Feb 2024 12:00:45 -0000 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 --- 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.43.0