From 08f918daab7cc7a2bd865f614e2754aeabb0ad5d Mon Sep 17 00:00:00 2001 From: Alexandre Derumier Date: Fri, 21 Apr 2017 03:39:34 +0200 Subject: [PATCH] live storage migration : fix check of target storage availability if we define a different target storeid for remote node, and that storage is not available on source node Signed-off-by: Alexandre Derumier (cherry picked from commit d80ad67f9d3be88cb0775865ef3ef06b82907752) --- 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 5b703bd5..cab1e25e 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 d3f717f8..221eb8b2 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};