From b70b0c58b305c3bf20b217686253da888c9db095 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Thu, 1 Oct 2015 10:56:19 +0200 Subject: [PATCH] complete_volume: avoid large list --- PVE/Storage.pm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/PVE/Storage.pm b/PVE/Storage.pm index d646506..eb31a4a 100755 --- a/PVE/Storage.pm +++ b/PVE/Storage.pm @@ -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);