From: Alexandre Derumier <aderum...@odiso.com>

also delete ips in case of failure

Signed-off-by: Alexandre Derumier <aderum...@odiso.com>
---
 src/PVE/API2/LXC.pm | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm
index e15de28..ee4fdca 100644
--- a/src/PVE/API2/LXC.pm
+++ b/src/PVE/API2/LXC.pm
@@ -1830,7 +1830,9 @@ __PACKAGE__->register_method({
                $lock_and_reload->($newid, sub {
                    my $conf = shift;
                    my $rootdir = PVE::LXC::mount_all($newid, $storecfg, $conf, 
1);
+
                    eval {
+                       PVE::LXC::create_ifaces_ipams_ips($conf, $vmid);
                        my $lxc_setup = PVE::LXC::Setup->new($conf, $rootdir);
                        $lxc_setup->post_clone_hook($conf);
                    };
@@ -1850,7 +1852,7 @@ __PACKAGE__->register_method({
            warn $@ if $@;
 
            if ($err) {
-               # Now cleanup the config & disks:
+               # Now cleanup the config & disks & ipam:
                sleep 1; # some storages like rbd need to wait before release 
volume - really?
 
                foreach my $volid (@$newvollist) {
@@ -1860,6 +1862,8 @@ __PACKAGE__->register_method({
 
                eval {
                    $lock_and_reload->($newid, sub {
+                       my $conf = shift;
+                       PVE::LXC::delete_ifaces_ipams_ips($conf, $newid);
                        PVE::LXC::Config->destroy_config($newid);
                        PVE::Firewall::remove_vmfw_conf($newid);
                    });
-- 
2.39.2


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

Reply via email to