[pve-devel] [PATCH qemu-server 3/3] vm start: remove left-over VM-state-related properties
Fiona Ebner
f.ebner at proxmox.com
Thu Sep 18 11:38:42 CEST 2025
When cloning from a snapshot, VM-state-related properties would be
accidentally copied, see commit "partially fix #6805: api: clone:
properly remove all snapshot-related info". Detect and remove such
left-over properties upon VM start.
Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
Link: https://lore.proxmox.com/20250917163038.488710-7-f.ebner@proxmox.com
(cherry picked from commit 0db14e60109ea91a558f0f08594583588ef9ec66)
[FE: drop running-nets-host-mtu which does not exist in PVE 8]
Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
---
src/PVE/QemuServer.pm | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index 8bc55def..94d12a92 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -5905,6 +5905,20 @@ sub vm_migrate_alloc_nbd_disks {
return $nbd;
}
+my sub remove_left_over_vmstate_opts {
+ my ($vmid, $conf) = @_;
+
+ my $found;
+ for my $opt (qw(runningmachine runningcpu)) {
+ if (defined($conf->{$opt})) {
+ print "No VM state set, removing left-over option '$opt'\n";
+ delete $conf->{$opt};
+ $found = 1;
+ }
+ }
+ PVE::QemuConfig->write_config($vmid, $conf) if $found;
+}
+
# see vm_start_nolock for parameters, additionally:
# migrate_opts:
# storagemap = parsed storage map for allocating NBD disks
@@ -6434,6 +6448,8 @@ sub vm_start_nolock {
}
delete $conf->@{qw(lock vmstate runningmachine runningcpu)};
PVE::QemuConfig->write_config($vmid, $conf);
+ } elsif (!$conf->{vmstate}) {
+ remove_left_over_vmstate_opts($vmid, $conf);
}
PVE::GuestHelpers::exec_hookscript($conf, $vmid, 'post-start');
--
2.39.5
More information about the pve-devel
mailing list