From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 4F1431FF178 for ; Mon, 1 Dec 2025 14:53:30 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 73EAA1DFC2; Mon, 1 Dec 2025 14:53:52 +0100 (CET) From: Fiona Ebner To: pve-devel@lists.proxmox.com Date: Mon, 1 Dec 2025 14:51:54 +0100 Message-ID: <20251201135345.125993-1-f.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1764597186043 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.017 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH qemu-server] migration: prohibit renaming cloud-init drive 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: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" Usually, disks are allowed to be renamed during migration if there is a naming conflict caused by a left-over disk on the target. However, the type of the cloud-init disk is encoded in its name, so it must not be renamed or it cannot be recognized as a cloud-init disk anymore, as reported in the community forum [0]. [0]: https://forum.proxmox.com/threads/167767/ Signed-off-by: Fiona Ebner --- src/PVE/QemuMigrate.pm | 6 +++++- src/PVE/QemuServer.pm | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/PVE/QemuMigrate.pm b/src/PVE/QemuMigrate.pm index 8fa84080..a1d7471c 100644 --- a/src/PVE/QemuMigrate.pm +++ b/src/PVE/QemuMigrate.pm @@ -439,6 +439,7 @@ sub scan_local_volumes { PVE::Storage::volume_size_info($storecfg, $volid); $local_volumes->{$volid}->{is_vmstate} = $attr->{is_vmstate} ? 1 : 0; + $local_volumes->{$volid}->{is_cloudinit} = $attr->{is_cloudinit} ? 1 : 0; $local_volumes->{$volid}->{drivename} = $attr->{drivename} if $attr->{drivename}; @@ -725,11 +726,14 @@ sub sync_offline_local_volumes { my $bwlimit = $local_volumes->{$volid}->{bwlimit}; $bwlimit = $bwlimit * 1024 if defined($bwlimit); # storage_migrate uses bps + my $preserve_name = + $local_volumes->{$volid}->{is_vmstate} || $local_volumes->{$volid}->{is_cloudinit}; + my $storage_migrate_opts = { 'ratelimit_bps' => $bwlimit, 'insecure' => $opts->{migration_type} eq 'insecure', 'with_snapshots' => $local_volumes->{$volid}->{snapshots}, - 'allow_rename' => !$local_volumes->{$volid}->{is_vmstate}, + 'allow_rename' => !$preserve_name, }; my $logfunc = sub { $self->log('info', $_[0]); }; diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm index a7fbec14..70faab62 100644 --- a/src/PVE/QemuServer.pm +++ b/src/PVE/QemuServer.pm @@ -4502,6 +4502,9 @@ sub foreach_volid { $volhash->{$volid}->{cdrom} //= 1; $volhash->{$volid}->{cdrom} = 0 if !drive_is_cdrom($drive); + $volhash->{$volid}->{is_cloudinit} //= 0; + $volhash->{$volid}->{is_cloudinit} = 1 if drive_is_cloudinit($drive); + my $replicate = $drive->{replicate} // 1; $volhash->{$volid}->{replicate} //= 0; $volhash->{$volid}->{replicate} = 1 if $replicate; -- 2.47.3 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel