diff --git a/virttest/test_setup/__init__.py b/virttest/test_setup/__init__.py index 15565d8ea0..0f8dbdf8c4 100644 --- a/virttest/test_setup/__init__.py +++ b/virttest/test_setup/__init__.py @@ -556,6 +556,8 @@ def set_hugepages(self): msg = "Can't read/write from kernel hugepage file" raise exceptions.TestSetupFail(msg) if loop_hp == hp: + if loop_hp > 0: + self.cleanup() raise ValueError("Cannot set the kernel hugepage setting " "to the target value of %d hugepages." % self.target_hugepages)