]> git.proxmox.com Git - qemu-server.git/commitdiff
add with-local-disks option for live storage migration
authorAlexandre Derumier <aderumier@odiso.com>
Fri, 6 Jan 2017 09:15:07 +0000 (10:15 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 6 Jan 2017 11:10:25 +0000 (12:10 +0100)
As Fabian as required,
add an extra flag "with-local-disks"  to enable live storage migration with localdisk.

default target storage is same sid than source, this can be overrided with
"targetstorage" option.

I will try improve this later, with optionnal mapping, disk by disk.

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
PVE/API2/Qemu.pm
PVE/QemuMigrate.pm

index 288a9cd14b6ac200f15051d4302d8262a5ac17a9..33b8f5adb2b31b0a54627864b7a3150ba0388809 100644 (file)
@@ -2723,10 +2723,16 @@ __PACKAGE__->register_method({
                description => "CIDR of the (sub) network that is used for migration.",
                optional => 1,
            },
-           targetstorage => get_standard_option('pve-storage-id', {
-               description => "Target storage.",
+           "with-local-disks" => {
+               type => 'boolean',
+               description => "Enable live storage migration for local disk",
                optional => 1,
-           }),
+           },
+            targetstorage => get_standard_option('pve-storage-id', {
+               description => "Default target storage.",
+               optional => 1,
+               completion => \&PVE::QemuServer::complete_storage,
+            }),
        },
     },
     returns => {
index a5de8d040ccf827a025bfc2432ccc9f5215342c5..cd1fc2b35fe473a8109c556180445d1a70a913e6 100644 (file)
@@ -348,6 +348,7 @@ sub sync_disks {
            if ($local_volumes->{$vol} eq 'storage') {
                $self->log('info', "found local disk '$vol' (via storage)\n");
            } elsif ($local_volumes->{$vol} eq 'config') {
+               die "can't live migrate attached local disks without with-local-disks option\n" if $self->{running} && !$self->{opts}->{"with-local-disks"};
                $self->log('info', "found local disk '$vol' (in current VM config)\n");
            } elsif ($local_volumes->{$vol} eq 'snapshot') {
                $self->log('info', "found local disk '$vol' (referenced by snapshot(s))\n");