[pve-devel] [PATCH qemu-server 2/3] fix #971: don't activate shared storage in offline migration

Fabian Grünbichler f.gruenbichler at proxmox.com
Tue May 3 14:14:32 CEST 2016


instead, just print a warning if the connection check fails.
as long as the storage is online on the target node, the VM
will start fine after migration.
---
Note: PVE::Storage::Plugin->check_connection is only implemented
for the NFS, Gluster and iSCSI storage plugins at the moment.

 PVE/QemuMigrate.pm | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
index 41fc660..c4ad44b 100644
--- a/PVE/QemuMigrate.pm
+++ b/PVE/QemuMigrate.pm
@@ -154,18 +154,30 @@ sub prepare {
 	}
     }
 
-    # activate volumes
     my $vollist = PVE::QemuServer::get_vm_volumes($conf);
-    PVE::Storage::activate_volumes($self->{storecfg}, $vollist);
 
+    my $need_activate = [];
     foreach my $volid (@$vollist) {
 	my ($sid, $volname) = PVE::Storage::parse_volume_id($volid, 1);
 
 	# 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});
+
+	if ($scfg->{shared}) {
+	    # PVE::Storage::activate_storage checks this for non-shared storages
+	    my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
+	    warn "Used shared storage '$sid' is not online on source node!\n"
+		if !$plugin->check_connection($sid, $scfg);
+	} else {
+	    # only activate if not shared
+	    push @$need_activate, $volid;
+	}
     }
 
+    # activate volumes
+    PVE::Storage::activate_volumes($self->{storecfg}, $need_activate);
+
     # test ssh connection
     my $cmd = [ @{$self->{rem_ssh}}, '/bin/true' ];
     eval { $self->cmd_quiet($cmd); };
-- 
2.1.4





More information about the pve-devel mailing list