[pve-devel] applied: [PATCH storage] pvesm: add scan subcommands
Wolfgang Bumiller
w.bumiller at proxmox.com
Thu Nov 22 14:13:46 CET 2018
applied
On Mon, Nov 19, 2018 at 04:23:25PM +0100, Thomas Lamprecht wrote:
> Change to a cleaner sub command interface grouping all scan commands.
>
> Alias to old command names for backward compatibility
> Best viewed with the ignore whitespace/indent change '-w' flag from
> git
>
> Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
> ---
> PVE/CLI/pvesm.pm | 130 ++++++++++++++++++++++++-----------------------
> 1 file changed, 66 insertions(+), 64 deletions(-)
>
> diff --git a/PVE/CLI/pvesm.pm b/PVE/CLI/pvesm.pm
> index 5967573..0432450 100755
> --- a/PVE/CLI/pvesm.pm
> +++ b/PVE/CLI/pvesm.pm
> @@ -663,75 +663,77 @@ our $cmddef = {
> }],
> free => [ "PVE::API2::Storage::Content", 'delete', ['volume'],
> { node => $nodename } ],
> - nfsscan => [ __PACKAGE__, 'nfsscan', ['server'],
> - { node => $nodename }, sub {
> - my $res = shift;
> + scan => {
> + nfs => [ __PACKAGE__, 'nfsscan', ['server'], { node => $nodename }, sub {
> + my $res = shift;
>
> - my $maxlen = 0;
> - foreach my $rec (@$res) {
> - my $len = length ($rec->{path});
> - $maxlen = $len if $len > $maxlen;
> - }
> - foreach my $rec (@$res) {
> - printf "%-${maxlen}s %s\n", $rec->{path}, $rec->{options};
> - }
> - }],
> - cifsscan => [ __PACKAGE__, 'cifsscan', ['server'],
> - { node => $nodename }, sub {
> - my $res = shift;
> + my $maxlen = 0;
> + foreach my $rec (@$res) {
> + my $len = length ($rec->{path});
> + $maxlen = $len if $len > $maxlen;
> + }
> + foreach my $rec (@$res) {
> + printf "%-${maxlen}s %s\n", $rec->{path}, $rec->{options};
> + }
> + }],
> + cifs => [ __PACKAGE__, 'cifsscan', ['server'], { node => $nodename }, sub {
> + my $res = shift;
>
> - my $maxlen = 0;
> - foreach my $rec (@$res) {
> - my $len = length ($rec->{share});
> - $maxlen = $len if $len > $maxlen;
> - }
> - foreach my $rec (@$res) {
> - printf "%-${maxlen}s %s\n", $rec->{share}, $rec->{description};
> - }
> - }],
> - glusterfsscan => [ __PACKAGE__, 'glusterfsscan', ['server'],
> - { node => $nodename }, sub {
> - my $res = shift;
> + my $maxlen = 0;
> + foreach my $rec (@$res) {
> + my $len = length ($rec->{share});
> + $maxlen = $len if $len > $maxlen;
> + }
> + foreach my $rec (@$res) {
> + printf "%-${maxlen}s %s\n", $rec->{share}, $rec->{description};
> + }
> + }],
> + glusterfs => [ __PACKAGE__, 'glusterfsscan', ['server'], { node => $nodename }, sub {
> + my $res = shift;
>
> - foreach my $rec (@$res) {
> - printf "%s\n", $rec->{volname};
> - }
> - }],
> - iscsiscan => [ __PACKAGE__, 'iscsiscan', ['portal'],
> - { node => $nodename }, sub {
> - my $res = shift;
> + foreach my $rec (@$res) {
> + printf "%s\n", $rec->{volname};
> + }
> + }],
> + iscsi => [ __PACKAGE__, 'iscsiscan', ['portal'], { node => $nodename }, sub {
> + my $res = shift;
>
> - my $maxlen = 0;
> - foreach my $rec (@$res) {
> - my $len = length ($rec->{target});
> - $maxlen = $len if $len > $maxlen;
> - }
> - foreach my $rec (@$res) {
> - printf "%-${maxlen}s %s\n", $rec->{target}, $rec->{portal};
> - }
> - }],
> - lvmscan => [ __PACKAGE__, 'lvmscan', [],
> - { node => $nodename }, sub {
> - my $res = shift;
> - foreach my $rec (@$res) {
> - printf "$rec->{vg}\n";
> - }
> - }],
> - lvmthinscan => [ __PACKAGE__, 'lvmthinscan', ['vg'],
> - { node => $nodename }, sub {
> - my $res = shift;
> - foreach my $rec (@$res) {
> - printf "$rec->{lv}\n";
> - }
> - }],
> - zfsscan => [ __PACKAGE__, 'zfsscan', [],
> - { node => $nodename }, sub {
> - my $res = shift;
> + my $maxlen = 0;
> + foreach my $rec (@$res) {
> + my $len = length ($rec->{target});
> + $maxlen = $len if $len > $maxlen;
> + }
> + foreach my $rec (@$res) {
> + printf "%-${maxlen}s %s\n", $rec->{target}, $rec->{portal};
> + }
> + }],
> + lvm => [ __PACKAGE__, 'lvmscan', [], { node => $nodename }, sub {
> + my $res = shift;
> + foreach my $rec (@$res) {
> + printf "$rec->{vg}\n";
> + }
> + }],
> + lvmthin => [ __PACKAGE__, 'lvmthinscan', ['vg'], { node => $nodename }, sub {
> + my $res = shift;
> + foreach my $rec (@$res) {
> + printf "$rec->{lv}\n";
> + }
> + }],
> + zfs => [ __PACKAGE__, 'zfsscan', [], { node => $nodename }, sub {
> + my $res = shift;
>
> - foreach my $rec (@$res) {
> - printf "$rec->{pool}\n";
> - }
> - }],
> + foreach my $rec (@$res) {
> + printf "$rec->{pool}\n";
> + }
> + }],
> + },
> + nfsscan => { alias => 'scan nfs' },
> + cifsscan => { alias => 'scan cifs' },
> + glusterfsscan => { alias => 'scan glusterfs' },
> + iscsiscan => { alias => 'scan iscsi' },
> + lvmscan => { alias => 'scan lvm' },
> + lvmthinscan => { alias => 'scan lvmthin' },
> + zfsscan => { alias => 'scan zfs' },
> path => [ __PACKAGE__, 'path', ['volume']],
> extractconfig => [__PACKAGE__, 'extractconfig', ['volume']],
> export => [ __PACKAGE__, 'export', ['volume', 'format', 'filename']],
> --
> 2.19.1
More information about the pve-devel
mailing list