]> oss.titaniummirror.com Git - ovzbpc.git/commitdiff
BackupPC_ovz: add extra debug for lvremove
authorR. Steve McKown <rsmckown@gmail.com>
Mon, 9 Dec 2013 16:09:02 +0000 (09:09 -0700)
committerR. Steve McKown <rsmckown@gmail.com>
Mon, 9 Dec 2013 16:16:38 +0000 (09:16 -0700)
To help in tracking down sporadic lvremove issue.

BackupPC_ovz

index 2cbc86ca889b79990262893b1e9b41c8d6c37789..c6ef4bf200f1bade9170b69d76b1790262f01e67 100755 (executable)
@@ -282,12 +282,19 @@ sub delSnapshot($)
   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($)
@@ -424,20 +431,25 @@ sub checkRunningClient()
 
   # 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);
   }
 }