Fixes vNUMA resize negative test

When an asymmetric NUMA topology is required, all the NUMA
cells have to be explicitly described.

Nova will reject a request to build / resize an instance if it doesn't
fit into the available NUMA topology. If the compute nodes only have
1 NUMA node, an instance spanning 2 NUMA nodes cannot be built.

Change-Id: I054ad6f567771f12ccf92f690ecd9bb18c4fa532
This commit is contained in:
Claudiu Belu 2017-08-29 04:14:55 -07:00
parent 7467321d6a
commit 45e252c159
2 changed files with 30 additions and 2 deletions

View File

@ -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."),
]

View File

@ -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)