Skip to content

Commit cac3cfe

Browse files
authored
Merge pull request #6599 from meinaLi/iothreadset
Virtual disk/cpu: add new case for iothreadset
2 parents 0b12128 + 7e7740b commit cac3cfe

File tree

2 files changed

+35
-7
lines changed

2 files changed

+35
-7
lines changed

libvirt/tests/cfg/cpu/iothread.cfg

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,24 @@
6464
iothread_config = {'iothread': [{'id': '2', 'thread_pool_min': '1', 'thread_pool_max': '1', 'poll': {'max': '1', 'grow': '1', 'shrink': '1'}}]}
6565
test_operations = "iothreadset"
6666
check_iotheadids_inactive = "yes"
67+
- iothread_live_set:
68+
func_supported_since_libvirt_ver = (9, 4, 0)
69+
pre_vm_stats = "running"
70+
live_set = "yes"
71+
iothread_num = "2"
72+
iothread_ids = "1 2"
73+
iothreadset_id = "1"
74+
test_operations = "iothreadset"
75+
iothread_config = {'iothread': [{'id': '2', 'thread_pool_min': '1', 'thread_pool_max': '1', 'poll': {'max': '1', 'grow': '1', 'shrink': '1'}}]}
76+
variants:
77+
- with_max_value:
78+
thread_pool_max = 2147483647
79+
thread_pool_min = 2147483647
80+
iothreadset_val = "--thread-pool-min ${thread_pool_min} --thread-pool-max ${thread_pool_max} --poll-max-ns 2147483647 --poll-grow 2147483647 --poll-shrink 2147483647"
81+
- with_min_value:
82+
thread_pool_max = 1
83+
thread_pool_min = 1
84+
iothreadset_val = "--thread-pool-min ${thread_pool_min} --thread-pool-max ${thread_pool_max} --poll-max-ns 1 --poll-grow 1 --poll-shrink 1"
6785
- disk_attach:
6886
pre_vm_stats = "running"
6987
create_disk = "yes"

libvirt/tests/src/cpu/iothread.py

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ def _reassemble_iothread_config(mapping):
275275
iothread1.update({re.sub('-', '_', item.split()[0]): item.split()[1]})
276276
iothread1.update({'poll': tmp_poll})
277277
iothread_config['iothread'].append(iothread1)
278+
278279
logging.debug("Configured iothreads:%s", iothread_config['iothread'])
279280
return iothread_config
280281

@@ -396,6 +397,8 @@ def exec_iothreadset(need_verify=True):
396397
verify_poll()
397398
if test_thread_pool and need_verify:
398399
verify_thread_pool()
400+
if live_set:
401+
verify_iothread_by_vm_xml()
399402

400403
def exec_attach_disk(vm_name, source, target, thread_id,
401404
ignore_status=False):
@@ -464,18 +467,24 @@ def check_iothread_pool(org_pool, act_pool, is_equal=False):
464467
465468
:param org_pool: original pool
466469
:param act_pool: actual pool
467-
:param is_equal: True to assume they are some values
468-
False to check if they are different
470+
:param is_equal: True to check if org_pool is a subset of act_pool
471+
False to check if they are not exactly equal
469472
:raise: test.fail if result does not show as expected
470473
"""
471-
if (org_pool == act_pool) != is_equal:
472-
err_info = ("The iothread pool values haven't been updated!"
473-
"Expected: {}, Actual: {}".format(org_pool, act_pool))
474-
if is_equal:
474+
if is_equal:
475+
for key, expected_value in org_pool.items():
476+
if key not in act_pool or act_pool[key] != expected_value:
477+
err_info = ("The iothread pool values were not updated as expected. "
478+
"Mismatch found for key '%s'.\n"
479+
"Expected subset: %s\n"
480+
"Actual full set: %s" % (key, org_pool, act_pool))
481+
test.fail(err_info)
482+
else:
483+
if org_pool == act_pool:
475484
err_info = ("The iothread pool values have been updated "
476485
"unexpectedly! Expected: {}, Actual: {}"
477486
.format(org_pool, act_pool))
478-
test.fail(err_info)
487+
test.fail(err_info)
479488

480489
def check_schedinfo():
481490
"""
@@ -545,6 +554,7 @@ def _exec_schedinfo(items, update_error=False):
545554
restart_libvirtd = "yes" == params.get("restart_libvirtd", "no")
546555
restart_vm = "yes" == params.get("restart_vm", "no")
547556
need_start_vm = "yes" == params.get("need_start_vm", "no")
557+
live_set = "yes" == params.get("live_set", "no")
548558
test_operations = params.get("test_operations")
549559
cmd_options = params.get("cmd_options", '')
550560

0 commit comments

Comments
 (0)