]> git.proxmox.com Git - qemu-server.git/commitdiff
fix #971: don't activate shared storage in offline migration
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Tue, 3 May 2016 12:14:32 +0000 (14:14 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 4 May 2016 08:47:15 +0000 (10:47 +0200)
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.

PVE/QemuMigrate.pm

index 41fc6605170bbe423f1f5bceb54451b773dc6907..c4ad44bf75061aa7b73399c479acaa06c415843e 100644 (file)
@@ -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); };