-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4967 from nanli1/add_case_for_invalid_nodeset_of_…
…numa_memory_binding numa: add case for invalid nodeset of numa memory binding
- Loading branch information
Showing
2 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
libvirt/tests/cfg/numa/numa_node_tuning/invalid_nodeset_of_numa_memory_binding.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
- guest_numa_node_tuning.invalid_nodeset: | ||
type = invalid_nodeset_of_numa_memory_binding | ||
start_vm = "no" | ||
error_msg = "error: unsupported configuration: NUMA node 2 is unavailable" | ||
variants tuning: | ||
- strict: | ||
tuning_mode = "strict" | ||
- interleave: | ||
tuning_mode = "interleave" | ||
- preferred: | ||
tuning_mode = "preferred" | ||
- restrictive: | ||
tuning_mode = "restrictive" | ||
variants node_set: | ||
- partially_inexistent: | ||
nodeset = "1-2" | ||
- totally_inexistent: | ||
nodeset = "2-3" | ||
variants binding: | ||
- host: | ||
vm_attrs = {'numa_memory': {'mode': "${tuning_mode}",'nodeset': "${nodeset}"}} | ||
- guest: | ||
cell_id = 0 | ||
numa_attr = "'cpu': {'numa_cell': [{'id': ${cell_id}, 'cpus': '0-1', 'memory': '2097152', 'unit': 'KiB'}]}" | ||
vm_attrs = {${numa_attr},'numa_memnode': [{'cellid':"${cell_id}",'mode': "${tuning_mode}",'nodeset':"${nodeset}"}]} |
70 changes: 70 additions & 0 deletions
70
libvirt/tests/src/numa/numa_node_tuning/invalid_nodeset_of_numa_memory_binding.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
# | ||
# Copyright Redhat | ||
# | ||
# SPDX-License-Identifier: GPL-2.0 | ||
|
||
# Author: Nan Li <[email protected]> | ||
# | ||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
import re | ||
|
||
from virttest import virt_vm | ||
|
||
from virttest.libvirt_xml import vm_xml | ||
|
||
|
||
def run(test, params, env): | ||
""" | ||
Verify that error msg prompts when starting a guest vm with | ||
invalid nodeset of numa memory binding | ||
""" | ||
|
||
def setup_test(): | ||
""" | ||
Prepare init xml | ||
""" | ||
test.log.info("TEST_SETUP: Set hugepage and guest boot ") | ||
vmxml = vm_xml.VMXML.new_from_dumpxml(vm_name) | ||
vmxml.setup_attrs(**vm_attrs) | ||
vmxml.sync() | ||
|
||
vmxml = vm_xml.VMXML.new_from_dumpxml(vm_name) | ||
test.log.debug("The init xml is:\n%s", vmxml) | ||
|
||
def run_test(): | ||
""" | ||
Start vm and check result | ||
""" | ||
test.log.info("TEST_STEP1: Start vm and check result") | ||
try: | ||
vm.start() | ||
if vm.is_alive(): | ||
test.fail("Guest state should not be running") | ||
except virt_vm.VMStartError as detail: | ||
if not re.search(error_msg, str(detail)): | ||
test.fail("Expect '%s' in '%s' " % (error_msg, str(detail))) | ||
else: | ||
test.log.debug("Got '%s' in '%s'" % (error_msg, detail)) | ||
|
||
def teardown_test(): | ||
""" | ||
Clean data. | ||
""" | ||
test.log.info("TEST_TEARDOWN: Clean up env.") | ||
bkxml.sync() | ||
|
||
vm_name = params.get("main_vm") | ||
vm = env.get_vm(vm_name) | ||
vmxml = vm_xml.VMXML.new_from_inactive_dumpxml(vm_name) | ||
bkxml = vmxml.copy() | ||
|
||
vm_attrs = eval(params.get("vm_attrs")) | ||
error_msg = params.get("error_msg") | ||
|
||
try: | ||
setup_test() | ||
run_test() | ||
|
||
finally: | ||
teardown_test() |