mirror of
git://git.proxmox.com/git/pve-storage.git
synced 2024-12-31 17:17:57 +03:00
clean: fix whitspaces and minor code issues
removed Data::Dumper and a newline Signed-off-by: Philipp Hufnagl <p.hufnagl@proxmox.com> re-added the newline, but fixed up the indentation at that line.. Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
parent
42c08f41cb
commit
618bdfd927
@ -53,7 +53,7 @@ __PACKAGE__->register_method ({
|
|||||||
protected => 1,
|
protected => 1,
|
||||||
proxyto => 'node',
|
proxyto => 'node',
|
||||||
parameters => {
|
parameters => {
|
||||||
additionalProperties => 0,
|
additionalProperties => 0,
|
||||||
properties => {
|
properties => {
|
||||||
node => get_standard_option('pve-node'),
|
node => get_standard_option('pve-node'),
|
||||||
storage => get_standard_option('pve-storage-id', {
|
storage => get_standard_option('pve-storage-id', {
|
||||||
@ -204,7 +204,7 @@ __PACKAGE__->register_method ({
|
|||||||
check => ['perm', '/storage/{storage}', ['Datastore.Audit', 'Datastore.AllocateSpace'], any => 1],
|
check => ['perm', '/storage/{storage}', ['Datastore.Audit', 'Datastore.AllocateSpace'], any => 1],
|
||||||
},
|
},
|
||||||
parameters => {
|
parameters => {
|
||||||
additionalProperties => 0,
|
additionalProperties => 0,
|
||||||
properties => {
|
properties => {
|
||||||
node => get_standard_option('pve-node'),
|
node => get_standard_option('pve-node'),
|
||||||
storage => get_standard_option('pve-storage-id'),
|
storage => get_standard_option('pve-storage-id'),
|
||||||
@ -248,7 +248,7 @@ __PACKAGE__->register_method ({
|
|||||||
protected => 1,
|
protected => 1,
|
||||||
proxyto => 'node',
|
proxyto => 'node',
|
||||||
parameters => {
|
parameters => {
|
||||||
additionalProperties => 0,
|
additionalProperties => 0,
|
||||||
properties => {
|
properties => {
|
||||||
node => get_standard_option('pve-node'),
|
node => get_standard_option('pve-node'),
|
||||||
storage => get_standard_option('pve-storage-id'),
|
storage => get_standard_option('pve-storage-id'),
|
||||||
@ -284,7 +284,7 @@ __PACKAGE__->register_method ({
|
|||||||
protected => 1,
|
protected => 1,
|
||||||
proxyto => 'node',
|
proxyto => 'node',
|
||||||
parameters => {
|
parameters => {
|
||||||
additionalProperties => 0,
|
additionalProperties => 0,
|
||||||
properties => {
|
properties => {
|
||||||
node => get_standard_option('pve-node'),
|
node => get_standard_option('pve-node'),
|
||||||
storage => get_standard_option('pve-storage-id'),
|
storage => get_standard_option('pve-storage-id'),
|
||||||
@ -295,11 +295,11 @@ __PACKAGE__->register_method ({
|
|||||||
},
|
},
|
||||||
ds => {
|
ds => {
|
||||||
description => "The list of datasources you want to display.",
|
description => "The list of datasources you want to display.",
|
||||||
type => 'string', format => 'pve-configid-list',
|
type => 'string', format => 'pve-configid-list',
|
||||||
},
|
},
|
||||||
cf => {
|
cf => {
|
||||||
description => "The RRD consolidation function",
|
description => "The RRD consolidation function",
|
||||||
type => 'string',
|
type => 'string',
|
||||||
enum => [ 'AVERAGE', 'MAX' ],
|
enum => [ 'AVERAGE', 'MAX' ],
|
||||||
optional => 1,
|
optional => 1,
|
||||||
},
|
},
|
||||||
@ -330,7 +330,7 @@ __PACKAGE__->register_method ({
|
|||||||
protected => 1,
|
protected => 1,
|
||||||
proxyto => 'node',
|
proxyto => 'node',
|
||||||
parameters => {
|
parameters => {
|
||||||
additionalProperties => 0,
|
additionalProperties => 0,
|
||||||
properties => {
|
properties => {
|
||||||
node => get_standard_option('pve-node'),
|
node => get_standard_option('pve-node'),
|
||||||
storage => get_standard_option('pve-storage-id'),
|
storage => get_standard_option('pve-storage-id'),
|
||||||
@ -341,7 +341,7 @@ __PACKAGE__->register_method ({
|
|||||||
},
|
},
|
||||||
cf => {
|
cf => {
|
||||||
description => "The RRD consolidation function",
|
description => "The RRD consolidation function",
|
||||||
type => 'string',
|
type => 'string',
|
||||||
enum => [ 'AVERAGE', 'MAX' ],
|
enum => [ 'AVERAGE', 'MAX' ],
|
||||||
optional => 1,
|
optional => 1,
|
||||||
},
|
},
|
||||||
@ -374,7 +374,7 @@ __PACKAGE__->register_method ({
|
|||||||
},
|
},
|
||||||
protected => 1,
|
protected => 1,
|
||||||
parameters => {
|
parameters => {
|
||||||
additionalProperties => 0,
|
additionalProperties => 0,
|
||||||
properties => {
|
properties => {
|
||||||
node => get_standard_option('pve-node'),
|
node => get_standard_option('pve-node'),
|
||||||
storage => get_standard_option('pve-storage-id'),
|
storage => get_standard_option('pve-storage-id'),
|
||||||
|
@ -2,7 +2,6 @@ package PVE::Storage;
|
|||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use Data::Dumper;
|
|
||||||
|
|
||||||
use POSIX;
|
use POSIX;
|
||||||
use IO::Select;
|
use IO::Select;
|
||||||
@ -304,11 +303,11 @@ sub volume_resize {
|
|||||||
|
|
||||||
my ($storeid, $volname) = parse_volume_id($volid, 1);
|
my ($storeid, $volname) = parse_volume_id($volid, 1);
|
||||||
if ($storeid) {
|
if ($storeid) {
|
||||||
my $scfg = storage_config($cfg, $storeid);
|
my $scfg = storage_config($cfg, $storeid);
|
||||||
my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
|
my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
|
||||||
return $plugin->volume_resize($scfg, $storeid, $volname, $size, $running);
|
return $plugin->volume_resize($scfg, $storeid, $volname, $size, $running);
|
||||||
} elsif ($volid =~ m|^(/.+)$| && -e $volid) {
|
} elsif ($volid =~ m|^(/.+)$| && -e $volid) {
|
||||||
die "resize file/device '$volid' is not possible\n";
|
die "resize file/device '$volid' is not possible\n";
|
||||||
} else {
|
} else {
|
||||||
die "unable to parse volume ID '$volid'\n";
|
die "unable to parse volume ID '$volid'\n";
|
||||||
}
|
}
|
||||||
@ -319,11 +318,11 @@ sub volume_rollback_is_possible {
|
|||||||
|
|
||||||
my ($storeid, $volname) = parse_volume_id($volid, 1);
|
my ($storeid, $volname) = parse_volume_id($volid, 1);
|
||||||
if ($storeid) {
|
if ($storeid) {
|
||||||
my $scfg = storage_config($cfg, $storeid);
|
my $scfg = storage_config($cfg, $storeid);
|
||||||
my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
|
my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
|
||||||
return $plugin->volume_rollback_is_possible($scfg, $storeid, $volname, $snap, $blockers);
|
return $plugin->volume_rollback_is_possible($scfg, $storeid, $volname, $snap, $blockers);
|
||||||
} elsif ($volid =~ m|^(/.+)$| && -e $volid) {
|
} elsif ($volid =~ m|^(/.+)$| && -e $volid) {
|
||||||
die "snapshot rollback file/device '$volid' is not possible\n";
|
die "snapshot rollback file/device '$volid' is not possible\n";
|
||||||
} else {
|
} else {
|
||||||
die "unable to parse volume ID '$volid'\n";
|
die "unable to parse volume ID '$volid'\n";
|
||||||
}
|
}
|
||||||
@ -334,11 +333,11 @@ sub volume_snapshot {
|
|||||||
|
|
||||||
my ($storeid, $volname) = parse_volume_id($volid, 1);
|
my ($storeid, $volname) = parse_volume_id($volid, 1);
|
||||||
if ($storeid) {
|
if ($storeid) {
|
||||||
my $scfg = storage_config($cfg, $storeid);
|
my $scfg = storage_config($cfg, $storeid);
|
||||||
my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
|
my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
|
||||||
return $plugin->volume_snapshot($scfg, $storeid, $volname, $snap);
|
return $plugin->volume_snapshot($scfg, $storeid, $volname, $snap);
|
||||||
} elsif ($volid =~ m|^(/.+)$| && -e $volid) {
|
} elsif ($volid =~ m|^(/.+)$| && -e $volid) {
|
||||||
die "snapshot file/device '$volid' is not possible\n";
|
die "snapshot file/device '$volid' is not possible\n";
|
||||||
} else {
|
} else {
|
||||||
die "unable to parse volume ID '$volid'\n";
|
die "unable to parse volume ID '$volid'\n";
|
||||||
}
|
}
|
||||||
@ -349,12 +348,12 @@ sub volume_snapshot_rollback {
|
|||||||
|
|
||||||
my ($storeid, $volname) = parse_volume_id($volid, 1);
|
my ($storeid, $volname) = parse_volume_id($volid, 1);
|
||||||
if ($storeid) {
|
if ($storeid) {
|
||||||
my $scfg = storage_config($cfg, $storeid);
|
my $scfg = storage_config($cfg, $storeid);
|
||||||
my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
|
my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
|
||||||
$plugin->volume_rollback_is_possible($scfg, $storeid, $volname, $snap);
|
$plugin->volume_rollback_is_possible($scfg, $storeid, $volname, $snap);
|
||||||
return $plugin->volume_snapshot_rollback($scfg, $storeid, $volname, $snap);
|
return $plugin->volume_snapshot_rollback($scfg, $storeid, $volname, $snap);
|
||||||
} elsif ($volid =~ m|^(/.+)$| && -e $volid) {
|
} elsif ($volid =~ m|^(/.+)$| && -e $volid) {
|
||||||
die "snapshot rollback file/device '$volid' is not possible\n";
|
die "snapshot rollback file/device '$volid' is not possible\n";
|
||||||
} else {
|
} else {
|
||||||
die "unable to parse volume ID '$volid'\n";
|
die "unable to parse volume ID '$volid'\n";
|
||||||
}
|
}
|
||||||
@ -366,11 +365,11 @@ sub volume_snapshot_delete {
|
|||||||
|
|
||||||
my ($storeid, $volname) = parse_volume_id($volid, 1);
|
my ($storeid, $volname) = parse_volume_id($volid, 1);
|
||||||
if ($storeid) {
|
if ($storeid) {
|
||||||
my $scfg = storage_config($cfg, $storeid);
|
my $scfg = storage_config($cfg, $storeid);
|
||||||
my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
|
my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
|
||||||
return $plugin->volume_snapshot_delete($scfg, $storeid, $volname, $snap, $running);
|
return $plugin->volume_snapshot_delete($scfg, $storeid, $volname, $snap, $running);
|
||||||
} elsif ($volid =~ m|^(/.+)$| && -e $volid) {
|
} elsif ($volid =~ m|^(/.+)$| && -e $volid) {
|
||||||
die "snapshot delete file/device '$volid' is not possible\n";
|
die "snapshot delete file/device '$volid' is not possible\n";
|
||||||
} else {
|
} else {
|
||||||
die "unable to parse volume ID '$volid'\n";
|
die "unable to parse volume ID '$volid'\n";
|
||||||
}
|
}
|
||||||
@ -409,9 +408,9 @@ sub volume_has_feature {
|
|||||||
|
|
||||||
my ($storeid, $volname) = parse_volume_id($volid, 1);
|
my ($storeid, $volname) = parse_volume_id($volid, 1);
|
||||||
if ($storeid) {
|
if ($storeid) {
|
||||||
my $scfg = storage_config($cfg, $storeid);
|
my $scfg = storage_config($cfg, $storeid);
|
||||||
my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
|
my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
|
||||||
return $plugin->volume_has_feature($scfg, $feature, $storeid, $volname, $snap, $running, $opts);
|
return $plugin->volume_has_feature($scfg, $feature, $storeid, $volname, $snap, $running, $opts);
|
||||||
} elsif ($volid =~ m|^(/.+)$| && -e $volid) {
|
} elsif ($volid =~ m|^(/.+)$| && -e $volid) {
|
||||||
return undef;
|
return undef;
|
||||||
} else {
|
} else {
|
||||||
@ -1503,7 +1502,7 @@ sub foreach_volid {
|
|||||||
|
|
||||||
foreach my $sid (keys %$list) {
|
foreach my $sid (keys %$list) {
|
||||||
foreach my $info (@{$list->{$sid}}) {
|
foreach my $info (@{$list->{$sid}}) {
|
||||||
my $volid = $info->{volid};
|
my $volid = $info->{volid};
|
||||||
my ($sid1, $volname) = parse_volume_id($volid, 1);
|
my ($sid1, $volname) = parse_volume_id($volid, 1);
|
||||||
if ($sid1 && $sid1 eq $sid) {
|
if ($sid1 && $sid1 eq $sid) {
|
||||||
&$func ($volid, $sid, $info);
|
&$func ($volid, $sid, $info);
|
||||||
@ -1827,7 +1826,7 @@ sub volume_export : prototype($$$$$$$) {
|
|||||||
my $scfg = storage_config($cfg, $storeid);
|
my $scfg = storage_config($cfg, $storeid);
|
||||||
my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
|
my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
|
||||||
return $plugin->volume_export($scfg, $storeid, $fh, $volname, $format,
|
return $plugin->volume_export($scfg, $storeid, $fh, $volname, $format,
|
||||||
$snapshot, $base_snapshot, $with_snapshots);
|
$snapshot, $base_snapshot, $with_snapshots);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub volume_import : prototype($$$$$$$$) {
|
sub volume_import : prototype($$$$$$$$) {
|
||||||
@ -1858,8 +1857,8 @@ sub volume_export_formats : prototype($$$$$) {
|
|||||||
my $scfg = storage_config($cfg, $storeid);
|
my $scfg = storage_config($cfg, $storeid);
|
||||||
my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
|
my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
|
||||||
return $plugin->volume_export_formats($scfg, $storeid, $volname,
|
return $plugin->volume_export_formats($scfg, $storeid, $volname,
|
||||||
$snapshot, $base_snapshot,
|
$snapshot, $base_snapshot,
|
||||||
$with_snapshots);
|
$with_snapshots);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub volume_import_formats : prototype($$$$$) {
|
sub volume_import_formats : prototype($$$$$) {
|
||||||
|
Loading…
Reference in New Issue
Block a user