- The cleanup should only happen for non externally mirrored disk
  templates
- It should behave differently for file and lvm based instances
- It should definitely *not* be explicit in the qa file :/ (but it's
  more important to fix qa, as of now)

Signed-off-by: Guido Trotter <[email protected]>
---
 qa/qa_instance.py |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/qa/qa_instance.py b/qa/qa_instance.py
index 0f3b877..c294556 100644
--- a/qa/qa_instance.py
+++ b/qa/qa_instance.py
@@ -902,7 +902,15 @@ def TestRemoveInstanceOfflineNode(instance, snode, 
set_offline, set_online):
     TestInstanceRemove(instance)
   finally:
     set_online(snode)
-  # Clean up the disks on the offline node
-  for minor in info["drbd-minors"][snode.primary]:
-    AssertCommand(["drbdsetup", str(minor), "down"], node=snode)
-  AssertCommand(["lvremove", "-f"] + info["volumes"], node=snode)
+
+  # Clean up the disks on the offline node, if necessary
+  if instance.disk_template not in constants.DTS_EXT_MIRROR:
+    # FIXME: abstract the cleanup inside the disks
+    if info["storage-type"] == constants.ST_LVM_VG:
+      for minor in info["drbd-minors"][snode.primary]:
+        AssertCommand(["drbdsetup", str(minor), "down"], node=snode)
+      AssertCommand(["lvremove", "-f"] + info["volumes"], node=snode)
+    elif info["storage-type"] == constants.ST_FILE:
+      filestorage = pathutils.DEFAULT_FILE_STORAGE_DIR
+      disk = os.path.join(filestorage, instance.name)
+      AssertCommand(["rm", "-rf", disk], node=snode)
-- 
1.7.10.4

Reply via email to