From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 57E4176434 for ; Thu, 15 Jul 2021 14:33:22 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 46A832324C for ; Thu, 15 Jul 2021 14:33:22 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 290E723240 for ; Thu, 15 Jul 2021 14:33:21 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id E602241C3E for ; Thu, 15 Jul 2021 14:33:20 +0200 (CEST) From: Mira Limbeck To: pve-devel@lists.proxmox.com Date: Thu, 15 Jul 2021 14:33:18 +0200 Message-Id: <20210715123318.1420946-1-m.limbeck@proxmox.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.380 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery methods NO_DNS_FOR_FROM 0.001 Envelope sender has no MX or A DNS records SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_NONE 0.001 SPF: sender does not publish an SPF Record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [qemumigrate.pm, qemuserver.pm] Subject: [pve-devel] [PATCH qemu-server] fix #2563: allow live migration with local cloud-init disk X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jul 2021 12:33:22 -0000 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 --- 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