coding style cleanup
This commit is contained in:
@ -3,7 +3,6 @@ package PVE::Storage::RBDPlugin;
|
|||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use IO::File;
|
use IO::File;
|
||||||
use IO::Handle qw( );
|
|
||||||
use PVE::Tools qw(run_command trim);
|
use PVE::Tools qw(run_command trim);
|
||||||
use PVE::Storage::Plugin;
|
use PVE::Storage::Plugin;
|
||||||
use PVE::JSONSchema qw(get_standard_option);
|
use PVE::JSONSchema qw(get_standard_option);
|
||||||
@ -85,30 +84,28 @@ sub run_rbd_command {
|
|||||||
|
|
||||||
my $lasterr;
|
my $lasterr;
|
||||||
my $errmsg = $args{errmsg} . ": " || "";
|
my $errmsg = $args{errmsg} . ": " || "";
|
||||||
if (!exists $args{errfunc}) {
|
if (!exists($args{errfunc})) {
|
||||||
# ' error: 2014-02-06 11:51:59.839135 7f09f94d0760 -1 librbd: snap_unprotect: can't unprotect;
|
# ' error: 2014-02-06 11:51:59.839135 7f09f94d0760 -1 librbd: snap_unprotect: can't unprotect;
|
||||||
# at least 1 child(ren) in pool cephstor1
|
# at least 1 child(ren) in pool cephstor1
|
||||||
$args{errfunc} = sub {
|
$args{errfunc} = sub {
|
||||||
my $line = shift;
|
my $line = shift;
|
||||||
if ($line =~ m/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+ [0-9a-f]+ [\-\d]+ librbd: (.*)$/) {
|
if ($line =~ m/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+ [0-9a-f]+ [\-\d]+ librbd: (.*)$/) {
|
||||||
$lasterr = $1 . "\n";
|
$lasterr = "$1\n";
|
||||||
} else {
|
} else {
|
||||||
$lasterr = $line;
|
$lasterr = $line;
|
||||||
}
|
}
|
||||||
print STDERR $lasterr;
|
print STDERR $lasterr;
|
||||||
STDERR->flush();
|
*STDERR->flush();
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
eval { run_command($cmd, %args); };
|
||||||
|
if (my $err = $@) {
|
||||||
|
die $errmsg . $lasterr if length($lasterr);
|
||||||
|
die $err;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $r;
|
return undef;
|
||||||
eval {
|
|
||||||
$r = run_command($cmd, %args);
|
|
||||||
};
|
|
||||||
|
|
||||||
die $errmsg . $lasterr if $@ && length $lasterr;
|
|
||||||
die $@ if $@;
|
|
||||||
|
|
||||||
return $r;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub rbd_ls {
|
sub rbd_ls {
|
||||||
|
|||||||
Reference in New Issue
Block a user