add 'format' parameter to storage list call
we will use this for the gui to figure out if we have to show a size selector, a file selector, which formats are there, etc. we have to include this data even for not active storages, else we cannot show the correct fields Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
committed by
Fabian Grünbichler
parent
5da48ca6ea
commit
856c54bd75
@ -63,6 +63,12 @@ __PACKAGE__->register_method ({
|
|||||||
optional => 1,
|
optional => 1,
|
||||||
completion => \&PVE::Cluster::get_nodelist,
|
completion => \&PVE::Cluster::get_nodelist,
|
||||||
}),
|
}),
|
||||||
|
format => {
|
||||||
|
description => "Include information about formats",
|
||||||
|
type => 'boolean',
|
||||||
|
optional => 1,
|
||||||
|
default => 0,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
returns => {
|
returns => {
|
||||||
@ -87,7 +93,7 @@ __PACKAGE__->register_method ({
|
|||||||
|
|
||||||
my $cfg = PVE::Storage::config();
|
my $cfg = PVE::Storage::config();
|
||||||
|
|
||||||
my $info = PVE::Storage::storage_info($cfg, $param->{content});
|
my $info = PVE::Storage::storage_info($cfg, $param->{content}, $param->{format});
|
||||||
|
|
||||||
raise_param_exc({ storage => "No such storage." })
|
raise_param_exc({ storage => "No such storage." })
|
||||||
if $param->{storage} && !defined($info->{$param->{storage}});
|
if $param->{storage} && !defined($info->{$param->{storage}});
|
||||||
|
|||||||
@ -1001,7 +1001,7 @@ sub deactivate_volumes {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub storage_info {
|
sub storage_info {
|
||||||
my ($cfg, $content) = @_;
|
my ($cfg, $content, $includeformat) = @_;
|
||||||
|
|
||||||
my $ids = $cfg->{ids};
|
my $ids = $cfg->{ids};
|
||||||
|
|
||||||
@ -1048,13 +1048,21 @@ sub storage_info {
|
|||||||
next if !$info->{$storeid};
|
next if !$info->{$storeid};
|
||||||
next if !$info->{$storeid}->{enabled};
|
next if !$info->{$storeid}->{enabled};
|
||||||
|
|
||||||
|
my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
|
||||||
|
if ($includeformat) {
|
||||||
|
my $pd = $plugin->plugindata();
|
||||||
|
$info->{$storeid}->{format} = $pd->{format}
|
||||||
|
if $pd->{format};
|
||||||
|
$info->{$storeid}->{select_existing} = $pd->{select_existing}
|
||||||
|
if $pd->{select_existing};
|
||||||
|
}
|
||||||
|
|
||||||
eval { activate_storage($cfg, $storeid, $cache); };
|
eval { activate_storage($cfg, $storeid, $cache); };
|
||||||
if (my $err = $@) {
|
if (my $err = $@) {
|
||||||
warn $err;
|
warn $err;
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
|
|
||||||
my ($total, $avail, $used, $active);
|
my ($total, $avail, $used, $active);
|
||||||
eval { ($total, $avail, $used, $active) = $plugin->status($storeid, $scfg, $cache); };
|
eval { ($total, $avail, $used, $active) = $plugin->status($storeid, $scfg, $cache); };
|
||||||
warn $@ if $@;
|
warn $@ if $@;
|
||||||
|
|||||||
Reference in New Issue
Block a user