From f879621b5d20dc70b191887e6fb31bd4d7c532e1 Mon Sep 17 00:00:00 2001 From: Hrvoje Ribicic Date: Wed, 18 Mar 2015 14:58:08 +0100 Subject: [PATCH] Make QA fail if KVM hotplugging fails Unlike almost all other modification commands, hotplugging a device and failing does not result in an error code showing that the operation was unsuccessful. Because of this, the QA ignored hotplugging failures. To fix this, this patch makes the QA examine the output of the command for signs of failure. Signed-off-by: Hrvoje Ribicic Reviewed-by: Klaus Aehlig --- qa/qa_instance.py | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/qa/qa_instance.py b/qa/qa_instance.py index fbb63cb53..b924d200a 100644 --- a/qa/qa_instance.py +++ b/qa/qa_instance.py @@ -500,6 +500,25 @@ def TestInstanceInfo(instance): AssertCommand(["gnt-instance", "info", instance.name]) +def _TestKVMHotplug(instance): + """Tests hotplug modification commands, noting that they + + """ + args_to_try = [ + ["--net", "-1:add", "--hotplug"], + ["--net", "-1:modify,mac=aa:bb:cc:dd:ee:ff", "--hotplug", "--force"], + ["--net", "-1:remove", "--hotplug"], + ["--disk", "-1:add,size=1G", "--hotplug"], + ["--disk", "-1:remove", "--hotplug"], + ] + for alist in args_to_try: + _, stdout, stderr = \ + AssertCommand(["gnt-instance", "modify"] + alist + [instance.name]) + if "failed" in stdout or "failed" in stderr: + raise qa_error.Error("Hotplugging command failed; please check output" + " for further information") + + @InstanceCheck(INST_UP, INST_UP, FIRST_ARG) def TestInstanceModify(instance): """gnt-instance modify""" @@ -545,13 +564,7 @@ def TestInstanceModify(instance): ]) elif default_hv == constants.HT_KVM and \ qa_config.TestEnabled("instance-device-hotplug"): - args.extend([ - ["--net", "-1:add", "--hotplug"], - ["--net", "-1:modify,mac=aa:bb:cc:dd:ee:ff", "--hotplug", "--force"], - ["--net", "-1:remove", "--hotplug"], - ["--disk", "-1:add,size=1G", "--hotplug"], - ["--disk", "-1:remove", "--hotplug"], - ]) + _TestKVMHotplug(instance) for alist in args: AssertCommand(["gnt-instance", "modify"] + alist + [instance.name]) -- GitLab