Add [baremetal] available_nodes configuration option
This patch adds the available_nodes configuration option so that when a
test requires more than one node it can be skipped if it is known that
there are not enough nodes in the environment to test that test.
Change-Id: I3a7809b2c4b06f429900bd40f4576b1bf8a50891
diff --git a/ironic_tempest_plugin/config.py b/ironic_tempest_plugin/config.py
index f9fefc4..887e6ad 100644
--- a/ironic_tempest_plugin/config.py
+++ b/ironic_tempest_plugin/config.py
@@ -120,6 +120,9 @@
min=0,
help="Ironic adjusted disk size to use in the standalone tests "
"as instance_info/root_gb value."),
+ cfg.IntOpt('available_nodes', min=0, default=None,
+ help="The number of baremetal hosts available to use for "
+ "the tests.")
]
BaremetalFeaturesGroup = [
diff --git a/ironic_tempest_plugin/tests/scenario/test_baremetal_multitenancy.py b/ironic_tempest_plugin/tests/scenario/test_baremetal_multitenancy.py
index 013eb2e..69ee6c8 100644
--- a/ironic_tempest_plugin/tests/scenario/test_baremetal_multitenancy.py
+++ b/ironic_tempest_plugin/tests/scenario/test_baremetal_multitenancy.py
@@ -44,6 +44,11 @@
if not CONF.baremetal.use_provision_network:
msg = 'Ironic/Neutron tenant isolation is not configured.'
raise cls.skipException(msg)
+ if (CONF.baremetal.available_nodes is not None and
+ CONF.baremetal.available_nodes < 2):
+ msg = ('Not enough baremetal nodes, %d configured, test requires '
+ 'a minimum of 2') % CONF.baremetal.available_nodes
+ raise cls.skipException(msg)
def create_tenant_network(self, clients, tenant_cidr):
network = self._create_network(