Simplify create_snapshot function

tags/virt-backup-0.2.12-1
Daniel Berteaud 11 years ago
parent 89a82b0b9a
commit 5e05ebeb72
  1. 8
      virt-backup

@ -750,10 +750,10 @@ sub save_xml{
sub create_snapshot{ sub create_snapshot{
my ($blk,$suffix) = @_; my ($blk,$suffix) = @_;
my $ret = 0; my $ret = 0;
print "Running: $opts{lvcreate} -s -n " . $blk . $suffix . my $cmd = "$opts{lvcreate} -s -n " . $blk . $suffix .
" -L $opts{snapsize} $blk > /dev/null 2>&1 < /dev/null\n" if $opts{debug}; " -L $opts{snapsize} $blk > /dev/null 2>&1 < /dev/null\n";
if ( system("$opts{lvcreate} -s -n " . $blk . $suffix . print "Running: $cmd" if $opts{debug};
" -L $opts{snapsize} $blk > /dev/null 2>&1 < /dev/null") == 0 ) { if ( system("$cmd") == 0 ) {
$ret = 1; $ret = 1;
open SNAPLIST, ">>$backupdir.meta/snapshots" or die "Error, couldn't open snapshot list file\n"; open SNAPLIST, ">>$backupdir.meta/snapshots" or die "Error, couldn't open snapshot list file\n";
print SNAPLIST $blk.$suffix ."\n"; print SNAPLIST $blk.$suffix ."\n";

Loading…
Cancel
Save