virtcontainers: qemu: Add proper support for virt machine type

The virt machine type provided by the NEMU project needs to be
supported the same way we support pc and q35 machine types.

First, this patch takes care of adding the hotpluggable block device
capability to this machine type, this way when using devicemapper, we
prevent the code from falling back on using 9pfs instead of SCSI.

It also add one or several bridges to this machine type, as the code
is tightly coupled to the fact that a bridge is required for PCI
hotplug.

At last, it changes the name of the PCI host bridge (main bus), to
use "pcie.0". The default set up from pc machine type "pci.0" is not
suitable for this machine type.

Fixes #804

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf 2018-10-02 12:13:18 -07:00
parent 0de7572f7b
commit dffb4f96ae
2 changed files with 7 additions and 3 deletions

View File

@ -1194,7 +1194,8 @@ func (q *qemu) disconnect() {
// genericAppendBridges appends to devices the given bridges
func genericAppendBridges(devices []govmmQemu.Device, bridges []Bridge, machineType string) []govmmQemu.Device {
bus := defaultPCBridgeBus
if machineType == QemuQ35 {
switch machineType {
case QemuQ35, QemuVirt:
bus = defaultBridgeBus
}
@ -1227,13 +1228,14 @@ func genericBridges(number uint32, machineType string) []Bridge {
var bt bridgeType
switch machineType {
case QemuQ35:
// currently only pci bridges are supported
// qemu-2.10 will introduce pcie bridges
fallthrough
case QemuPC:
bt = pciBridge
case QemuVirt:
bt = pcieBridge
case QemuPseries:
bt = pciBridge
default:

View File

@ -102,7 +102,9 @@ func newQemuArch(config HypervisorConfig) qemuArch {
func (q *qemuAmd64) capabilities() capabilities {
var caps capabilities
if q.machineType == QemuPC || q.machineType == QemuQ35 {
if q.machineType == QemuPC ||
q.machineType == QemuQ35 ||
q.machineType == QemuVirt {
caps.setBlockDeviceHotplugSupport()
}