Only remove the logical volumn that the virtual machine created instead of blasting the entire volumn group.
git-svn-id: https://svn.apache.org/repos/asf/incubator/tashi/trunk@1347602 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/tashi/nodemanager/vmcontrol/qemu.py b/src/tashi/nodemanager/vmcontrol/qemu.py
index 253ffe1..0caedfc 100644
--- a/src/tashi/nodemanager/vmcontrol/qemu.py
+++ b/src/tashi/nodemanager/vmcontrol/qemu.py
@@ -220,8 +220,9 @@
# remove scratch storage
try:
if self.scratchVg is not None:
- log.info("Removing any scratch for %s" % (name))
- cmd = "/sbin/lvremove --quiet -f %s" % self.scratchVg
+ scratchName = "lv%s" % name
+ log.info("Removing any scratch for %s" % (scratchName))
+ cmd = "/sbin/lvremove --quiet -f %s/%s" % (self.scratchVg, scratchName)
result = subprocess.Popen(cmd.split(), executable=cmd.split()[0], stdout=subprocess.PIPE, stderr=open(os.devnull, "w"), close_fds=True).wait()
except:
log.warning("Problem cleaning scratch volumes")