[pve-devel] [PATCH qemu-server 2/2] migrate: aquire guest_migration_lock during migration
Dietmar Maurer
dietmar at proxmox.com
Wed May 31 08:06:27 CEST 2017
To block replication jobs.
Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
---
PVE/API2/Qemu.pm | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index bc9f727..eb61cb8 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -16,6 +16,7 @@ use PVE::Storage;
use PVE::JSONSchema qw(get_standard_option);
use PVE::RESTHandler;
use PVE::ReplicationConfig;
+use PVE::GuestHelpers;
use PVE::QemuConfig;
use PVE::QemuServer;
use PVE::QemuMigrate;
@@ -2856,13 +2857,17 @@ __PACKAGE__->register_method({
} else {
- my $realcmd = sub {
- my $upid = shift;
+ my $code = sub {
+ my $realcmd = sub {
+ my $upid = shift;
+
+ PVE::QemuMigrate->migrate($target, $targetip, $vmid, $param);
+ };
- PVE::QemuMigrate->migrate($target, $targetip, $vmid, $param);
+ return $rpcenv->fork_worker('qmigrate', $vmid, $authuser, $realcmd);
};
- return $rpcenv->fork_worker('qmigrate', $vmid, $authuser, $realcmd);
+ return PVE::GuestHelpers::guest_migration_lock($vmid, 10, $code);
}
}});
--
2.11.0
More information about the pve-devel
mailing list