vendor: Update govmm to disable vhost when host doesn't support vhost-net

If the length of vhostfds is zero, it means host doesn't support vhost. So
do not pass vhost="on" in QMP.
Full list:
    1a1fee7 qemu/qmp: nic can works without vhost

Fixes #169

Signed-off-by: Ruidong Cao <caoruidong@huawei.com>
This commit is contained in:
Ruidong
2018-09-12 06:50:53 +08:00
committed by Ruidong Cao
parent 516b6ff1d0
commit 5ebb7cf6f5
3 changed files with 11 additions and 9 deletions

View File

@@ -812,13 +812,15 @@ func (q *QMP) ExecuteNetdevChardevAdd(ctx context.Context, netdevType, netdevID,
// Must be valid QMP identifier.
func (q *QMP) ExecuteNetdevAddByFds(ctx context.Context, netdevType, netdevID string, fdNames, vhostFdNames []string) error {
fdNameStr := strings.Join(fdNames, ":")
vhostFdNameStr := strings.Join(vhostFdNames, ":")
args := map[string]interface{}{
"type": netdevType,
"id": netdevID,
"fds": fdNameStr,
"vhost": "on",
"vhostfds": vhostFdNameStr,
"type": netdevType,
"id": netdevID,
"fds": fdNameStr,
}
if len(vhostFdNames) > 0 {
vhostFdNameStr := strings.Join(vhostFdNames, ":")
args["vhost"] = "on"
args["vhostfds"] = vhostFdNameStr
}
return q.executeCommand(ctx, "netdev_add", args, nil)