[pve-devel] [PATCH qemu-server v7 1/7] pending changes: allow skipping cloud-init

Fabian Grünbichler f.gruenbichler at proxmox.com
Thu Nov 17 14:33:40 CET 2022


in case of remote migration, we use the `update_vm_api` helper for
checking permissions on the incoming config. this would also cause an
incoming cloud-init image to be overwritten, since the VM is not running
yet at this point.

provide a parameter which can be set by an incoming *remote* migration
to avoid having inconsistent cloud init images on the source and target
side.

Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---

Notes:
    new in v7

 PVE/QemuServer.pm | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index dd3d3512..dea5f251 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -5193,7 +5193,7 @@ sub vmconfig_delete_or_detach_drive {
 
 
 sub vmconfig_apply_pending {
-    my ($vmid, $conf, $storecfg, $errors) = @_;
+    my ($vmid, $conf, $storecfg, $errors, $skip_cloud_init) = @_;
 
     return if !scalar(keys %{$conf->{pending}});
 
@@ -5226,7 +5226,7 @@ sub vmconfig_apply_pending {
 
     PVE::QemuConfig->cleanup_pending($conf);
 
-    my $generate_cloudnit = undef;
+    my $generate_cloudnit = $skip_cloud_init ? 0 : undef;
 
     foreach my $opt (keys %{$conf->{pending}}) { # add/change
 	next if $opt eq 'delete'; # just to be sure
@@ -5241,7 +5241,7 @@ sub vmconfig_apply_pending {
 
 	    if (is_valid_drivename($opt)) {
 		my $drive = parse_drive($opt, $conf->{pending}->{$opt});
-		$generate_cloudnit = 1 if drive_is_cloudinit($drive);
+		$generate_cloudnit //= 1 if drive_is_cloudinit($drive);
 	    }
 
 	    $conf->{$opt} = delete $conf->{pending}->{$opt};
-- 
2.30.2






More information about the pve-devel mailing list