]> git.proxmox.com Git - qemu-server.git/commitdiff
cloud-init: don't add cloudinit isos as 'unused'
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Mon, 4 Apr 2016 08:04:10 +0000 (10:04 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 7 Mar 2018 08:11:31 +0000 (09:11 +0100)
They're regenerated anyway as needed.

PVE/QemuServer.pm

index ec91fadda8451405e2ec39b7d606abc377149a51..7361a13999bdd0763e14029534a4711b92c0f773 100644 (file)
@@ -2057,7 +2057,10 @@ sub vmconfig_undelete_pending_option {
 sub vmconfig_register_unused_drive {
     my ($storecfg, $vmid, $conf, $drive) = @_;
 
-    if (!drive_is_cdrom($drive, 1)) {
+    if (drive_is_cloudinit($drive)) {
+       eval { PVE::Storage::vdisk_free($storecfg, $drive->{file}) };
+       warn $@ if $@;
+    } elsif (!drive_is_cdrom($drive)) {
        my $volid = $drive->{file};
        if (vm_is_volid_owner($storecfg, $vmid, $volid)) {
            PVE::QemuConfig->add_unused_volume($conf, $volid, $vmid);
@@ -4679,6 +4682,9 @@ sub vmconfig_update_disk {
 
                if ($drive->{file} eq 'none') {
                    vm_mon_cmd($vmid, "eject",force => JSON::true,device => "drive-$opt");
+                   if (drive_is_cloudinit($old_drive)) {
+                       vmconfig_register_unused_drive($storecfg, $vmid, $conf, $old_drive);
+                   }
                } else {
                    my $path = get_iso_path($storecfg, $vmid, $drive->{file});
                    vm_mon_cmd($vmid, "eject", force => JSON::true,device => "drive-$opt"); # force eject if locked