Instead of failing later in the function, users are warned if the
underlying storage no longer exists.

Signed-off-by: Michael Köppl <m.koe...@proxmox.com>
---
 src/PVE/Storage.pm | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/PVE/Storage.pm b/src/PVE/Storage.pm
index d0a696a..f1fd46f 100755
--- a/src/PVE/Storage.pm
+++ b/src/PVE/Storage.pm
@@ -1046,6 +1046,11 @@ sub vdisk_free {
 
     my ($storeid, $volname) = parse_volume_id($volid);
     my $scfg = storage_config($cfg, $storeid);
+    if (!$scfg) {
+       log_warn("storage '$storeid' does not exist, mountpoint volume '$volid' 
could not be deleted");
+       return;
+    }
+
     my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
 
     activate_storage($cfg, $storeid);
-- 
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