Skip to content

Commit

Permalink
qemu.qemu_vm: support vhostfd in netdev.
Browse files Browse the repository at this point in the history
vhostfd only works when vhost on.
add enable_vhost parameter. set default value to 'yes'
Signed-off-by: Feng Yang <[email protected]>
  • Loading branch information
Feng Yang committed Jul 1, 2013
1 parent bea555a commit 1bb156e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions qemu/cfg/host-kernel.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ variants:
query_cmd = "cat /sys/kernel/mm/ksm/pages_sharing"
virtio_net:
vhost = "vhost=on"
# enable_vhostfd only works with vhost=on
enable_vhostfd = yes
Win2008, Win2008r2, Win7:
cpu_model_flags += ",hv_relaxed"
block_stream, drive_mirror, live_snapshot, live_snapshot_chain:
Expand Down Expand Up @@ -135,6 +137,8 @@ variants:
cpu_model_flags += ",hv_relaxed"
virtio_net:
vhost = "vhost=on"
# enable_vhostfd only works with vhost=on
enable_vhostfd = yes
monitor_cmds_check.qmp:
black_cmds = "block-stream block-job-cancel block-job-set-speed drive-mirror block-job-complete block-job-pause block-job-resume"
monitor_cmds_check.human:
Expand Down
4 changes: 4 additions & 0 deletions virttest/qemu_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -828,6 +828,10 @@ def add_net(devices, vlan, nettype, ifname=None, tftp=None,
cmd = " -netdev %s,id=%s" % (mode, netdev_id)
if vhost:
cmd += ",%s" % vhost
enable_vhostfd = params.get("enable_vhostfd", "yes")
if vhost == 'vhost=on' and enable_vhostfd == 'yes':
vhostfd = os.open("/dev/vhost-net", os.O_RDWR)
cmd += ",vhostfd=%s" % vhostfd
if netdev_extra_params:
cmd += "%s" % netdev_extra_params
else:
Expand Down

0 comments on commit 1bb156e

Please sign in to comment.