[pve-devel] [PATCH qemu-server] cloudinit: remove pending delete on online regenerate image

Alexandre Derumier aderumier at odiso.com
Sat Feb 6 14:39:54 CET 2021


currently only pending changes are applied when we regenerate
image on a running vm, but not the pending delete.

Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/QemuServer.pm | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 4d4efd9..f401baf 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -4462,6 +4462,13 @@ sub vmconfig_hotplug_pending {
 	    $conf->{$opt} = delete $conf->{pending}->{$opt};
 	}
 
+	my $pending_delete_hash = PVE::QemuConfig->parse_pending_delete($conf->{pending}->{delete});
+	foreach my $opt (sort keys %$pending_delete_hash) {
+	    next if !grep { $_ eq $opt } @cloudinit_opts;
+	    PVE::QemuConfig->remove_from_pending_delete($conf, $opt);
+	    delete $conf->{$opt};
+	}
+
 	my $new_conf = { %$conf };
 	$new_conf->{$key} = $value;
 	PVE::QemuServer::Cloudinit::generate_cloudinitconfig($new_conf, $vmid);
-- 
2.20.1




More information about the pve-devel mailing list