vendor: update govmm and match code

update govmm to support virtiofs memory hotplug
Commits:
    0c900f5 Allow sharing of memory backend file
    f695ddf qemu: add migration incoming defer support
    f0f18dd qmp: add virtio-blk multiqueue
    7d3deea qemu: Add a virtio-blk-pci device driver support

Fixes: #1745
Signed-off-by: Ganesh Maharaj Mahalingam <ganesh.mahalingam@intel.com>
This commit is contained in:
Ganesh Maharaj Mahalingam 2019-06-18 10:59:37 -07:00
parent 5e67e04666
commit 3e4989db42
6 changed files with 32 additions and 9 deletions

4
Gopkg.lock generated
View File

@ -379,11 +379,11 @@
revision = "2f1d1f20f75d5404f53b9edf6b53ed5505508675" revision = "2f1d1f20f75d5404f53b9edf6b53ed5505508675"
[[projects]] [[projects]]
digest = "1:2690f7d938dd074d30aa60849f26bcb9f5dd3ad88220a1f24c895c0df63fd1ae" digest = "1:8e8b93094815f3bbc3792eaf78ce5cf45e0376b8ba0c92f3d58714d7a34f5d0b"
name = "github.com/intel/govmm" name = "github.com/intel/govmm"
packages = ["qemu"] packages = ["qemu"]
pruneopts = "NUT" pruneopts = "NUT"
revision = "b3e7a9e78463a10f2a19e1a966c76a3afb215781" revision = "9f389cb319af066f210b28dc8846d679878fe9f2"
[[projects]] [[projects]]
digest = "1:36dfd4701e98a9d8371dd3053e32d4f29e82b07bcc9e655db82138f9273bcb0f" digest = "1:36dfd4701e98a9d8371dd3053e32d4f29e82b07bcc9e655db82138f9273bcb0f"

View File

@ -48,7 +48,7 @@
[[constraint]] [[constraint]]
name = "github.com/intel/govmm" name = "github.com/intel/govmm"
revision = "b3e7a9e78463a10f2a19e1a966c76a3afb215781" revision = "9f389cb319af066f210b28dc8846d679878fe9f2"
[[constraint]] [[constraint]]
name = "github.com/kata-containers/agent" name = "github.com/kata-containers/agent"

View File

@ -71,6 +71,9 @@ const (
// VirtioBlock is the block device driver. // VirtioBlock is the block device driver.
VirtioBlock DeviceDriver = "virtio-blk" VirtioBlock DeviceDriver = "virtio-blk"
// VirtioBlockPCI is a pci bus block device driver
VirtioBlockPCI DeviceDriver = "virtio-blk-pci"
// Console is the console device driver. // Console is the console device driver.
Console DeviceDriver = "virtconsole" Console DeviceDriver = "virtconsole"
@ -1394,6 +1397,8 @@ const (
MigrationFD = 1 MigrationFD = 1
// MigrationExec is the migration incoming type based on commands. // MigrationExec is the migration incoming type based on commands.
MigrationExec = 2 MigrationExec = 2
// MigrationDefer is the defer incoming type
MigrationDefer = 3
) )
// Incoming controls migration source preparation // Incoming controls migration source preparation
@ -1776,6 +1781,8 @@ func (config *Config) appendIncoming() {
case MigrationFD: case MigrationFD:
chFDs := config.appendFDs([]*os.File{config.Incoming.FD}) chFDs := config.appendFDs([]*os.File{config.Incoming.FD})
uri = fmt.Sprintf("fd:%d", chFDs[0]) uri = fmt.Sprintf("fd:%d", chFDs[0])
case MigrationDefer:
uri = "defer"
default: default:
return return
} }

View File

@ -47,6 +47,7 @@ var isVirtioPCI = map[DeviceDriver]bool{
VirtioNetPCI: true, VirtioNetPCI: true,
VirtioSerial: true, VirtioSerial: true,
VirtioBlock: true, VirtioBlock: true,
VirtioBlockPCI: true,
Console: false, Console: false,
VirtioSerialPort: false, VirtioSerialPort: false,
VHostVSock: true, VHostVSock: true,

View File

@ -25,6 +25,7 @@ import (
"io" "io"
"net" "net"
"os" "os"
"strconv"
"syscall" "syscall"
"time" "time"
@ -1058,12 +1059,12 @@ func (q *QMP) ExecuteDeviceDel(ctx context.Context, devID string) error {
// ExecutePCIDeviceAdd is the PCI version of ExecuteDeviceAdd. This function can be used // ExecutePCIDeviceAdd is the PCI version of ExecuteDeviceAdd. This function can be used
// to hot plug PCI devices on PCI(E) bridges, unlike ExecuteDeviceAdd this function receive the // to hot plug PCI devices on PCI(E) bridges, unlike ExecuteDeviceAdd this function receive the
// device address on its parent bus. bus is optional. shared denotes if the drive can be shared // device address on its parent bus. bus is optional. queues specifies the number of queues of
// allowing it to be passed more than once. // a block device. shared denotes if the drive can be shared allowing it to be passed more than once.
// disableModern indicates if virtio version 1.0 should be replaced by the // disableModern indicates if virtio version 1.0 should be replaced by the
// former version 0.9, as there is a KVM bug that occurs when using virtio // former version 0.9, as there is a KVM bug that occurs when using virtio
// 1.0 in nested environments. // 1.0 in nested environments.
func (q *QMP) ExecutePCIDeviceAdd(ctx context.Context, blockdevID, devID, driver, addr, bus, romfile string, shared, disableModern bool) error { func (q *QMP) ExecutePCIDeviceAdd(ctx context.Context, blockdevID, devID, driver, addr, bus, romfile string, queues int, shared, disableModern bool) error {
args := map[string]interface{}{ args := map[string]interface{}{
"id": devID, "id": devID,
"driver": driver, "driver": driver,
@ -1076,6 +1077,9 @@ func (q *QMP) ExecutePCIDeviceAdd(ctx context.Context, blockdevID, devID, driver
if shared && (q.version.Major > 2 || (q.version.Major == 2 && q.version.Minor >= 10)) { if shared && (q.version.Major > 2 || (q.version.Major == 2 && q.version.Minor >= 10)) {
args["share-rw"] = "on" args["share-rw"] = "on"
} }
if queues > 0 {
args["num-queues"] = strconv.Itoa(queues)
}
if isVirtioPCI[DeviceDriver(driver)] { if isVirtioPCI[DeviceDriver(driver)] {
args["romfile"] = romfile args["romfile"] = romfile
@ -1281,7 +1285,7 @@ func (q *QMP) ExecQueryCpusFast(ctx context.Context) ([]CPUInfoFast, error) {
} }
// ExecHotplugMemory adds size of MiB memory to the guest // ExecHotplugMemory adds size of MiB memory to the guest
func (q *QMP) ExecHotplugMemory(ctx context.Context, qomtype, id, mempath string, size int) error { func (q *QMP) ExecHotplugMemory(ctx context.Context, qomtype, id, mempath string, size int, share bool) error {
props := map[string]interface{}{"size": uint64(size) << 20} props := map[string]interface{}{"size": uint64(size) << 20}
args := map[string]interface{}{ args := map[string]interface{}{
"qom-type": qomtype, "qom-type": qomtype,
@ -1291,6 +1295,9 @@ func (q *QMP) ExecHotplugMemory(ctx context.Context, qomtype, id, mempath string
if mempath != "" { if mempath != "" {
props["mem-path"] = mempath props["mem-path"] = mempath
} }
if share {
props["share"] = true
}
err := q.executeCommand(ctx, "object-add", args, nil) err := q.executeCommand(ctx, "object-add", args, nil)
if err != nil { if err != nil {
return err return err
@ -1453,3 +1460,11 @@ func (q *QMP) ExecuteQueryMigration(ctx context.Context) (MigrationStatus, error
return status, nil return status, nil
} }
// ExecuteMigrationIncoming start migration from incoming uri.
func (q *QMP) ExecuteMigrationIncoming(ctx context.Context, uri string) error {
args := map[string]interface{}{
"uri": uri,
}
return q.executeCommand(ctx, "migrate-incoming", args, nil)
}

View File

@ -953,7 +953,7 @@ func (q *qemu) hotplugAddBlockDevice(drive *config.BlockDrive, op operation, dev
// PCI address is in the format bridge-addr/device-addr eg. "03/02" // PCI address is in the format bridge-addr/device-addr eg. "03/02"
drive.PCIAddr = fmt.Sprintf("%02x", bridge.Addr) + "/" + addr drive.PCIAddr = fmt.Sprintf("%02x", bridge.Addr) + "/" + addr
if err = q.qmpMonitorCh.qmp.ExecutePCIDeviceAdd(q.qmpMonitorCh.ctx, drive.ID, devID, driver, addr, bridge.ID, romFile, true, q.arch.runNested()); err != nil { if err = q.qmpMonitorCh.qmp.ExecutePCIDeviceAdd(q.qmpMonitorCh.ctx, drive.ID, devID, driver, addr, bridge.ID, romFile, 0, true, q.arch.runNested()); err != nil {
return err return err
} }
} else { } else {
@ -1363,7 +1363,7 @@ func (q *qemu) hotplugAddMemory(memDev *memoryDevice) (int, error) {
} }
memDev.slot = maxSlot + 1 memDev.slot = maxSlot + 1
} }
err = q.qmpMonitorCh.qmp.ExecHotplugMemory(q.qmpMonitorCh.ctx, "memory-backend-ram", "mem"+strconv.Itoa(memDev.slot), "", memDev.sizeMB) err = q.qmpMonitorCh.qmp.ExecHotplugMemory(q.qmpMonitorCh.ctx, "memory-backend-ram", "mem"+strconv.Itoa(memDev.slot), "", memDev.sizeMB, false)
if err != nil { if err != nil {
q.Logger().WithError(err).Error("hotplug memory") q.Logger().WithError(err).Error("hotplug memory")
return 0, err return 0, err