beside one small nit that could be cleaned up in a follow-up,

consider this:

Tested-By: Aaron Lauterer <a.laute...@proxmox.com>
Reviewed-By: Aaron Lauterer <a.laute...@proxmox.com>


On  2024-11-05  03:00, Severen Redwood wrote:
After a container is destroyed, record that its ID has been used via the
`PVE::UsedVmidList` module so that the `/cluster/nextids` endpoint can
later optionally avoid suggesting previously used IDs.

Co-authored-by: Daniel Krambrock <krambr...@hrz.uni-marburg.de>
Signed-off-by: Severen Redwood <severen.redw...@sitehost.co.nz>
---
Changed since v2 is the addition of the use statement for `PVE::UsedVmidList`.

  src/PVE/API2/LXC.pm | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm
index 213e518..cc47c5c 100644
--- a/src/PVE/API2/LXC.pm
+++ b/src/PVE/API2/LXC.pm
@@ -28,6 +28,7 @@ use PVE::API2::LXC::Config;
  use PVE::API2::LXC::Status;
  use PVE::API2::LXC::Snapshot;
  use PVE::JSONSchema qw(get_standard_option);
+use PVE::UsedVmidList qw(add_vmid);

adding the `qw(add_vmid)` here is not strictly necessary, AFAIU. We call the function with the full PVE::UsedVmidList:: prefix anyway.

  use base qw(PVE::RESTHandler);
BEGIN {
@@ -794,7 +795,9 @@ __PACKAGE__->register_method({
                }
            }
- # only now remove the zombie config, else we can have reuse race
+           # only now mark the CT ID as previously used and remove the zombie
+           # config, else we can have reuse race
+           PVE::UsedVmidList::add_vmid($vmid);
            PVE::LXC::Config->destroy_config($vmid);
        };



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to