From 2e462e195a65e6d5640e19c5936ec4708c82c64a Mon Sep 17 00:00:00 2001 From: Thomas Thrainer <thomasth@google.com> Date: Mon, 29 Apr 2013 13:51:29 +0200 Subject: [PATCH] Cleanup DRBD 8.4 devices properly during QA QA cleans up DRBD 8.4 devices via drbdsetup, which currently only worked for DRBD 8.3. This (rather ugly) command makes sure that DRBD 8.4 devices are cleaned up as well. Signed-off-by: Thomas Thrainer <thomasth@google.com> Signed-off-by: Michele Tartara <mtartara@google.com> Reviewed-by: Michele Tartara <mtartara@google.com> --- qa/qa_instance.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/qa/qa_instance.py b/qa/qa_instance.py index 3d1ef8c69..da623c72d 100644 --- a/qa/qa_instance.py +++ b/qa/qa_instance.py @@ -1053,7 +1053,16 @@ def TestRemoveInstanceOfflineNode(instance, snode, set_offline, set_online): # 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) + # DRBD 8.3 syntax comes first, then DRBD 8.4 syntax. The 8.4 syntax + # relies on the fact that we always create a resources for each minor, + # and that this resources is always named resource{minor}. + # As 'drbdsetup 0 down' does return success (even though that's invalid + # syntax), we always have to perform both commands and ignore the + # output. + drbd_shutdown_cmd = \ + "(drbdsetup %d down && drbdsetup down resource%d) || /bin/true" % \ + (minor, minor) + AssertCommand(drbd_shutdown_cmd, node=snode) AssertCommand(["lvremove", "-f"] + info["volumes"], node=snode) elif info["storage-type"] == constants.ST_FILE: filestorage = pathutils.DEFAULT_FILE_STORAGE_DIR -- GitLab