additionalProperties => 0,
properties => {
node => get_standard_option('pve-node'),
- storage => get_standard_option('pve-storage-id'),
+ storage => get_standard_option('pve-storage-id', {
+ completion => \&PVE::Storage::complete_storage_enabled,
+ }),
filename => {
description => "The name of the file to create.",
type => 'string',
},
- vmid => get_standard_option('pve-vmid', { description => "Specify owner VM" } ),
+ vmid => get_standard_option('pve-vmid', {
+ description => "Specify owner VM",
+ completion => \&PVE::Cluster::complete_vmid,
+ }),
size => {
description => "Size in kilobyte (1024 bytes). Optional suffixes 'M' (megabyte, 1024K) and 'G' (gigabyte, 1024M)",
type => 'string',
}
}
+# bash completion helper
+
+sub complete_storage {
+ my ($cmdname, $pname, $cvalue) = @_;
+
+ return $cmdname eq 'add' ? [] : [ PVE::Storage::storage_ids() ];
+}
+
+sub complete_storage_enabled {
+ my ($cmdname, $pname, $cvalue) = @_;
+
+ my $res = [];
+
+ my $cfg = PVE::Storage::config();
+ foreach my $sid (keys %{$cfg->{ids}}) {
+ next if !storage_check_enabled($cfg, $sid, undef, 1);
+ push @$res, $sid;
+ }
+ return $res;
+}
+
1;
my $defaultData = {
propertyList => {
type => { description => "Storage type." },
- storage => get_standard_option('pve-storage-id'),
+ storage => get_standard_option('pve-storage-id',
+ { completion => \&PVE::Storage::complete_storage }),
nodes => get_standard_option('pve-node-list', { optional => 1 }),
content => {
description => "Allowed content types. Note: value 'rootdir' is used for Containers, and value 'images' for KVM-Qemu VM's.\n",