From 5e05ebeb72540fdf250117847f5aef6c9ed16a8a Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Fri, 9 Aug 2013 15:04:06 +0200 Subject: [PATCH] Simplify create_snapshot function --- virt-backup | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/virt-backup b/virt-backup index 135ad7f..76d6aa3 100644 --- a/virt-backup +++ b/virt-backup @@ -750,10 +750,10 @@ sub save_xml{ sub create_snapshot{ my ($blk,$suffix) = @_; my $ret = 0; - print "Running: $opts{lvcreate} -s -n " . $blk . $suffix . - " -L $opts{snapsize} $blk > /dev/null 2>&1 < /dev/null\n" if $opts{debug}; - if ( system("$opts{lvcreate} -s -n " . $blk . $suffix . - " -L $opts{snapsize} $blk > /dev/null 2>&1 < /dev/null") == 0 ) { + my $cmd = "$opts{lvcreate} -s -n " . $blk . $suffix . + " -L $opts{snapsize} $blk > /dev/null 2>&1 < /dev/null\n"; + print "Running: $cmd" if $opts{debug}; + if ( system("$cmd") == 0 ) { $ret = 1; open SNAPLIST, ">>$backupdir.meta/snapshots" or die "Error, couldn't open snapshot list file\n"; print SNAPLIST $blk.$suffix ."\n";