Unskip test_cpu_model_extra_flags

test_cpu_model_extra_flags used to hardcode the cpu_model and
cpu_model_extra_flags that it expected. This is obviously very tied to
the deployment, and so was being skipped. This patch unskips the test
by adding configuration options that describe the cpu_model and
cpu_model_extra_flags that are set in the deployment.

Change-Id: Id32dcaab42ca94d98e65b869773717d1f9fa89e7
This commit is contained in:
Artom Lifshitz 2020-11-24 12:31:36 -05:00
parent c74bb93b6d
commit 2429e67783
5 changed files with 28 additions and 17 deletions

View File

@ -85,7 +85,8 @@
$NOVA_CONF:
libvirt:
cpu_mode: custom
cpu_model: kvm64
cpu_models: kvm64
cpu_model_extra_flags: ssse3
virt_type: kvm
group-vars:
subnode:

View File

@ -13,6 +13,8 @@ function configure {
iniset $TEMPEST_CONFIG whitebox-hardware smt_hosts "$SMT_HOSTS"
fi
iniset $TEMPEST_CONFIG whitebox file_backed_memory_size $WHITEBOX_FILE_BACKED_MEMORY_SIZE
iniset $TEMPEST_CONFIG whitebox cpu_model $WHITEBOX_CPU_MODEL
iniset $TEMPEST_CONFIG whitebox cpu_model_extra_flags $WHITEBOX_CPU_MODEL_EXTRA_FLAGS
iniset $TEMPEST_CONFIG whitebox-nova-compute config_path "$WHITEBOX_NOVA_COMPUTE_CONFIG_PATH"
iniset $TEMPEST_CONFIG whitebox-nova-compute stop_command "$WHITEBOX_NOVA_COMPUTE_STOP_COMMAND"

View File

@ -3,6 +3,8 @@ 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_NOVA_COMPUTE_CONFIG_PATH=${WHITEBOX_NOVA_COMPUTE_CONFIG_PATH:-/etc/nova/nova-cpu.conf}
WHITEBOX_NOVA_COMPUTE_STOP_COMMAND=${WHITEBOX_NOVA_COMPUTE_STOP_COMMAND:-'systemctl stop devstack@n-cpu'}

View File

@ -13,9 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
from oslo_log import log as logging
from tempest import config
from tempest.lib import decorators
from whitebox_tempest_plugin.api.compute import base
@ -26,13 +27,9 @@ LOG = logging.getLogger(__name__)
class CpuModelExtraFlagsTest(base.BaseWhiteboxComputeTest):
# Required in /etc/nova/nova.conf
# [libvirt]
# cpu_mode = custom
# cpu_model = Haswell-noTSX
# cpu_model_extra_flags = vmx, pdpe1gb
# virt_type = kvm
@decorators.skip_because(bug='2006825', bug_type='storyboard')
@testtools.skipUnless(CONF.whitebox.cpu_model, "'cpu_model' must be set")
@testtools.skipUnless(CONF.whitebox.cpu_model_extra_flags,
"'cpu_model_extra_flags must be set")
def test_cpu_model_extra_flags(self):
server = self.create_test_server(wait_until="ACTIVE")
root = self.get_server_xml(server['id'])
@ -40,11 +37,10 @@ class CpuModelExtraFlagsTest(base.BaseWhiteboxComputeTest):
# 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,
"Haswell-noTSX", "Wrong CPU model defined in the instance xml")
self.assertNotEmpty(
root.findall('cpu[@mode="custom"]/feature[@name="vmx"]'),
"Cannot find feature 'vmx' in the instance xml")
self.assertNotEmpty(
root.findall('cpu[@mode="custom"]/feature[@name="pdpe1gb"]'),
"Cannot find feature 'pdpe1gb' in the instance xml")
'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)

View File

@ -86,7 +86,17 @@ general_opts = [
cfg.IntOpt(
'flavor_volume_size',
default=1,
help="volume size for flavor used in whitebox test")
help="volume size for flavor used in whitebox test"),
cfg.StrOpt(
'cpu_model',
help='The CPU model set in the [libvirt]/cpu_models config option '
'on the compute hosts. While Nova supports multiple cpu_models '
'(and has deprecated the old singular [libvirt]/cpu_model '
'option), whitebox assumes a single CPU model.'),
cfg.ListOpt(
'cpu_model_extra_flags',
help='Extra flags set in the [libvirt]/cpu_model_extra_flags config '
'option on the compute hosts.'),
]
nova_compute_group = cfg.OptGroup(