Commit cc2a70b1 authored by Guido Trotter's avatar Guido Trotter

qa: fix instance recreate disks for ST_FILE disks

More lvm commands "sprinkled" in qa :/ We really have to factor them out
in the storage layer, once we have a good one.
Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarMichele Tartara <mtartara@google.com>
parent 34ddd63a
......@@ -166,8 +166,8 @@ def _GetInstanceInfo(instance):
}
def _DestroyInstanceVolumes(instance):
"""Remove all the LVM volumes of an instance.
def _DestroyInstanceDisks(instance):
"""Remove all the backend disks of an instance.
This is used to simulate HW errors (dead nodes, broken disks...); the
configuration of the instance is not affected.
......@@ -176,9 +176,20 @@ def _DestroyInstanceVolumes(instance):
"""
info = _GetInstanceInfo(instance.name)
vols = info["volumes"]
for node in info["nodes"]:
AssertCommand(["lvremove", "-f"] + vols, node=node)
# FIXME: destruction/removal should be part of the disk class
if info["storage-type"] == constants.ST_LVM_VG:
vols = info["volumes"]
for node in info["nodes"]:
AssertCommand(["lvremove", "-f"] + vols, node=node)
elif info["storage-type"] == constants.ST_FILE:
# FIXME: file storage dir not configurable in qa
# Note that this works for both file and sharedfile, and this is intended.
filestorage = pathutils.DEFAULT_FILE_STORAGE_DIR
idir = os.path.join(filestorage, instance.name)
for node in info["nodes"]:
AssertCommand(["rm", "-rf"] + idir, node=node)
elif info["storage-type"] == constants.ST_DISKLESS:
pass
def _GetInstanceField(instance, field):
......@@ -786,7 +797,7 @@ def _AssertRecreateDisks(cmdargs, instance, fail=False, check=True,
"""
if destroy:
_DestroyInstanceVolumes(instance)
_DestroyInstanceDisks(instance)
AssertCommand((["gnt-instance", "recreate-disks"] + cmdargs +
[instance.name]), fail)
if not fail and check:
......
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