[pbs-devel] [PATCH proxmox-backup v5 06/10] fix #4723: cli: list gc jobs with proxmox-backup-manager
Lukas Wagner
l.wagner at proxmox.com
Thu Apr 18 12:17:02 CEST 2024
From: Stefan Lendl <s.lendl at proxmox.com>
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 <s.lendl at proxmox.com>
[LW: add ref to bugzilla issue to commit message]
Signed-off-by: Lukas Wagner <l.wagner at proxmox.com>
Tested-by: Gabriel Goller <g.goller at proxmox.com>
Reviewd-by: Gabriel Goller <g.goller at proxmox.com>
Tested-by: Lukas Wagner <l.wagner at proxmox.com>
Reviewed-by: Lukas Wagner <l.wagner at proxmox.com>
---
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<Value, Error> {
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<Value, Error> {
+ 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
More information about the pbs-devel
mailing list