qemu: Remove useless table from qemuArchBase

The supportedQemuMachines array in qemuArchBase has a list of all the
qemu machine types supported for the architecture, with the options
for each.  But, the machineType field already tells us which of the
machine types we're actually using, and that's the only entry we
actually care about.

So, drop the table, and just have a single value with the machine type
we're actually using.  As a bonus that means the machine() method can
no longer fail, so no longer needs an error return.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
David Gibson
2020-06-15 20:29:33 +10:00
parent 97a02131c6
commit 5dffffd432
10 changed files with 64 additions and 121 deletions

View File

@@ -138,9 +138,7 @@ func TestQemuAmd64AppendImage(t *testing.T) {
cfg.DisableImageNvdimm = false
amd64, err := newQemuArch(cfg)
assert.NoError(err)
for _, m := range amd64.(*qemuAmd64).supportedQemuMachines {
assert.Contains(m.Options, qemuNvdimmOption)
}
assert.Contains(amd64.machine().Options, qemuNvdimmOption)
expectedOut := []govmmQemu.Device{
govmmQemu.Object{
@@ -163,9 +161,7 @@ func TestQemuAmd64AppendImage(t *testing.T) {
cfg.DisableImageNvdimm = true
amd64, err = newQemuArch(cfg)
assert.NoError(err)
for _, m := range amd64.(*qemuAmd64).supportedQemuMachines {
assert.NotContains(m.Options, qemuNvdimmOption)
}
assert.NotContains(amd64.machine().Options, qemuNvdimmOption)
found := false
devices, err = amd64.appendImage(nil, f.Name())
@@ -243,9 +239,7 @@ func TestQemuAmd64WithInitrd(t *testing.T) {
amd64, err := newQemuArch(cfg)
assert.NoError(err)
for _, m := range amd64.(*qemuAmd64).supportedQemuMachines {
assert.NotContains(m.Options, qemuNvdimmOption)
}
assert.NotContains(amd64.machine().Options, qemuNvdimmOption)
}
func TestQemuAmd64Iommu(t *testing.T) {
@@ -259,8 +253,6 @@ func TestQemuAmd64Iommu(t *testing.T) {
p := qemu.kernelParameters(false)
assert.Contains(p, Param{"intel_iommu", "on"})
m, err := qemu.machine()
assert.NoError(err)
m := qemu.machine()
assert.Contains(m.Options, "kernel_irqchip=split")
}