migration : add del_nets_bridge_fdb

at the end of a live migration, we need to remove old mac entries
on source host (vm is not yet stopped), before resume vm on target host

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
 [T: resolve conflicts and rework on apply ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Alexandre Derumier 2022-08-24 18:26:44 +02:00 committed by Thomas Lamprecht
parent 4ddd2ca293
commit 73ed64967e
3 changed files with 22 additions and 0 deletions

View File

@ -1181,6 +1181,9 @@ sub phase3_cleanup {
}
}
# deletes local FDB entries if learning is disabled, they'll be re-added on target on resume
PVE::QemuServer::del_nets_bridge_fdb($conf, $vmid);
if (!$self->{vm_was_paused}) {
# config moved and nbd server stopped - now we can resume vm on target
if ($tunnel && $tunnel->{version} && $tunnel->{version} >= 1) {

View File

@ -8338,4 +8338,22 @@ sub add_nets_bridge_fdb {
}
}
sub del_nets_bridge_fdb {
my ($conf, $vmid) = @_;
for my $opt (keys %$conf) {
next if $opt !~ m/^net(\d+)$/;
my $iface = "tap${vmid}i$1";
my $net = parse_net($conf->{$opt}) or next;
my $mac = $net->{macaddr} or next;
if ($have_sdn) {
PVE::Network::SDN::Zones::del_bridge_fdb($iface, $mac, $net->{bridge}, $net->{firewall});
} else {
PVE::Network::del_bridge_fdb($iface, $mac, $net->{firewall});
}
}
}
1;

View File

@ -158,6 +158,7 @@ $MigrationTest::Shared::qemu_server_module->mock(
$vm_stop_executed = 1;
delete $expected_calls->{'vm_stop'};
},
del_nets_bridge_fdb => sub { return; },
);
my $qemu_server_cpuconfig_module = Test::MockModule->new("PVE::QemuServer::CPUConfig");