[pve-devel] [PATCH ha-manager 1/2] update cfs before checking if VM/CT moved

Thomas Lamprecht t.lamprecht at proxmox.com
Fri Feb 5 17:51:16 CET 2016


As else we could get a race condition where the VM migrated but
the check returns false because of a cached result (?).

This could result in an out of date HA state.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---

Hard reproducible, at best with a few (~4-6) VMs with
quite a lot memory load (or windows VMs). Then exec
live migration of all those VMs simultaneously.
In my (and wolfgang l.) test about 1 from 3 resulted in an
out of sync state.

 src/PVE/HA/Resources/PVECT.pm | 2 ++
 src/PVE/HA/Resources/PVEVM.pm | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/src/PVE/HA/Resources/PVECT.pm b/src/PVE/HA/Resources/PVECT.pm
index 939d888..bee8b33 100644
--- a/src/PVE/HA/Resources/PVECT.pm
+++ b/src/PVE/HA/Resources/PVECT.pm
@@ -8,6 +8,7 @@ use PVE::HA::Tools;
 use PVE::LXC;
 use PVE::API2::LXC;
 use PVE::API2::LXC::Status;
+use PVE::Cluster;
 
 use base qw(PVE::HA::Resources);
 
@@ -103,6 +104,7 @@ sub migrate {
     my $upid = PVE::API2::LXC->migrate_vm($params);
     PVE::HA::Tools::upid_wait($upid, $haenv);
 
+    PVE::Cluster::cfs_update();
     # check if vm really moved
     return !(-f $oldconfig);
 }
diff --git a/src/PVE/HA/Resources/PVEVM.pm b/src/PVE/HA/Resources/PVEVM.pm
index cb03d23..a6ea0a1 100644
--- a/src/PVE/HA/Resources/PVEVM.pm
+++ b/src/PVE/HA/Resources/PVEVM.pm
@@ -7,6 +7,7 @@ use PVE::HA::Tools;
 
 use PVE::QemuServer;
 use PVE::API2::Qemu;
+use PVE::Cluster;
 
 use base qw(PVE::HA::Resources);
 
@@ -103,6 +104,8 @@ sub migrate {
     my $upid = PVE::API2::Qemu->migrate_vm($params);
     PVE::HA::Tools::upid_wait($upid, $haenv);
 
+    PVE::Cluster::cfs_update();
+
     # check if vm really moved
     return !(-f $oldconfig);
 }
-- 
2.1.4





More information about the pve-devel mailing list