If the storage backing the volume was removed, the volume will be marked
as unused when pending actions are processed (e.g. volume was detached).
Previously, the volume would simply disappear from the config.

Co-authored-by: Stefan Hrdlicka
Signed-off-by: Michael Köppl <m.koe...@proxmox.com>
---
 PVE/QemuServer.pm | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 68bbf4ce..d47fa51c 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -1838,7 +1838,11 @@ sub vmconfig_register_unused_drive {
        delete $conf->{'special-sections'}->{cloudinit};
     } elsif (!drive_is_cdrom($drive)) {
        my $volid = $drive->{file};
-       if (vm_is_volid_owner($storecfg, $vmid, $volid)) {
+       my ($storeid, undef) = PVE::Storage::parse_volume_id($volid);
+       if (
+           !PVE::Storage::storage_config($storecfg, $storeid, 1)
+           || vm_is_volid_owner($storecfg, $vmid, $volid)
+       ) {
            PVE::QemuConfig->add_unused_volume($conf, $volid, $vmid);
        }
     }
-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to