[pve-devel] API Return Values

Dietmar Maurer dietmar at proxmox.com
Mon Oct 23 06:10:11 CEST 2017


> > But if a user delete and recreates a resource the ID may get re-used.
> > So we would have to make sure that this would not happen.
> > But maybe this is not really a issue?
> 
> Yeah, I'm not too concerned about that. Terraform doesn't make any
> guarantees that your saved state is up to date, but it does allow you to
> "refresh" from the API, which will display a diff that you can use to
> update your config files. I think that's really more of a policy that users
> of a tool like Terraform would have to follow, and not something the API
> needs to be concerned about.

Just viewed the code, and detected that we directly read/write the crontab
file:

https://git.proxmox.com/?p=pve-manager.git;a=blob;f=PVE/API2/Backup.pm;h=3dfe8a0d5f8590f375757030d53bea288681d4bc;hb=HEAD#l86

This is great, because user can also directly edit/view the crontab file, 
but bad, because there is no way to address specific crontab entries 
inside that file.

To circumvent that, we compute a digest over each line, combined with a line
count:

		$opts->{id} = "$digest:$jid";

This work very well with the GUI, because it detect/throws errors as soon as 
someone modified the file (digest changed).

But this kind of ID is not suitable to store in an external database.




More information about the pve-devel mailing list