diff --git a/oswin_tempest_plugin/config.py b/oswin_tempest_plugin/config.py index 4ac2d6e..93b34a3 100644 --- a/oswin_tempest_plugin/config.py +++ b/oswin_tempest_plugin/config.py @@ -56,6 +56,11 @@ HyperVGroup = [ default=False, help="RemoteFX feature is enabled and supported on the " "compute nodes."), + cfg.IntOpt('available_numa_nodes', + default=1, + help="The maximum number of NUMA cells the compute nodes " + "have. If it's less than 2, resize negative tests for " + "vNUMA will be skipped."), ] diff --git a/oswin_tempest_plugin/tests/scenario/test_vnuma.py b/oswin_tempest_plugin/tests/scenario/test_vnuma.py index 2b95294..3f89e2b 100644 --- a/oswin_tempest_plugin/tests/scenario/test_vnuma.py +++ b/oswin_tempest_plugin/tests/scenario/test_vnuma.py @@ -13,11 +13,16 @@ # License for the specific language governing permissions and limitations # under the License. +import testtools + +from oswin_tempest_plugin import config from oswin_tempest_plugin.tests._mixins import migrate from oswin_tempest_plugin.tests._mixins import optional_feature from oswin_tempest_plugin.tests._mixins import resize from oswin_tempest_plugin.tests import test_base +CONF = config.CONF + class HyperVvNumaTestCase(test_base.TestBase, migrate._MigrateMixin, @@ -32,5 +37,23 @@ class HyperVvNumaTestCase(test_base.TestBase, _BIGGER_FLAVOR = {'ram': 128, 'extra_specs': {'hw:numa_nodes': '1'}} # NOTE(claudiub): Hyper-V does not support asymmetric NUMA topologies. - _FEATURE_FLAVOR = {'ram': '128', 'extra_specs': { - 'hw:numa_nodes': '2', 'hw:numa_mem.0': '128'}} + # The resize should fail in this case. + _BAD_FLAVOR = {'ram': 64, 'extra_specs': { + 'hw:numa_nodes': '2', 'hw:numa_mem.0': '64', 'hw:numa_cpus.0': '0'}} + + @testtools.skipUnless(CONF.hyperv.available_numa_nodes > 1, + 'At least 2 NUMA nodes are required.') + @testtools.skipUnless(CONF.compute_feature_enabled.resize, + 'Resize is not available.') + def test_resize_negative(self): + new_flavor = self._create_new_flavor(self._get_flavor_ref(), + self._BAD_FLAVOR) + + # NOTE(claudiub): all NUMA nodes have to be properly defined. + vcpus = [i for i in range(1, int(new_flavor['vcpus']))] + extra_specs = {'hw:numa_mem.1': str(int(new_flavor['ram']) - 64), + 'hw:numa_cpus.1': ','.join(vcpus)} + self.admin_flavors_client.set_flavor_extra_spec( + new_flavor['id'], **extra_specs) + + self._check_resize(new_flavor['id'], expected_fail=True)