From ea585dd6a5dab66f5adbcd250a6af9c884137f24 Mon Sep 17 00:00:00 2001 From: "Houqi (Nick) Zuo" Date: Tue, 10 Dec 2024 14:29:23 +0800 Subject: [PATCH] Test only Signed-off-by: Houqi (Nick) Zuo --- qemu/tests/cfg/multihost_network.cfg | 14 ++++++++ qemu/tests/multihost_network.py | 52 ++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 qemu/tests/cfg/multihost_network.cfg create mode 100644 qemu/tests/multihost_network.py diff --git a/qemu/tests/cfg/multihost_network.cfg b/qemu/tests/cfg/multihost_network.cfg new file mode 100644 index 0000000000..00eae37761 --- /dev/null +++ b/qemu/tests/cfg/multihost_network.cfg @@ -0,0 +1,14 @@ +- multihost_network: + type = multihost_network + vms = '' + start_vm = no + kill_vm = yes + nodes = node1 + vm_node = node1 + multihost = yes + + nics = nic1 + add_tapfd_nic1 = yes + tapfds_nic1 = 11 + start_vm = no + tapfds_len = 1 diff --git a/qemu/tests/multihost_network.py b/qemu/tests/multihost_network.py new file mode 100644 index 0000000000..ff7ff909a7 --- /dev/null +++ b/qemu/tests/multihost_network.py @@ -0,0 +1,52 @@ +from virttest.vt_resmgr import resmgr + + +def run(test, params, env): + # resource_id => bind => allocate/sync/release => unbind + # call get_resource_info() to gain fds + res_config = resmgr.define_resource_config("testcase", "port", params) + test.log.info("pool_config: %s", str(res_config)) + + resource_id = resmgr.create_resource_object(res_config) + test.log.info("resource_id: %s", str(resource_id)) + + resmgr.update_resource(resource_id, {"bind": {"nodes": ["host1"]}}) + test.log.info("bind...") + + resmgr.update_resource(resource_id, {"allocate": {}}) + test.log.info("After allocate...") + + # resmgr.update_resource(resource_id, {"sync": {}}) + # test.log.info("sync...") + + resource_info = resmgr.get_resource_info(resource_id) + test.log.info("get_resource_info: %s", str(resource_info)) + try: + # ********************************* + # Set fds in qemu cmdline on worker node. + # + # The following code is unnecessary. + # ********************************* + # params["add_tapfd_nic1"] = resource_info["spec"]["fds"] + # params["start_vm"] = "yes" + # vm_name = params["main_vm"] + # + # env_process.preprocess_vm(test, params, env, vm_name) + # vm = env.get_vm(vm_name) + # vm.create() + # vm.verify_alive() + # vm.wait_for_login() + # vm.destroy() + pass + finally: + resmgr.update_resource(resource_id, {"release": {}}) + test.log.info("After release...") + + # resmgr.update_resource(resource_id, {"sync": {}}) + # test.log.info("sync...") + + resource_info = resmgr.get_resource_info(resource_id) + test.log.info("get_resource_info: %s", str(resource_info)) + + resmgr.update_resource(resource_id, {"unbind": {"nodes": []}}) + test.log.info("unbind...")