[pve-devel] [PATCH container v4] api: record CT ID as used after a container is destroyed

Severen Redwood severen.redwood at sitehost.co.nz
Wed Mar 26 04:51:13 CET 2025


On 28/01/2025 01:16, Fabian Grünbichler wrote:
> if we only add it when the VM is removed via the API, we might miss those where an admin just does "rm /etc/pve/../XXX.conf" (which might happen if something is blocking regular removal)? wouldn't it be safer to add them when creating the VM? or potentially in both cases to increase the likelihood of a VM being registered?
> 
> alternatively, a call to nextid already has both lists and could warn if there is a mismatch or even fix it up? i.e., if we don't only add on removal, but upon creation, then the intersection of currently used VMIDs and previously used VMIDs should be identical to the currently used VMIDs. if not, then any missing ones can be added/registered?
> 
> all of this obviously applies to containers and VMs..

This is a good point. I've implemented your first suggestion for a start and tried to position the calls to `add_id` where I think they would make sense (namely just after the config file is created for creating/cloning and just after it is deleted for destroying), but of course I don't have the most intimate knowledge of PVE. Please let me know what you think once I post the updated patch series :)




More information about the pve-devel mailing list