[pve-devel] [PATCH stable-4 qemu-server 3/3] live storage migration : fix check of target storage availability

Fabian Grünbichler f.gruenbichler at proxmox.com
Wed Oct 4 08:57:21 CEST 2017


From: Alexandre Derumier <aderumier at odiso.com>

if we define a different target storeid for remote node,
and that storage is not available on source node

Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
(cherry picked from commit d80ad67f9d3be88cb0775865ef3ef06b82907752)
Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
 PVE/API2/Qemu.pm   | 7 ++++++-
 PVE/QemuMigrate.pm | 6 ++++--
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index 5b703bd..cab1e25 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -2827,7 +2827,12 @@ __PACKAGE__->register_method({
 	}
 
 	my $storecfg = PVE::Storage::config();
-	PVE::QemuServer::check_storage_availability($storecfg, $conf, $target);
+
+	if( $param->{targetstorage}) {
+	    PVE::Storage::storage_check_node($storecfg, $param->{targetstorage}, $target);
+        } else {
+	    PVE::QemuServer::check_storage_availability($storecfg, $conf, $target);
+	}
 
 	if (PVE::HA::Config::vm_is_ha_managed($vmid) && $rpcenv->{type} ne 'ha') {
 
diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
index d3f717f..221eb8b 100644
--- a/PVE/QemuMigrate.pm
+++ b/PVE/QemuMigrate.pm
@@ -255,8 +255,10 @@ sub sync_disks {
 
 	    next if @{$dl->{$storeid}} == 0;
 
+	    my $targetsid = $self->{opts}->{targetstorage} ? $self->{opts}->{targetstorage} : $storeid;
+
 	    # check if storage is available on target node
-	    PVE::Storage::storage_check_node($self->{storecfg}, $storeid, $self->{node});
+	    PVE::Storage::storage_check_node($self->{storecfg}, $targetsid, $self->{node});
 	    $sharedvm = 0; # there is a non-shared disk
 
 	    PVE::Storage::foreach_volid($dl, sub {
@@ -293,7 +295,7 @@ sub sync_disks {
 	    my $targetsid = $self->{opts}->{targetstorage} ? $self->{opts}->{targetstorage} : $sid;
 	    # check if storage is available on both nodes
 	    my $scfg = PVE::Storage::storage_check_node($self->{storecfg}, $sid);
-	    PVE::Storage::storage_check_node($self->{storecfg}, $sid, $self->{node});
+	    PVE::Storage::storage_check_node($self->{storecfg}, $targetsid, $self->{node});
 
 	    return if $scfg->{shared};
 
-- 
2.14.1





More information about the pve-devel mailing list