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

[Test only] testcase of Multi-host network #4229

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
14 changes: 14 additions & 0 deletions qemu/tests/cfg/multihost_network.cfg
Original file line number Diff line number Diff line change
@@ -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
52 changes: 52 additions & 0 deletions qemu/tests/multihost_network.py
Original file line number Diff line number Diff line change
@@ -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...")
Loading