diff --git a/Gopkg.lock b/Gopkg.lock index fad325a755..5694324647 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -115,11 +115,11 @@ revision = "3520598351bb3500a49ae9563f5539666ae0a27c" [[projects]] - digest = "1:e35245b8aac4b53c6dd7b161c8c19f038e2ad29a54a03d276a88f3fc2a656c29" + digest = "1:052c0d6d677c7a3f12d8f83e0a1ce20a896cc206782b035f380249d23bf1265d" name = "github.com/intel/govmm" packages = ["qemu"] pruneopts = "NUT" - revision = "d8f80cafe3ee3bba440a9ff8d234817b64a30b07" + revision = "1a16b5f98f133796f9c5e9b6ae3aa6d786cff9b1" [[projects]] digest = "1:55460fbdfca464360cec902b0805126451908aa1a058fe4072b01650ebe768b3" @@ -405,6 +405,7 @@ "github.com/opencontainers/runc/libcontainer/utils", "github.com/opencontainers/runtime-spec/specs-go", "github.com/opentracing/opentracing-go", + "github.com/opentracing/opentracing-go/log", "github.com/safchain/ethtool", "github.com/sirupsen/logrus", "github.com/sirupsen/logrus/hooks/syslog", diff --git a/Gopkg.toml b/Gopkg.toml index a3914ffd35..71c12ccf0f 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -52,7 +52,7 @@ [[constraint]] name = "github.com/intel/govmm" - revision = "d8f80cafe3ee3bba440a9ff8d234817b64a30b07" + revision = "1a16b5f98f133796f9c5e9b6ae3aa6d786cff9b1" [[constraint]] name = "github.com/kata-containers/agent" diff --git a/vendor/github.com/intel/govmm/qemu/qmp.go b/vendor/github.com/intel/govmm/qemu/qmp.go index 92000fe03f..58b8924fda 100644 --- a/vendor/github.com/intel/govmm/qemu/qmp.go +++ b/vendor/github.com/intel/govmm/qemu/qmp.go @@ -561,6 +561,10 @@ func (q *QMP) executeCommand(ctx context.Context, name string, args map[string]i // block until they have received a success or failure message from QMP, // i.e., {"return": {}} or {"error":{}}, and in some cases certain events // are received. +// +// QEMU currently requires that the "qmp_capabilties" command is sent before any +// other command. Therefore you must call qmp.ExecuteQMPCapabilities() before +// you execute any other command. func QMPStart(ctx context.Context, socket string, cfg QMPConfig, disconnectedCh chan struct{}) (*QMP, *QMPVersion, error) { if cfg.Logger == nil { cfg.Logger = qmpNullLogger{} @@ -653,7 +657,7 @@ func (q *QMP) ExecuteBlockdevAdd(ctx context.Context, device, blockdevID string) }, } - if q.version.Major > 2 || (q.version.Major == 2 && q.version.Minor >= 9) { + if q.version.Major > 2 || (q.version.Major == 2 && q.version.Minor >= 8) { blockdevArgs["node-name"] = blockdevID args = blockdevArgs } else { @@ -742,7 +746,12 @@ func (q *QMP) ExecuteBlockdevDel(ctx context.Context, blockdevID string) error { return q.executeCommand(ctx, "blockdev-del", args, nil) } - args["id"] = blockdevID + if q.version.Major == 2 && q.version.Minor == 8 { + args["node-name"] = blockdevID + } else { + args["id"] = blockdevID + } + return q.executeCommand(ctx, "x-blockdev-del", args, nil) } @@ -764,6 +773,22 @@ func (q *QMP) ExecuteNetdevAdd(ctx context.Context, netdevType, netdevID, ifname return q.executeCommand(ctx, "netdev_add", args, nil) } +// ExecuteNetdevChardevAdd adds a Net device to a QEMU instance +// using the netdev_add command. netdevID is the id of the device to add. +// Must be valid QMP identifier. +func (q *QMP) ExecuteNetdevChardevAdd(ctx context.Context, netdevType, netdevID, chardev string, queues int) error { + args := map[string]interface{}{ + "type": netdevType, + "id": netdevID, + "chardev": chardev, + } + if queues > 1 { + args["queues"] = queues + } + + return q.executeCommand(ctx, "netdev_add", args, nil) +} + // ExecuteNetdevAddByFds adds a Net device to a QEMU instance // using the netdev_add command by fds and vhostfds. netdevID is the id of the device to add. // Must be valid QMP identifier. @@ -793,7 +818,8 @@ func (q *QMP) ExecuteNetdevDel(ctx context.Context, netdevID string) error { // ExecuteNetPCIDeviceAdd adds a Net PCI device to a QEMU instance // using the device_add command. devID is the id of the device to add. // Must be valid QMP identifier. netdevID is the id of nic added by previous netdev_add. -func (q *QMP) ExecuteNetPCIDeviceAdd(ctx context.Context, netdevID, devID, macAddr, addr, bus string) error { +// queues is the number of queues of a nic. +func (q *QMP) ExecuteNetPCIDeviceAdd(ctx context.Context, netdevID, devID, macAddr, addr, bus string, queues int) error { args := map[string]interface{}{ "id": devID, "driver": VirtioNetPCI, @@ -805,6 +831,18 @@ func (q *QMP) ExecuteNetPCIDeviceAdd(ctx context.Context, netdevID, devID, macAd if bus != "" { args["bus"] = bus } + + if queues > 0 { + // (2N+2 vectors, N for tx queues, N for rx queues, 1 for config, and one for possible control vq) + // -device virtio-net-pci,mq=on,vectors=2N+2... + // enable mq in guest by 'ethtool -L eth0 combined $queue_num' + // Clearlinux automatically sets up the queues properly + // The agent implementation should do this to ensure that it is + // always set + args["mq"] = "on" + args["vectors"] = 2*queues + 2 + } + return q.executeCommand(ctx, "device_add", args, nil) }