if a storage is not available a volume will be added to the container
config as unused. before it would just disappear from the config

Signed-off-by: Stefan Hrdlicka <s.hrdli...@proxmox.com>
---
 PVE/QemuServer.pm | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 331677f..b57226b 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -2038,7 +2038,11 @@ sub vmconfig_register_unused_drive {
        delete $conf->{cloudinit};
     } elsif (!drive_is_cdrom($drive)) {
        my $volid = $drive->{file};
-       if (vm_is_volid_owner($storecfg, $vmid, $volid)) {
+       my ($storeid, $volname) = PVE::Storage::parse_volume_id($volid);
+       if (!PVE::Storage::storage_config($storecfg, $storeid, 1)) {
+           # if storage is not in config, skip owner check and add as unused
+           PVE::QemuConfig->add_unused_volume($conf, $volid, $vmid);
+       } elsif (vm_is_volid_owner($storecfg, $vmid, $volid)) {
            PVE::QemuConfig->add_unused_volume($conf, $volid, $vmid);
        }
     }
-- 
2.30.2



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

Reply via email to