]> git.proxmox.com Git - qemu-server.git/commitdiff
pending changes: allow skipping cloud-init
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Thu, 17 Nov 2022 13:33:40 +0000 (14:33 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 17 Nov 2022 14:21:39 +0000 (15:21 +0100)
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@proxmox.com>
PVE/QemuServer.pm

index b54ec69ea1bb484e2f714a8c16d63f652ad73fff..a086408133420f8513502946bc8b8a418d7b23dd 100644 (file)
@@ -5211,7 +5211,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}});
 
@@ -5244,7 +5244,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
@@ -5259,7 +5259,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};