mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-05-01 06:15:25 +00:00
vm_destroy: delete ip from ipam
Co-Authored-By: Stefan Hanreich <s.hanreich@proxmox.com> Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com> Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
This commit is contained in:
parent
ee8d2dea5c
commit
89229af914
@ -2363,6 +2363,9 @@ sub destroy_vm {
|
||||
});
|
||||
}
|
||||
|
||||
eval { delete_ifaces_ipams_ips($conf, $vmid)};
|
||||
warn $@ if $@;
|
||||
|
||||
if (defined $replacement_conf) {
|
||||
PVE::QemuConfig->write_config($vmid, $replacement_conf);
|
||||
} else {
|
||||
@ -8673,4 +8676,18 @@ sub create_ifaces_ipams_ips {
|
||||
}
|
||||
}
|
||||
|
||||
sub delete_ifaces_ipams_ips {
|
||||
my ($conf, $vmid) = @_;
|
||||
|
||||
return if !$have_sdn;
|
||||
|
||||
foreach my $opt (keys %$conf) {
|
||||
if ($opt =~ m/^net(\d+)$/) {
|
||||
my $net = PVE::QemuServer::parse_net($conf->{$opt});
|
||||
eval { PVE::Network::SDN::Vnets::del_ips_from_mac($net->{bridge}, $net->{macaddr}, $conf->{name}) };
|
||||
warn $@ if $@;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
Loading…
Reference in New Issue
Block a user