Commit 318bbaa9 authored by Guido Trotter's avatar Guido Trotter

qa: fix RemoveInstanceOfflineNode for file-based

- 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)

Also fix a typo in the same function's docstring.
Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarMichele Tartara <mtartara@google.com>
parent 301c3bbb
...@@ -888,7 +888,7 @@ def TestBackupListFields(): ...@@ -888,7 +888,7 @@ def TestBackupListFields():
def TestRemoveInstanceOfflineNode(instance, snode, set_offline, set_online): def TestRemoveInstanceOfflineNode(instance, snode, set_offline, set_online):
"""gtn-instance remove with an off-line node """gnt-instance remove with an off-line node
@param instance: instance @param instance: instance
@param snode: secondary node, to be set offline @param snode: secondary node, to be set offline
...@@ -902,7 +902,15 @@ def TestRemoveInstanceOfflineNode(instance, snode, set_offline, set_online): ...@@ -902,7 +902,15 @@ def TestRemoveInstanceOfflineNode(instance, snode, set_offline, set_online):
TestInstanceRemove(instance) TestInstanceRemove(instance)
finally: finally:
set_online(snode) set_online(snode)
# Clean up the disks on the offline node
for minor in info["drbd-minors"][snode.primary]: # Clean up the disks on the offline node, if necessary
AssertCommand(["drbdsetup", str(minor), "down"], node=snode) if instance.disk_template not in constants.DTS_EXT_MIRROR:
AssertCommand(["lvremove", "-f"] + info["volumes"], node=snode) # 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)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment