[pve-devel] [PATCH pve-container 6/9] add complete_storage this function gets all storages where you can run CT's

Wolfgang Link w.link at proxmox.com
Wed Nov 18 09:30:03 CET 2015


---
 src/PVE/LXC.pm | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index 172d8ec..d0727bf 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -2648,6 +2648,21 @@ sub userns_command {
 	return ['lxc-usernsexec', (map { ('-m', join(':', @$_)) } @$id_map), '--'];
     }
     return [];
+
+sub complete_storage {
+
+    my $cfg = PVE::Storage::config();
+    my $ids = $cfg->{ids};
+
+    my $res = [];
+    foreach my $sid (keys %$ids) {
+
+	next if !PVE::Storage::storage_check_enabled($cfg, $sid, undef, 1);
+	next if !$ids->{$sid}->{content}->{rootdir};
+	push @$res, $sid;
+    }
+
+    return $res;
 }
 
 1;
-- 
2.1.4




More information about the pve-devel mailing list