Add a safety check to the janitor to make sure we only delete old_ LV.
[invirt/packages/invirt-remote.git] / host / usr / sbin / invirt-lvm
index 22a7805..a505978 100755 (executable)
@@ -63,15 +63,9 @@ if subcommand == "lvremove":
             break
     ensureoff(machine)
     
-    # Fork. The child process wipes the LV and then deletes
-    # it. There's not really anything sane to do with errors (since
-    # this is running non-interactively), so let's just drop them on
-    # the floor for now.
-    if os.fork() == 0:
-        call(["/bin/dd", "if=/dev/zero", "of=%s" % new_lvpath])
-        call(["/sbin/lvchange", "-a", "n", new_lvpath])
-        call(["/sbin/lvchange", "-a", "ey", new_lvpath])
-        call(["/sbin/lvremove", "--force", new_lvpath])
+    # Touch a file corresponding to the new name of the LV; a separate
+    # daemon will handle wiping and deleting it.
+    open(os.path.join('/var/lib/invirt-remote/cleanup', new_lvname), 'w')
 elif subcommand == "lvresize":
     size = sys.argv[4]
     ensureoff(machine)