Skip to content

Commit

Permalink
virtcontainers: qemu: Add proper support for virt machine type
Browse files Browse the repository at this point in the history
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 kata-containers#804

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
  • Loading branch information
Sebastien Boeuf committed Oct 3, 2018
1 parent 0de7572 commit dffb4f9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions virtcontainers/qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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:
Expand Down
4 changes: 3 additions & 1 deletion virtcontainers/qemu_amd64.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down

0 comments on commit dffb4f9

Please sign in to comment.