]> git.proxmox.com Git - pve-storage.git/commitdiff
complete_volume: avoid large list
authorDietmar Maurer <dietmar@proxmox.com>
Thu, 1 Oct 2015 08:56:19 +0000 (10:56 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 1 Oct 2015 08:56:19 +0000 (10:56 +0200)
PVE/Storage.pm

index d6465060775b0d7547d8e2227d0749cc901dbda3..eb31a4a25a2cc3bf387c28ab984c79ce880a96e8 100755 (executable)
@@ -1241,6 +1241,21 @@ sub complete_volume {
 
     my $storage_list = complete_storage_enabled();
 
+    if ($cvalue =~ m/^([^:]+):/) {
+       $storage_list = [ $1 ];
+    } else {
+       if (scalar(@$storage_list) > 1) {
+           # only list storage IDs to avoid large listings
+           my $res = [];
+           foreach my $storeid (@$storage_list) {
+               # Hack: simply return 2 artificial values, so that
+               # completions does not finish
+               push @$res, "$storeid:volname", "$storeid:...";
+           }
+           return $res;
+       }
+    }
+
     my $res = [];
     foreach my $storeid (@$storage_list) {
        my $vollist = PVE::Storage::volume_list($cfg, $storeid);