Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the case of virt-admin.srv-threadpool-info #957

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
- virt-admin.srv-threadpool-info:
type = virt-admin_srv-threadpool-info
start_vm = no
variants:
- libvirtd:
server_name = "libvirtd"
min_workers = 6
max_workers = 21
prio_workers = 7
- admin:
server_name = "admin"
admin_min_workers = 2
admin_max_workers = 6


Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
from avocado.core import exceptions
from virttest import virtadmin
from virttest import utils_config
from virttest import utils_libvirtd


def run(test, params, env):
"""
Test virt-admin srv-threadpool-info
1) Change the threadpool related parameters in libvirtd.conf;
2) Restart libvirtd daemon;
3) Check whether the parameter value listed by srv-threadpool-info
are the same with the above settings.
"""
min_workers = params.get("min_workers")
max_workers = params.get("max_workers")
prio_workers = params.get("prio_workers")
admin_min_workers = params.get("admin_min_workers")
admin_max_workers = params.get("admin_max_workers")
server_name = params.get("server_name")

config = utils_config.LibvirtdConfig()
libvirtd = utils_libvirtd.Libvirtd()

try:
if server_name == "libvirtd":
config.min_workers = min_workers
config.max_workers = max_workers
config.prio_workers = prio_workers
elif server_name == "admin":
config.admin_min_workers = admin_min_workers
config.admin_max_workers = admin_max_workers

libvirtd.restart()
vp = virtadmin.VirtadminPersistent()
result = vp.srv_threadpool_info(server_name, ignore_status=True, debug=True)

output = result.stdout.strip().splitlines()
out_split = [item.split(':') for item in output]
out_dict = dict([[item[0].strip(), item[1].strip()] for item in out_split])

if result.exit_status:
raise exceptions.TestFail("This operation should success but failed!")
else:
if server_name == "libvirtd":
if not (out_dict["minWorkers"] == min_workers and
out_dict["maxWorkers"] == max_workers and
out_dict["prioWorkers"] == prio_workers):
raise exceptions.TestFail("attributes info listed by "
"srv-threadpool-info is not correct!")
elif server_name == "admin":
if not (out_dict["minWorkers"] == admin_min_workers and
out_dict["maxWorkers"] == admin_max_workers):
raise exceptions.TestFail("attributes info listed by "
"srv-threadpool-info is not correct!")
finally:
config.restore()
libvirtd.restart()