From 050f8e97157e96cae42986632f191eebab25ad7b Mon Sep 17 00:00:00 2001 From: Ganesh Maharaj Mahalingam Date: Tue, 9 Jul 2019 08:51:23 -0700 Subject: [PATCH] runtime: Disable disable-modern for virtio QMP add History: the previous version of kvm (unknown) and qemu-lite had an issue using virtio 1.0 version when it came to device hotplug, which led to the team to disable 1.0 version of virtio for hotplug (set disable-modern=on). Please check https://github.com/containers/virtcontainers/commit/e99f6b2931c4d28570f7437d9935fbc902636f0b for further info. We have since moved to QEMU4.0 and probably a later version of kvm as default across all distros. This change is to move to virtio 1.0 for hotplugging devices. Fixes: #1870 Signed-off-by: Ganesh Maharaj Mahalingam --- virtcontainers/qemu.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/virtcontainers/qemu.go b/virtcontainers/qemu.go index cc84b2e38..727bdd546 100644 --- a/virtcontainers/qemu.go +++ b/virtcontainers/qemu.go @@ -40,6 +40,11 @@ import ( // such as SeaBIOS or OVMF for instance, to handle this directly. const romFile = "" +// disable-modern is a option to QEMU that will fall back to using 0.9 version +// of virtio. Since moving to QEMU4.0, we can start using virtio 1.0 version. +// Default value is false. +const defaultDisableModern = false + type qmpChannel struct { ctx context.Context path string @@ -953,7 +958,7 @@ func (q *qemu) hotplugAddBlockDevice(drive *config.BlockDrive, op operation, dev // PCI address is in the format bridge-addr/device-addr eg. "03/02" 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, 0, 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, defaultDisableModern); err != nil { return err } } else { @@ -968,7 +973,7 @@ func (q *qemu) hotplugAddBlockDevice(drive *config.BlockDrive, op operation, dev return err } - if err = q.qmpMonitorCh.qmp.ExecuteSCSIDeviceAdd(q.qmpMonitorCh.ctx, drive.ID, devID, driver, bus, romFile, scsiID, lun, true, q.arch.runNested()); err != nil { + if err = q.qmpMonitorCh.qmp.ExecuteSCSIDeviceAdd(q.qmpMonitorCh.ctx, drive.ID, devID, driver, bus, romFile, scsiID, lun, true, defaultDisableModern); err != nil { return err } } @@ -1119,7 +1124,7 @@ func (q *qemu) hotplugNetDevice(endpoint Endpoint, op operation) error { if machine.Type == QemuCCWVirtio { return q.qmpMonitorCh.qmp.ExecuteNetCCWDeviceAdd(q.qmpMonitorCh.ctx, tap.Name, devID, endpoint.HardwareAddr(), addr, bridge.ID, int(q.config.NumVCPUs)) } - return q.qmpMonitorCh.qmp.ExecuteNetPCIDeviceAdd(q.qmpMonitorCh.ctx, tap.Name, devID, endpoint.HardwareAddr(), addr, bridge.ID, romFile, int(q.config.NumVCPUs), q.arch.runNested()) + return q.qmpMonitorCh.qmp.ExecuteNetPCIDeviceAdd(q.qmpMonitorCh.ctx, tap.Name, devID, endpoint.HardwareAddr(), addr, bridge.ID, romFile, int(q.config.NumVCPUs), defaultDisableModern) } if err := q.removeDeviceFromBridge(tap.ID); err != nil {