[pve-devel] [PATCH ha-manager 5/6] update cfs before checking if VM/CT moved
Thomas Lamprecht
t.lamprecht at proxmox.com
Mon Feb 8 14:39:07 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>
---
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