From 5774a3fa53f95b7717f6f4de233a79e3f0a4ab43 Mon Sep 17 00:00:00 2001 From: Katerina Koukiou Date: Thu, 19 Oct 2023 17:31:35 +0200 Subject: [PATCH] testlib: when provisioning VMs allow to keep the original machine_class This use case is becoming now valid in the anaconda repository, where we overwrite the machine_class for running the VMs from ISO, however we will need to start provisioning 'normal' cloud VMs, to act as servers for network storage; see iscsi. --- test/common/testlib.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/test/common/testlib.py b/test/common/testlib.py index cad853fe7eb..491e7a23471 100644 --- a/test/common/testlib.py +++ b/test/common/testlib.py @@ -1276,8 +1276,9 @@ def kill_global_machine(cls): def label(self): return self.__class__.__name__ + '-' + self._testMethodName - def new_machine(self, image=None, forward=None, restrict=True, cleanup=True, **kwargs): - machine_class = self.machine_class + def new_machine(self, image=None, forward=None, restrict=True, cleanup=True, inherit_machine_class=True, **kwargs): + machine_class = inherit_machine_class and self.machine_class or testvm.VirtMachine + if opts.address: if forward: raise unittest.SkipTest("Cannot run this test when specific machine address is specified") @@ -1289,8 +1290,6 @@ def new_machine(self, image=None, forward=None, restrict=True, cleanup=True, **k image = os.path.join(TEST_DIR, "images", self.image) if not os.path.exists(image): raise FileNotFoundError("Can't run tests without a prepared image; use test/image-prepare") - if not machine_class: - machine_class = testvm.VirtMachine if not self.network: network = testvm.VirtNetwork(image=image) if cleanup: