my $dir = $ve->{'snaproot'};
if (defined($dir) && -d $dir) {
#cmdSystemOrEval("rm -rf $dir/etc/vzdump");
+ print $dbgf ": delSnapshot snapshot mounted at $dir\n";
cmdSystemOrEval("umount $dir");
cmdSystemOrEval("rmdir $dir");
}
my $dev = $ve->{'snapdev'};
- cmdSystemOrEval("lvremove -f $dev >/dev/null 2>&1") if (-b $dev);
+ #cmdSystemOrEval("lvremove -f $dev >/dev/null 2>&1") if (-b $dev);
+ if (-b $dev) {
+ print $dbgf ": removing LV $dev\n";
+ system("lvremove -f $dev >>$dbgfn 2>&1")
+ } else {
+ print $dbgf ": lvremove: $dev is not block special\n";
+ }
}
sub getDevice($)
# Clean up any prior backup's mount point and snapshot, if it exists.
# Note that the snapshot is small, so we don't really want it lying around!
+ # There are cases where the snapshot will not show as a snapshot, and in
+ # these cases the LV will not be removed by this function.
my $vg = undef;
open my $fh, "lvscan|" || mydie "Unable to exec lvscan";
while (my $line = <$fh>) {
+ #print $dbgf ": checkRunningClient lvscan line=$line\n";
if ($line =~ m|^\s+ACTIVE\s+Snapshot\s+\'/dev/([^/]+)/$vzsnap\'\s|) {
$vg = $1;
+ #print $dbgf ": checkRunningClient vg=$vg\n";
}
}
close($fh);
if (defined($vg)) {
my $dev = "/dev/mapper/$vg-$vzsnap";
- #print "Found vzsnap lv $dev\n";
+ print $dbgf ": found vzsnap lv $dev\n";
cmdSystemOrEval("umount /$vzsnap");
cmdSystemOrEval("rmdir /$vzsnap") if (-d "/$vzsnap");
- cmdSystemOrEval("lvremove -f $dev >/dev/null 2>&1") if (-b $dev);
+ #cmdSystemOrEval("lvremove -f $dev >/dev/null 2>&1") if (-b $dev);
+ system("lvremove -f $dev >>$dbgfn 2>&1") if (-b $dev);
}
}