Skip to content

Commit

Permalink
Test allow disabling CPU flags
Browse files Browse the repository at this point in the history
Implements test logic that validates disabling cpu flags within the
guest.

Related blueprint allow-disabling-cpu-flags
Depends-on: https://review.opendev.org/c/openstack/nova/+/774240
Change-Id: Idc8f0de7ca6d36abe236c3fe699c4bf8755ede49
  • Loading branch information
notartom authored and jamepark4 committed Apr 22, 2021
1 parent 486b832 commit 5cfd423
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
6 changes: 4 additions & 2 deletions .zuul.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,15 @@
LIBVIRT_TYPE: kvm
TEMPEST_PLUGINS: /opt/stack/whitebox-tempest-plugin
WHITEBOX_PRIVKEY_PATH: /home/tempest/.ssh/id_rsa
WHITEBOX_CPU_MODEL: kvm64
WHITEBOX_CPU_MODEL_EXTRA_FLAGS: vme,+ssse3,-mmx
devstack_local_conf:
post-config:
$NOVA_CONF:
libvirt:
cpu_mode: custom
cpu_models: kvm64
cpu_model_extra_flags: ssse3
cpu_model_extra_flags: vme,+ssse3,-mmx
virt_type: kvm
rx_queue_size: 1024
group-vars:
Expand All @@ -100,7 +102,7 @@
libvirt:
cpu_mode: custom
cpu_models: kvm64
cpu_model_extra_flags: ssse3
cpu_model_extra_flags: vme,+ssse3,-mmx
virt_type: kvm
rx_queue_size: 1024
tempest:
Expand Down
2 changes: 0 additions & 2 deletions devstack/settings
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ NOVA_FILTERS="$NOVA_FILTERS,NUMATopologyFilter"
WHITEBOX_AVAILABLE_CINDER_STORAGE=${WHITEBOX_AVAILABLE_CINDER_STORAGE:-24}
SMT_HOSTS=${SMT_HOSTS:-''}
WHITEBOX_FILE_BACKED_MEMORY_SIZE=${WHITEBOX_FILE_BACKED_MEMORY_SIZE:-8192}
WHITEBOX_CPU_MODEL=${WHITEBOX_CPU_MODEL:-kvm64}
WHITEBOX_CPU_MODEL_EXTRA_FLAGS=${WHITEBOX_CPU_MODEL_EXTRA_FLAGS:-ssse3}
WHITEBOX_RX_QUEUE_SIZE=${WHITEBOX_RX_QUEUE_SIZE:-1024}

WHITEBOX_NOVA_COMPUTE_CONFIG_PATH=${WHITEBOX_NOVA_COMPUTE_CONFIG_PATH:-/etc/nova/nova-cpu.conf}
Expand Down
20 changes: 16 additions & 4 deletions whitebox_tempest_plugin/api/compute/test_cpu_model_extra_flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,26 @@ class CpuModelExtraFlagsTest(base.BaseWhiteboxComputeTest):
def test_cpu_model_extra_flags(self):
server = self.create_test_server(wait_until="ACTIVE")
root = self.get_server_xml(server['id'])

# Assert that the correct CPU model as well as the proper flags
# are correctly defined in the instance XML
self.assertEqual(
CONF.whitebox.cpu_model,
root.find("cpu[@mode='custom']/model").text,
'Wrong CPU model defined in instance xml')
for flag in CONF.whitebox.cpu_model_extra_flags:
self.assertNotEmpty(
root.findall('cpu[@mode="custom"]/feature[@name="%s"]' % flag),
"Cannot find feature '%s' in the instance xml" % flag)
if flag.startswith('-'):
self.assertNotEmpty(
root.findall(
'cpu[@mode="custom"]/'
'feature[@name="%s"][@policy="disable"]' %
flag.strip('-')),
"Disabled feature '%s' not found in the XML" %
flag.strip('-'))
else:
self.assertNotEmpty(
root.findall(
'cpu[@mode="custom"]/'
'feature[@name="%s"][@policy="require"]' %
flag.strip('+')),
"Required feature '%s' not found in the XML" %
flag.strip('+'))

0 comments on commit 5cfd423

Please sign in to comment.