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

@@ -342,7 +342,10 @@ func TestQemuQemuPath(t *testing.T) {
qemuConfig := newQemuConfig()
qemuConfig.HypervisorPath = expectedPath
qkvm := &qemuArchBase{
machineType: "pc",
qemuMachine: govmmQemu.Machine{
Type: "pc",
Options: "",
},
qemuPaths: map[string]string{
"pc": expectedPath,
},
@@ -371,7 +374,7 @@ func TestQemuQemuPath(t *testing.T) {
assert.Equal(path, expectedPath)
// bad machine type, arch should fail
qkvm.machineType = "rgb"
qkvm.qemuMachine.Type = "rgb"
q.arch = qkvm
path, err = q.qemuPath()
assert.Error(err)