diff --git a/qemu/qmp.go b/qemu/qmp.go index 32a59ef04b..61788e0fa2 100644 --- a/qemu/qmp.go +++ b/qemu/qmp.go @@ -883,11 +883,17 @@ func (q *QMP) ExecHotplugMemory(ctx context.Context, qomtype, id, mempath string } // ExecutePCIVSockAdd adds a vhost-vsock-pci bus -func (q *QMP) ExecutePCIVSockAdd(ctx context.Context, id, guestCID string) error { +func (q *QMP) ExecutePCIVSockAdd(ctx context.Context, id, guestCID, vhostfd string, disableModern bool) error { args := map[string]interface{}{ "driver": VHostVSockPCI, "id": id, "guest-cid": guestCID, + "vhostfd": vhostfd, } + + if disableModern { + args["disable-modern"] = disableModern + } + return q.executeCommand(ctx, "device_add", args, nil) } diff --git a/qemu/qmp_test.go b/qemu/qmp_test.go index c87822ae8e..5b238648db 100644 --- a/qemu/qmp_test.go +++ b/qemu/qmp_test.go @@ -955,7 +955,7 @@ func TestExecutePCIVSockAdd(t *testing.T) { cfg := QMPConfig{Logger: qmpTestLogger{}} q := startQMPLoop(buf, cfg, connectedCh, disconnectedCh) checkVersion(t, connectedCh) - err := q.ExecutePCIVSockAdd(context.Background(), "vsock-pci0", "3") + err := q.ExecutePCIVSockAdd(context.Background(), "vsock-pci0", "3", "1", true) if err != nil { t.Fatalf("Unexpected error %v", err) }