diff options
author | Mark McLoughlin <markmc@redhat.com> | 2009-09-10 11:19:12 +0100 |
---|---|---|
committer | Mark McLoughlin <markmc@redhat.com> | 2009-09-10 12:37:42 +0100 |
commit | aa67241bde66034ccf3ffe93f65a3d942cda97a0 (patch) | |
tree | dd916b24be0bb49591ad3c5176d6dd4c7ad6e99b /tests/testutilsqemu.c | |
parent | Re-factor qemu test machine allocation code (diff) | |
download | libvirt-aa67241bde66034ccf3ffe93f65a3d942cda97a0.tar.gz libvirt-aa67241bde66034ccf3ffe93f65a3d942cda97a0.tar.bz2 libvirt-aa67241bde66034ccf3ffe93f65a3d942cda97a0.zip |
Test qemu machine aliases
* tests/testutilsqemu.c: make 'pc' an alias for qemu-system-x86_64
* tests/qemuxml2argvdata/qemuxml2argv-machine-aliases1.*,
tests/qemuxml2argvtest.c: add a test which uses qemu-system-x86_64
and make sure the machine type is canonicalized.
Diffstat (limited to 'tests/testutilsqemu.c')
-rw-r--r-- | tests/testutilsqemu.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index d85e4c720..ad58010a1 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -24,6 +24,35 @@ static virCapsGuestMachinePtr *testQemuAllocMachines(int *nmachines) return machines; } +/* Newer versions of qemu have versioned machine types to allow + * compatibility with older releases. + * The 'pc' machine type is an alias of the newest machine type. + */ +static virCapsGuestMachinePtr *testQemuAllocNewerMachines(int *nmachines) +{ + virCapsGuestMachinePtr *machines; + char *canonical; + static const char *const x86_machines[] = { + "pc-0.11", "pc", "pc-0.10", "isapc" + }; + + if ((canonical = strdup(x86_machines[0])) == NULL) + return NULL; + + machines = virCapabilitiesAllocMachines(x86_machines, + ARRAY_CARDINALITY(x86_machines)); + if (machines == NULL) { + VIR_FREE(canonical); + return NULL; + } + + machines[1]->canonical = canonical; + + *nmachines = ARRAY_CARDINALITY(x86_machines); + + return machines; +} + virCapsPtr testQemuCapsInit(void) { struct utsname utsname; virCapsPtr caps; @@ -56,7 +85,7 @@ virCapsPtr testQemuCapsInit(void) { NULL) == NULL) goto cleanup; - if ((machines = testQemuAllocMachines(&nmachines)) == NULL) + if ((machines = testQemuAllocNewerMachines(&nmachines)) == NULL) goto cleanup; if ((guest = virCapabilitiesAddGuest(caps, "hvm", "x86_64", 64, |