mirror of
https://github.com/aljazceru/kata-containers.git
synced 2025-12-18 14:54:19 +01:00
qemu/qmp: Add netdev_add with chardev support
In order to be able to hotplug network devices such as vhost user net, we need to be able to define a previously declared chardev as a parameter of this new network device. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
@@ -425,6 +425,28 @@ func TestQMPNetdevAdd(t *testing.T) {
|
||||
<-disconnectedCh
|
||||
}
|
||||
|
||||
// Checks that the netdev_add command is correctly sent.
|
||||
//
|
||||
// We start a QMPLoop, send the netdev_add command and stop the loop.
|
||||
//
|
||||
// The netdev_add command should be correctly sent and the QMP loop should
|
||||
// exit gracefully.
|
||||
func TestQMPNetdevChardevAdd(t *testing.T) {
|
||||
connectedCh := make(chan *QMPVersion)
|
||||
disconnectedCh := make(chan struct{})
|
||||
buf := newQMPTestCommandBuffer(t)
|
||||
buf.AddCommand("netdev_add", nil, "return", nil)
|
||||
cfg := QMPConfig{Logger: qmpTestLogger{}}
|
||||
q := startQMPLoop(buf, cfg, connectedCh, disconnectedCh)
|
||||
q.version = checkVersion(t, connectedCh)
|
||||
err := q.ExecuteNetdevChardevAdd(context.Background(), "tap", "br0", "chr0", 8)
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error %v", err)
|
||||
}
|
||||
q.Shutdown()
|
||||
<-disconnectedCh
|
||||
}
|
||||
|
||||
// Checks that the netdev_add command with fds is correctly sent.
|
||||
//
|
||||
// We start a QMPLoop, send the netdev_add command with fds and stop the loop.
|
||||
|
||||
Reference in New Issue
Block a user