public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Lukas Wagner" <l.wagner@proxmox.com>
To: "Shannon Sterz" <s.sterz@proxmox.com>,
	"Lukas Wagner" <l.wagner@proxmox.com>,
	<pbs-devel@lists.proxmox.com>, <pve-devel@lists.proxmox.com>
Subject: Re: [PATCH proxmox-backup 4/7] client: add 'instance-id' sub-command
Date: Mon, 13 Apr 2026 15:39:18 +0200	[thread overview]
Message-ID: <DHS2HSLB75II.1RUAXI5YG08KA@proxmox.com> (raw)
In-Reply-To: <DHS281VWZQZN.1IOIQ8Q4VQHHT@proxmox.com>

On Mon Apr 13, 2026 at 3:26 PM CEST, Shannon Sterz wrote:
> 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 <l.wagner@proxmox.com>
>> ---
>>  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/src/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, ReadAtOperation};
>>
>>  use pbs_api_types::{
>>      ArchiveType, Authid, BackupArchiveName, BackupDir, BackupGroup, BackupNamespace, BackupPart,
>> -    BackupType, ClientRateLimitConfig, CryptMode, Fingerprint, GroupListItem, PathPattern,
>> -    PruneJobOptions, PruneListItem, RateLimitConfig, SnapshotListItem, StorageStatus,
>> +    BackupType, ClientRateLimitConfig, CryptMode, Fingerprint, GroupListItem, InstanceId,
>> +    PathPattern, PruneJobOptions, PruneListItem, RateLimitConfig, SnapshotListItem, StorageStatus,
>>      BACKUP_ID_SCHEMA, BACKUP_NAMESPACE_SCHEMA, BACKUP_TIME_SCHEMA, BACKUP_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 ^^
>

absolutely, this was a copy-paste oversight, thanks!

>> +async fn get_instance_id(param: Value) -> Result<Value, Error> {
>> +    let repo = extract_repository_from_value(&param)?;
>> +    let output_format = get_output_format(&param);
>> +    let client = connect(&repo)?;
>> +
>> +    let path = format!("api2/json/nodes/localhost/instance-id");
>> +    let mut result = client.get(&path, None).await?;
>> +
>> +    let id: InstanceId = serde_json::from_value(result["data"].take())?;
>> +
>> +    if output_format == "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 =
>>          CliCommand::new(&API_METHOD_API_VERSION).completion_cb("repository", complete_repository);
>>
>> +    let instance_id_cmd_def = CliCommand::new(&API_METHOD_GET_INSTANCE_ID)
>> +        .completion_cb("repository", complete_repository);
>> +
>>      let change_owner_cmd_def = CliCommand::new(&API_METHOD_CHANGE_BACKUP_OWNER)
>>          .arg_param(&["group", "new-owner"])
>>          .completion_cb("ns", complete_namespace)
>> @@ -2086,6 +2122,7 @@ fn main() {
>>      let cmd_def = 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)





  reply	other threads:[~2026-04-13 13:39 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-13 12:10 [RFC common/proxmox{,-backup}/storage 0/7] establish unique instance-id for PBS nodes Lukas Wagner
2026-04-13 12:10 ` [PATCH proxmox 1/7] pbs-api-types: add InstanceId response type Lukas Wagner
2026-04-13 12:10 ` [PATCH proxmox 2/7] systemd: add support for machine-id generation Lukas Wagner
2026-04-13 12:10 ` [PATCH proxmox-backup 3/7] api: add /nodes/localhost/instance-id Lukas Wagner
2026-04-14 14:23   ` Christian Ebner
2026-04-15  9:21     ` Lukas Wagner
2026-04-15  9:26       ` Christian Ebner
2026-04-13 12:10 ` [PATCH proxmox-backup 4/7] client: add 'instance-id' sub-command Lukas Wagner
2026-04-13 13:26   ` Shannon Sterz
2026-04-13 13:39     ` Lukas Wagner [this message]
2026-04-14 14:30   ` Christian Ebner
2026-04-13 12:10 ` [PATCH proxmox-backup 5/7] manager: add instance-id subcommand Lukas Wagner
2026-04-13 13:26   ` Shannon Sterz
2026-04-13 13:38     ` Lukas Wagner
2026-04-13 12:10 ` [PATCH common 6/7] pbs-client: add support for the 'instance id' command Lukas Wagner
2026-04-13 12:10 ` [PATCH pve-storage 7/7] api: add /nodes/<node>/storage/<storage>/instance-id route Lukas Wagner
2026-04-13 13:26   ` Shannon Sterz
2026-04-13 13:37     ` Lukas Wagner
2026-04-14 14:38   ` Christian Ebner
2026-04-15  8:41     ` Lukas Wagner
2026-04-15  8:44       ` Christian Ebner
2026-04-14 14:45 ` [RFC common/proxmox{,-backup}/storage 0/7] establish unique instance-id for PBS nodes Christian Ebner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DHS2HSLB75II.1RUAXI5YG08KA@proxmox.com \
    --to=l.wagner@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=s.sterz@proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal