diff --git a/libvirt/tests/cfg/virt-admin/monitor/virt-admin_srv-list.cfg b/libvirt/tests/cfg/virt-admin/monitor/virt-admin_srv-list.cfg new file mode 100644 index 0000000000..ee49052b7e --- /dev/null +++ b/libvirt/tests/cfg/virt-admin/monitor/virt-admin_srv-list.cfg @@ -0,0 +1,9 @@ +- virt-admin.srv-list: + type = virt-admin_srv-list + start_vm = no + variants: + - admin: + server_name = "admin" + - libvirtd: + server_name = "libvirtd" + diff --git a/libvirt/tests/src/virt-admin/monitor/virt-admin_srv-list.py b/libvirt/tests/src/virt-admin/monitor/virt-admin_srv-list.py new file mode 100644 index 0000000000..473575e9d4 --- /dev/null +++ b/libvirt/tests/src/virt-admin/monitor/virt-admin_srv-list.py @@ -0,0 +1,20 @@ +import re +from autotest.client.shared import error + +from virttest import virtadmin + + +def run(test, params, env): + """ + Test command: virt-admin srv-list. + """ + server_name = params.get("server_name", "") + vp = virtadmin.VirtadminPersistent() + result = vp.srv_list(ignore_status=True, debug=True) + output = result.stdout.strip() + + if result.exit_status: + raise error.TestFail("This operation should success but failed!") + else: + if not re.search(server_name, output): + raise error.TestFail("server %s is not listed! ", server_name)