qemu/qmp: nic can works without vhost

If host doesn't support vhost_net, we won't pass vhost="on" in QMP.

Signed-off-by: Ruidong Cao <caoruidong@huawei.com>
This commit is contained in:
Ruidong Cao
2018-09-10 11:28:21 +08:00
parent 25277d52ad
commit 1a1fee75e5
2 changed files with 14 additions and 7 deletions

View File

@@ -458,10 +458,15 @@ func TestQMPNetdevAddByFds(t *testing.T) {
disconnectedCh := make(chan struct{})
buf := newQMPTestCommandBuffer(t)
buf.AddCommand("netdev_add", nil, "return", nil)
buf.AddCommand("netdev_add", nil, "return", nil)
cfg := QMPConfig{Logger: qmpTestLogger{}}
q := startQMPLoop(buf, cfg, connectedCh, disconnectedCh)
q.version = checkVersion(t, connectedCh)
err := q.ExecuteNetdevAddByFds(context.Background(), "tap", "br0", nil, nil)
err := q.ExecuteNetdevAddByFds(context.Background(), "tap", "br0", nil, []string{})
if err != nil {
t.Fatalf("Unexpected error %v", err)
}
err = q.ExecuteNetdevAddByFds(context.Background(), "tap", "br1", nil, []string{"3"})
if err != nil {
t.Fatalf("Unexpected error %v", err)
}