public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH qemu-server] fix #2563: allow live migration with local cloud-init disk
@ 2021-07-15 12:33 Mira Limbeck
  2021-07-23  9:06 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Mira Limbeck @ 2021-07-15 12:33 UTC (permalink / raw)
  To: pve-devel

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 | 3 ++-
 PVE/QemuServer.pm  | 4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
index 0b41db7..5ecc2a7 100644
--- a/PVE/QemuMigrate.pm
+++ b/PVE/QemuMigrate.pm
@@ -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';
 	    }
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index b0fe257..6f1862b 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -5155,7 +5155,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();
 
-- 
2.30.2





^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pve-devel] applied: [PATCH qemu-server] fix #2563: allow live migration with local cloud-init disk
  2021-07-15 12:33 [pve-devel] [PATCH qemu-server] fix #2563: allow live migration with local cloud-init disk Mira Limbeck
@ 2021-07-23  9:06 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2021-07-23  9:06 UTC (permalink / raw)
  To: Proxmox VE development discussion, Mira Limbeck

On 15.07.21 14:33, Mira Limbeck wrote:
> 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 | 3 ++-
>  PVE/QemuServer.pm  | 4 +++-
>  2 files changed, 5 insertions(+), 2 deletions(-)
> 
>

applied, thanks!




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-23  9:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-15 12:33 [pve-devel] [PATCH qemu-server] fix #2563: allow live migration with local cloud-init disk Mira Limbeck
2021-07-23  9:06 ` [pve-devel] applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal