[pve-devel] [PATCH qemu-server 2/6] Partially-revert "cloudinit: add cloudinit section for current generated config"

Wolfgang Bumiller w.bumiller at proxmox.com
Wed Nov 16 18:14:04 CET 2022


This partially reverts commit 95a5135dad974c7eae249cf92b62b06fe911af33.
Particularly the unprotected write to the config when
generating the cloudinit file. We leave the rest as is for
now and update the callers to deal with the config later.

Signed-off-by: Wolfgang Bumiller <w.bumiller at proxmox.com>
---
 PVE/QemuServer/Cloudinit.pm | 31 -------------------------------
 1 file changed, 31 deletions(-)

diff --git a/PVE/QemuServer/Cloudinit.pm b/PVE/QemuServer/Cloudinit.pm
index b616c7b..f9bcbbc 100644
--- a/PVE/QemuServer/Cloudinit.pm
+++ b/PVE/QemuServer/Cloudinit.pm
@@ -576,37 +576,6 @@ sub generate_cloudinitconfig {
 
 	$generator->($conf, $vmid, $drive, $volname, $storeid);
     });
-
-    my $cloudinitconf = delete $conf->{cloudinit};
-    $cloudinitconf = {};
-
-    my @cloudinit_opts = keys %{PVE::QemuServer::cloudinit_config_properties()};
-    push @cloudinit_opts, 'name';
-
-    for my $opt (@cloudinit_opts) {
-
-	if ($opt =~ m/^ipconfig(\d+)/) {
-	    my $netid = "net$1";
-	    next if !defined($conf->{$netid});
-	    $conf->{cloudinit}->{$netid} = $conf->{$netid};
-	}
-
-	$conf->{cloudinit}->{$opt} = $conf->{$opt} if $conf->{$opt};
-    }
-
-    $conf->{cloudinit}->{name} = "VM$vmid" if !$conf->{cloudinit}->{name};
-
-    for my $opt (keys %{$conf}) {
-	if (PVE::QemuServer::is_valid_drivename($opt)) {
-	    my $drive = PVE::QemuServer::parse_drive($opt, $conf->{$opt});
-	    if (PVE::QemuServer::drive_is_cloudinit($drive)) {
-		$conf->{cloudinit}->{$opt} = $conf->{$opt};
-	    }
-	}
-    }
-
-    PVE::QemuConfig->write_config($vmid, $conf);
-
 }
 
 sub dump_cloudinit_config {
-- 
2.30.2






More information about the pve-devel mailing list