mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-03 02:26:37 +00:00
qemu: add vhostfd and disable-modern to vsock hotplug
`vhostfd` is used to specify the vhost-vsock device fd, and it holds the context ID previously opened. `disable-modern` is to disable the use of "modern" devices, by using virtio 0.9 instead of virtio 1.0. Particularly, this is useful when running the VM in a nested environment. Signed-off-by: Julio Montes <julio.montes@intel.com>
This commit is contained in:
parent
f700a97bee
commit
84b212f1b8
@ -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)
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user