mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-16 06:18:58 +00:00
qmp: add ExecutePCIVhostUserDevAdd API
Caller can hotplug vhost-user device via qmp. The Qemu vhost-user device, like vhost-user-blk-pci and vhost-user-scsi-pci can be hotplugged by qmp API: ExecuteCharDevUnixSocketAdd() together with ExecutePCIVhostUserDevAdd() Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
This commit is contained in:
@@ -1329,6 +1329,26 @@ func TestExecutePCIVSockAdd(t *testing.T) {
|
||||
<-disconnectedCh
|
||||
}
|
||||
|
||||
// Checks vhost-user-pci hotplug
|
||||
func TestExecutePCIVhostUserDevAdd(t *testing.T) {
|
||||
connectedCh := make(chan *QMPVersion)
|
||||
disconnectedCh := make(chan struct{})
|
||||
buf := newQMPTestCommandBuffer(t)
|
||||
buf.AddCommand("device_add", nil, "return", nil)
|
||||
cfg := QMPConfig{Logger: qmpTestLogger{}}
|
||||
q := startQMPLoop(buf, cfg, connectedCh, disconnectedCh)
|
||||
checkVersion(t, connectedCh)
|
||||
driver := "vhost-user-blk-pci"
|
||||
devID := "vhost-user-blk0"
|
||||
chardevID := "vhost-user-blk-char0"
|
||||
err := q.ExecutePCIVhostUserDevAdd(context.Background(), driver, devID, chardevID, "1", "1")
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error %v", err)
|
||||
}
|
||||
q.Shutdown()
|
||||
<-disconnectedCh
|
||||
}
|
||||
|
||||
// Checks getfd
|
||||
func TestExecuteGetFdD(t *testing.T) {
|
||||
connectedCh := make(chan *QMPVersion)
|
||||
|
Reference in New Issue
Block a user