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

@@ -152,9 +152,7 @@ func TestQemuArm64AppendImage(t *testing.T) {
cfg := qemuConfig(QemuVirt)
cfg.ImagePath = f.Name()
arm64 := newQemuArch(cfg)
for _, m := range arm64.(*qemuArm64).supportedQemuMachines {
assert.Contains(m.Options, qemuNvdimmOption)
}
assert.Contains(m.machine().Options, qemuNvdimmOption)
expectedOut := []govmmQemu.Device{
govmmQemu.Object{
@@ -182,7 +180,5 @@ func TestQemuArm64WithInitrd(t *testing.T) {
cfg.InitrdPath = "dummy-initrd"
arm64 := newQemuArch(cfg)
for _, m := range arm64.(*qemuArm64).supportedQemuMachines {
assert.NotContains(m.Options, qemuNvdimmOption)
}
assert.NotContains(m.machine().Options, qemuNvdimmOption)
}