[pve-devel] [PATCH V2 pve-storage 1/8] add a storage_exists function

Stefan Hrdlicka s.hrdlicka at proxmox.com
Mon Sep 12 17:25:00 CEST 2022


adds a function that can take a volume id and return the relevant
storage config

Signed-off-by: Stefan Hrdlicka <s.hrdlicka at proxmox.com>
---
 PVE/Storage.pm | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/PVE/Storage.pm b/PVE/Storage.pm
index b9c53a1..9e95e3d 100755
--- a/PVE/Storage.pm
+++ b/PVE/Storage.pm
@@ -158,6 +158,15 @@ my $convert_maxfiles_to_prune_backups = sub {
     }
 };
 
+sub storage_exists {
+    my ($cfg, $volid) = @_;
+
+    my ($storeid, $volname) = parse_volume_id($volid);
+    my $scfg = storage_config($cfg, $storeid, 1);
+
+    return $scfg;
+}
+
 sub storage_config {
     my ($cfg, $storeid, $noerr) = @_;
 
-- 
2.30.2






More information about the pve-devel mailing list