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 <aderumier@odiso.com>
(cherry picked from commit d80ad67f9d)
This commit is contained in:
Alexandre Derumier 2017-04-21 03:39:34 +02:00 committed by Fabian Grünbichler
parent 59c2b3a8ca
commit 08f918daab
2 changed files with 10 additions and 3 deletions

View File

@ -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') {

View File

@ -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};