Strange situation in Proxmox VE API

safranero

Renowned Member
Jan 21, 2010
39
0
71
Spain
Hello,

I'm using "pvesh get /cluster/backup" for obtain ID's of my cluster backup configurations and return the id of backups created.

I want to save the ID in my database for manipulating this backup to add new VM, but this ID is generated again after modify any parameter of backup.

For example:

pvesh get /cluster/backup
┌────────────────────────────────────────────┐
│ id │
╞════════════════════════════════════════════╡
│ 3127sdfys98fdys98fds8dd8845793fd9b5ad4d67:1 │
└────────────────────────────────────────────┘

And after set e-mail in the backup and execute again the command shows this:

pvesh get /cluster/backup
┌────────────────────────────────────────────┐
│ id │
╞════════════════════════════════════════════╡
│ 3ec6d132123awewewaeasdasbcda0a3426d91d:1 │
└────────────────────────────────────────────┘

Why is the reason for update the ID of backup?

I'm confused.
 
Hi,
Why is the reason for update the ID of backup?
The current ID format is the digest (think hash) of the vzdump.cron file and the line-number, with that one can index the jobs safely and avoid that there are clashes on edit and the plain .cron format did not really allow to have safe unique IDs in other ways.

But, currently there's a rework going on that moves from the vzdump.cron file to a jobs.cfg with a more straightforward config format and stable IDs, check the this development mailing list thread for more info:
https://lists.proxmox.com/pipermail/pve-devel/2021-November/050712.html
 
On this "stable" ID for jobs.cfg: what is the (for 7.1 mainly, but also 6.4 till I upgrade that cluster) recommended way to script or automate (via bash/Ansible/Terraform) the backups for VMs and LXCs?
 
On this "stable" ID for jobs.cfg: what is the (for 7.1 mainly, but also 6.4 till I upgrade that cluster) recommended way to script or automate (via bash/Ansible/Terraform) the backups for VMs and LXCs?
What do you mean, on automated creation of a backup job? You'd just pass an ID like the GUI does.
 
So I just pick a random Job ID?
Depends on your usage, you can also use a deterministic one if you have predefined jobs and your automation stack can do a check if there then update (PUT) else create (POST).

is there a specific format to adhere to?
The regex it needs to match is [a-z][a-z0-9_-]+
So you could add some prefix for recognizing that those jobs are from your automation stack, e.g., ansible- and add a short UUID, random number or also the ISO date like 2021-12-03 and some short incrementing integer or the like, up to your preference.
 
Last edited:
  • Like
Reactions: hvisage

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!