mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-31 16:36:38 +00:00
Merge pull request #649 from woshijpf/update-govmm-vendor
vendor: update govmm to be compatible with qemu 2.8
This commit is contained in:
4
Gopkg.lock
generated
4
Gopkg.lock
generated
@@ -123,11 +123,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:01c37fcb6e2a1fe1321a97faaef74c66ac531ea292ca3f929b7189cc400b1d47"
|
||||
|
@@ -52,7 +52,7 @@
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/intel/govmm"
|
||||
revision = "d8f80cafe3ee3bba440a9ff8d234817b64a30b07"
|
||||
revision = "1a16b5f98f133796f9c5e9b6ae3aa6d786cff9b1"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/kata-containers/agent"
|
||||
|
44
vendor/github.com/intel/govmm/qemu/qmp.go
generated
vendored
44
vendor/github.com/intel/govmm/qemu/qmp.go
generated
vendored
@@ -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)
|
||||
}
|
||||
|
||||
|
@@ -859,7 +859,7 @@ func (q *qemu) hotplugNetDevice(drive VirtualEndpoint, op operation) error {
|
||||
return err
|
||||
}
|
||||
drive.PCIAddr = fmt.Sprintf("%02x/%s", bridge.Addr, addr)
|
||||
if err = q.qmpMonitorCh.qmp.ExecuteNetPCIDeviceAdd(q.qmpMonitorCh.ctx, drive.NetPair.Name, devID, drive.NetPair.TAPIface.HardAddr, addr, bridge.ID); err != nil {
|
||||
if err = q.qmpMonitorCh.qmp.ExecuteNetPCIDeviceAdd(q.qmpMonitorCh.ctx, drive.NetPair.Name, devID, drive.NetPair.TAPIface.HardAddr, addr, bridge.ID, defaultQueues); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user