]> git.proxmox.com Git - qemu-server.git/commitdiff
fix #2563: allow live migration with local cloud-init disk
authorMira Limbeck <m.limbeck@proxmox.com>
Thu, 15 Jul 2021 12:33:18 +0000 (14:33 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 23 Jul 2021 09:04:22 +0000 (11:04 +0200)
The content of the ISO should be the same on both nodes, so offline
migrate the ISO, but don't regenerate it on VM start on the target node.

This way even with snippets the content will not change during live
migration.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
PVE/QemuMigrate.pm
PVE/QemuServer.pm

index 0b41db72cdcc06792089be1e92ec0fd16c09a78e..5ecc2a7179d1680bbb49cda6d43dded737749018 100644 (file)
@@ -579,7 +579,8 @@ sub scan_local_volumes {
            if ($self->{running} && $ref eq 'config') {
                $local_volumes->{$volid}->{migration_mode} = 'online';
            } elsif ($self->{running} && $ref eq 'generated') {
-               die "can't live migrate VM with local cloudinit disk. use a shared storage instead\n";
+               # offline migrate the cloud-init ISO and don't regenerate on VM start
+               $local_volumes->{$volid}->{migration_mode} = 'offline';
            } else {
                $local_volumes->{$volid}->{migration_mode} = 'offline';
            }
index 3126e14ea8f26e67f1c64417a3ae51647ee36862..cc73af8c15450c0f2024123c3de61b898739741f 100644 (file)
@@ -5171,7 +5171,9 @@ sub vm_start_nolock {
        $conf = PVE::QemuConfig->load_config($vmid); # update/reload
     }
 
-    PVE::QemuServer::Cloudinit::generate_cloudinitconfig($conf, $vmid);
+    # don't regenerate the ISO if the VM is started as part of a live migration
+    # this way we can reuse the old ISO with the correct config
+    PVE::QemuServer::Cloudinit::generate_cloudinitconfig($conf, $vmid) if !$migratedfrom;
 
     my $defaults = load_defaults();