From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id EEF0E1FF141 for ; Mon, 13 Apr 2026 15:25:51 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 0CF3925D2C; Mon, 13 Apr 2026 15:26:40 +0200 (CEST) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Mon, 13 Apr 2026 15:26:35 +0200 Message-Id: Subject: Re: [PATCH proxmox-backup 4/7] client: add 'instance-id' sub-command To: "Lukas Wagner" , , X-Mailer: aerc 0.20.0 References: <20260413121057.371772-1-l.wagner@proxmox.com> <20260413121057.371772-5-l.wagner@proxmox.com> In-Reply-To: <20260413121057.371772-5-l.wagner@proxmox.com> From: "Shannon Sterz" X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1776086721268 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.124 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 Message-ID-Hash: 2O64K3NJNZOBTUTI2KPU2ZNOJUVSFJDG X-Message-ID-Hash: 2O64K3NJNZOBTUTI2KPU2ZNOJUVSFJDG X-MailFrom: s.sterz@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Backup Server development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Mon Apr 13, 2026 at 2:10 PM CEST, Lukas Wagner wrote: > This allows users to query the instance-id from the > proxmox-backup-client tool. This will also be used by the PBS client in > PVE to lookup the instance-id from a yet to be introduced API endpoint > that returns the instance-id for a given PBS storage. > > Signed-off-by: Lukas Wagner > --- > proxmox-backup-client/src/main.rs | 41 +++++++++++++++++++++++++++++-- > 1 file changed, 39 insertions(+), 2 deletions(-) > > diff --git a/proxmox-backup-client/src/main.rs b/proxmox-backup-client/sr= c/main.rs > index 2ada87bdd..9f4a82e26 100644 > --- a/proxmox-backup-client/src/main.rs > +++ b/proxmox-backup-client/src/main.rs > @@ -25,8 +25,8 @@ use pxar::accessor::{MaybeReady, ReadAt, ReadAtOperatio= n}; > > use pbs_api_types::{ > ArchiveType, Authid, BackupArchiveName, BackupDir, BackupGroup, Back= upNamespace, BackupPart, > - BackupType, ClientRateLimitConfig, CryptMode, Fingerprint, GroupList= Item, PathPattern, > - PruneJobOptions, PruneListItem, RateLimitConfig, SnapshotListItem, S= torageStatus, > + BackupType, ClientRateLimitConfig, CryptMode, Fingerprint, GroupList= Item, InstanceId, > + PathPattern, PruneJobOptions, PruneListItem, RateLimitConfig, Snapsh= otListItem, StorageStatus, > BACKUP_ID_SCHEMA, BACKUP_NAMESPACE_SCHEMA, BACKUP_TIME_SCHEMA, BACKU= P_TYPE_SCHEMA, > CATALOG_NAME, ENCRYPTED_KEY_BLOB_NAME, MANIFEST_BLOB_NAME, > }; > @@ -139,6 +139,39 @@ fn record_repository(repo: &BackupRepository) { > ); > } > > +#[api( > + input: { > + properties: { > + repository: { > + schema: REPO_URL_SCHEMA, > + optional: true, > + }, > + "output-format": { > + schema: OUTPUT_FORMAT, > + optional: true, > + }, > + }, > + }, > +)] > +/// Start garbage collection for a specific repository. nit: that description probably should read "Get the instance ID of a PBS host." instead ^^ > +async fn get_instance_id(param: Value) -> Result { > + let repo =3D extract_repository_from_value(¶m)?; > + let output_format =3D get_output_format(¶m); > + let client =3D connect(&repo)?; > + > + let path =3D format!("api2/json/nodes/localhost/instance-id"); > + let mut result =3D client.get(&path, None).await?; > + > + let id: InstanceId =3D serde_json::from_value(result["data"].take())= ?; > + > + if output_format =3D=3D "text" { > + println!("instance-id: {}", id.instance_id); > + } else { > + format_and_print_result(&id, &output_format); > + } > + Ok(Value::Null) > +} > + > async fn api_datastore_list_snapshots( > client: &HttpClient, > store: &str, > @@ -2076,6 +2109,9 @@ fn main() { > let version_cmd_def =3D > CliCommand::new(&API_METHOD_API_VERSION).completion_cb("reposito= ry", complete_repository); > > + let instance_id_cmd_def =3D CliCommand::new(&API_METHOD_GET_INSTANCE= _ID) > + .completion_cb("repository", complete_repository); > + > let change_owner_cmd_def =3D CliCommand::new(&API_METHOD_CHANGE_BACK= UP_OWNER) > .arg_param(&["group", "new-owner"]) > .completion_cb("ns", complete_namespace) > @@ -2086,6 +2122,7 @@ fn main() { > let cmd_def =3D CliCommandMap::new() > .insert("backup", backup_cmd_def) > .insert("garbage-collect", garbage_collect_cmd_def) > + .insert("instance-id", instance_id_cmd_def) > .insert("list", list_cmd_def) > .insert("login", login_cmd_def) > .insert("logout", logout_cmd_def)