[libvirt] [PATCH 0/3] Fix default machine when converting argv to xml

We must honour the QEMU built-in default machine when converting from argv Daniel P. Berrangé (3): qemu: record the QEMU default machine in capabilities qemu: rename method for getting preferred machine type qemu: fix default machine for argv -> xml convertor src/qemu/qemu_capabilities.c | 37 ++++++++++++++--- src/qemu/qemu_capabilities.h | 3 +- src/qemu/qemu_driver.c | 6 ++- src/qemu/qemu_parse_command.c | 34 ++++++++++------ src/qemu/qemu_parse_command.h | 8 +++- tests/domaincapstest.c | 2 +- tests/qemuargv2xmldata/nomachine-aarch64.args | 11 ----- tests/qemuargv2xmldata/nomachine-aarch64.xml | 40 ------------------- tests/qemuargv2xmldata/nomachine-ppc64.xml | 4 +- tests/qemuargv2xmldata/nomachine-x86_64.xml | 4 +- tests/qemuargv2xmldata/pseries-disk.xml | 4 +- tests/qemuargv2xmldata/pseries-nvram.xml | 4 +- tests/qemuargv2xmltest.c | 18 ++++++++- .../caps_1.5.3.x86_64.xml | 2 +- .../caps_1.6.0.x86_64.xml | 2 +- .../caps_1.7.0.x86_64.xml | 2 +- .../caps_2.1.1.x86_64.xml | 2 +- .../caps_2.10.0.ppc64.xml | 2 +- .../caps_2.10.0.s390x.xml | 2 +- .../caps_2.10.0.x86_64.xml | 2 +- .../caps_2.11.0.s390x.xml | 2 +- .../caps_2.11.0.x86_64.xml | 2 +- .../caps_2.12.0.ppc64.xml | 2 +- .../caps_2.12.0.s390x.xml | 2 +- .../caps_2.12.0.x86_64.xml | 2 +- .../caps_2.4.0.x86_64.xml | 2 +- .../caps_2.5.0.x86_64.xml | 2 +- .../qemucapabilitiesdata/caps_2.6.0.ppc64.xml | 2 +- .../caps_2.6.0.x86_64.xml | 2 +- .../qemucapabilitiesdata/caps_2.7.0.s390x.xml | 2 +- .../caps_2.7.0.x86_64.xml | 2 +- .../qemucapabilitiesdata/caps_2.8.0.s390x.xml | 2 +- .../caps_2.8.0.x86_64.xml | 2 +- .../qemucapabilitiesdata/caps_2.9.0.ppc64.xml | 2 +- .../qemucapabilitiesdata/caps_2.9.0.s390x.xml | 2 +- .../caps_2.9.0.x86_64.xml | 2 +- .../qemucapabilitiesdata/caps_3.0.0.ppc64.xml | 2 +- .../caps_3.0.0.x86_64.xml | 2 +- 38 files changed, 116 insertions(+), 109 deletions(-) delete mode 100644 tests/qemuargv2xmldata/nomachine-aarch64.args delete mode 100644 tests/qemuargv2xmldata/nomachine-aarch64.xml -- 2.17.1

We don't honour the QEMU default machine type anymore, always using the libvirt chosen default instead. The QEMU argv parser, however, will need to know the exacty QEMU default, so we must record that info. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- src/qemu/qemu_capabilities.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index e6e199b2c6..a0a1b97f1d 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -515,6 +515,7 @@ struct virQEMUCapsMachineType { char *alias; unsigned int maxCpus; bool hotplugCpus; + bool qemuDefault; }; typedef struct _virQEMUCapsHostCPUData virQEMUCapsHostCPUData; @@ -2324,8 +2325,10 @@ virQEMUCapsProbeQMPMachineTypes(virQEMUCapsPtr qemuCaps, preferredIdx = qemuCaps->nmachineTypes - 1; } - if (machines[i]->isDefault) + if (machines[i]->isDefault) { + mach->qemuDefault = true; defIdx = qemuCaps->nmachineTypes - 1; + } } /* @@ -3355,7 +3358,7 @@ virQEMUCapsCachePrivFree(void *privData) * ... * <cpu name="pentium3"/> * ... - * <machine name="pc-1.0" alias="pc" hotplugCpus='yes' maxCpus="4"/> + * <machine name="pc-1.0" alias="pc" hotplugCpus='yes' maxCpus="4" default="yes"/> * ... * </qemuCaps> */ @@ -3520,6 +3523,11 @@ virQEMUCapsLoadCache(virArch hostArch, if (STREQ_NULLABLE(str, "yes")) qemuCaps->machineTypes[i].hotplugCpus = true; VIR_FREE(str); + + str = virXMLPropString(nodes[i], "default"); + if (STREQ_NULLABLE(str, "yes")) + qemuCaps->machineTypes[i].qemuDefault = true; + VIR_FREE(str); } } VIR_FREE(nodes); @@ -3768,6 +3776,8 @@ virQEMUCapsFormatCache(virQEMUCapsPtr qemuCaps) qemuCaps->machineTypes[i].alias); if (qemuCaps->machineTypes[i].hotplugCpus) virBufferAddLit(&buf, " hotplugCpus='yes'"); + if (qemuCaps->machineTypes[i].qemuDefault) + virBufferAddLit(&buf, " default='yes'"); virBufferAsprintf(&buf, " maxCpus='%u'/>\n", qemuCaps->machineTypes[i].maxCpus); } -- 2.17.1

On 08/16/2018 11:12 AM, Daniel P. Berrangé wrote:
We don't honour the QEMU default machine type anymore, always using the libvirt chosen default instead. The QEMU argv parser, however, will need to know the exacty QEMU default, so we must record that info.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- src/qemu/qemu_capabilities.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
This patch alone fails make check. Need to move some stuff from patch 3 into here. 1. virQEMUCapsNewCopy change 2. virQEMUCapsFormatCache change 3. Regenerate qemucapabilitiestest output With those changes, Reviewed-by: John Ferlan <jferlan@redhat.com> John

The virQEMUCapsGetDefaultMachine() method doesn't get QEMU's default machine any more, instead it gets the historical default that libvirt prefers for each arch. Rename it, so that the old name can be used for getting QEMU's default. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- src/qemu/qemu_capabilities.c | 8 ++++++-- src/qemu/qemu_capabilities.h | 2 +- tests/domaincapstest.c | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index a0a1b97f1d..4e4f732889 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -4876,7 +4876,7 @@ virQEMUCapsCacheLookupDefault(virFileCachePtr cache, goto cleanup; } } else { - machine = virQEMUCapsGetDefaultMachine(qemuCaps); + machine = virQEMUCapsGetPreferredMachine(qemuCaps); } if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM)) @@ -4935,8 +4935,12 @@ virQEMUCapsIsMachineSupported(virQEMUCapsPtr qemuCaps, } +/* + * The preferred machine to use if none is listed explicitly + * Note that this may differ from QEMU's own default machine + */ const char * -virQEMUCapsGetDefaultMachine(virQEMUCapsPtr qemuCaps) +virQEMUCapsGetPreferredMachine(virQEMUCapsPtr qemuCaps) { if (!qemuCaps->nmachineTypes) return NULL; diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 26813a908c..88e81be09b 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -605,7 +605,7 @@ bool virQEMUCapsSupportsGICVersion(virQEMUCapsPtr qemuCaps, bool virQEMUCapsIsMachineSupported(virQEMUCapsPtr qemuCaps, const char *canonical_machine); -const char *virQEMUCapsGetDefaultMachine(virQEMUCapsPtr qemuCaps); +const char *virQEMUCapsGetPreferredMachine(virQEMUCapsPtr qemuCaps); int virQEMUCapsInitGuestFromBinary(virCapsPtr caps, const char *binary, diff --git a/tests/domaincapstest.c b/tests/domaincapstest.c index 06e77fd586..3b94cad223 100644 --- a/tests/domaincapstest.c +++ b/tests/domaincapstest.c @@ -168,7 +168,7 @@ fillQemuCaps(virDomainCapsPtr domCaps, if (!domCaps->machine && VIR_STRDUP(domCaps->machine, - virQEMUCapsGetDefaultMachine(qemuCaps)) < 0) + virQEMUCapsGetPreferredMachine(qemuCaps)) < 0) goto cleanup; if (virQEMUCapsFillDomainCaps(caps, domCaps, qemuCaps, -- 2.17.1

On 08/16/2018 11:12 AM, Daniel P. Berrangé wrote:
The virQEMUCapsGetDefaultMachine() method doesn't get QEMU's default machine any more, instead it gets the historical default that libvirt prefers for each arch. Rename it, so that the old name can be used for getting QEMU's default.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- src/qemu/qemu_capabilities.c | 8 ++++++-- src/qemu/qemu_capabilities.h | 2 +- tests/domaincapstest.c | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-)
Reviewed-by: John Ferlan <jferlan@redhat.com> John

Historically the argv -> xml convertor wanted the same default machine as we'd set when parsing xml. The latter has now changed, however, to use a default defined by libvirt. The former needs fixing to again honour the default QEMU machine. This exposed a bug in handling for the aarch64 target, as QEMU does not define any default machine. Thus we should not having been accepting argv without a -machine provided. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- src/qemu/qemu_capabilities.c | 17 +++++++- src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_driver.c | 6 ++- src/qemu/qemu_parse_command.c | 34 ++++++++++------ src/qemu/qemu_parse_command.h | 8 +++- tests/qemuargv2xmldata/nomachine-aarch64.args | 11 ----- tests/qemuargv2xmldata/nomachine-aarch64.xml | 40 ------------------- tests/qemuargv2xmldata/nomachine-ppc64.xml | 4 +- tests/qemuargv2xmldata/nomachine-x86_64.xml | 4 +- tests/qemuargv2xmldata/pseries-disk.xml | 4 +- tests/qemuargv2xmldata/pseries-nvram.xml | 4 +- tests/qemuargv2xmltest.c | 18 ++++++++- .../caps_1.5.3.x86_64.xml | 2 +- .../caps_1.6.0.x86_64.xml | 2 +- .../caps_1.7.0.x86_64.xml | 2 +- .../caps_2.1.1.x86_64.xml | 2 +- .../caps_2.10.0.ppc64.xml | 2 +- .../caps_2.10.0.s390x.xml | 2 +- .../caps_2.10.0.x86_64.xml | 2 +- .../caps_2.11.0.s390x.xml | 2 +- .../caps_2.11.0.x86_64.xml | 2 +- .../caps_2.12.0.ppc64.xml | 2 +- .../caps_2.12.0.s390x.xml | 2 +- .../caps_2.12.0.x86_64.xml | 2 +- .../caps_2.4.0.x86_64.xml | 2 +- .../caps_2.5.0.x86_64.xml | 2 +- .../qemucapabilitiesdata/caps_2.6.0.ppc64.xml | 2 +- .../caps_2.6.0.x86_64.xml | 2 +- .../qemucapabilitiesdata/caps_2.7.0.s390x.xml | 2 +- .../caps_2.7.0.x86_64.xml | 2 +- .../qemucapabilitiesdata/caps_2.8.0.s390x.xml | 2 +- .../caps_2.8.0.x86_64.xml | 2 +- .../qemucapabilitiesdata/caps_2.9.0.ppc64.xml | 2 +- .../qemucapabilitiesdata/caps_2.9.0.s390x.xml | 2 +- .../caps_2.9.0.x86_64.xml | 2 +- .../qemucapabilitiesdata/caps_3.0.0.ppc64.xml | 2 +- .../caps_3.0.0.x86_64.xml | 2 +- 37 files changed, 97 insertions(+), 104 deletions(-) delete mode 100644 tests/qemuargv2xmldata/nomachine-aarch64.args delete mode 100644 tests/qemuargv2xmldata/nomachine-aarch64.xml diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 4e4f732889..72b550ae16 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -1625,6 +1625,7 @@ virQEMUCapsPtr virQEMUCapsNewCopy(virQEMUCapsPtr qemuCaps) goto error; ret->machineTypes[i].maxCpus = qemuCaps->machineTypes[i].maxCpus; ret->machineTypes[i].hotplugCpus = qemuCaps->machineTypes[i].hotplugCpus; + ret->machineTypes[i].qemuDefault = qemuCaps->machineTypes[i].qemuDefault; } if (VIR_ALLOC_N(ret->gicCapabilities, qemuCaps->ngicCapabilities) < 0) @@ -2042,6 +2043,17 @@ const char *virQEMUCapsGetCanonicalMachine(virQEMUCapsPtr qemuCaps, return name; } +const char *virQEMUCapsGetDefaultMachine(virQEMUCapsPtr qemuCaps) +{ + size_t i; + + for (i = 0; i < qemuCaps->nmachineTypes; i++) { + if (qemuCaps->machineTypes[i].qemuDefault) + return qemuCaps->machineTypes[i].name; + } + + return NULL; +} int virQEMUCapsGetMachineMaxCpus(virQEMUCapsPtr qemuCaps, const char *name) @@ -3776,10 +3788,11 @@ virQEMUCapsFormatCache(virQEMUCapsPtr qemuCaps) qemuCaps->machineTypes[i].alias); if (qemuCaps->machineTypes[i].hotplugCpus) virBufferAddLit(&buf, " hotplugCpus='yes'"); + virBufferAsprintf(&buf, " maxCpus='%u'", + qemuCaps->machineTypes[i].maxCpus); if (qemuCaps->machineTypes[i].qemuDefault) virBufferAddLit(&buf, " default='yes'"); - virBufferAsprintf(&buf, " maxCpus='%u'/>\n", - qemuCaps->machineTypes[i].maxCpus); + virBufferAddLit(&buf, "/>\n"); } for (i = 0; i < qemuCaps->ngicCapabilities; i++) { diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 88e81be09b..a410885215 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -558,6 +558,7 @@ bool virQEMUCapsIsCPUModeSupported(virQEMUCapsPtr qemuCaps, virCPUMode mode); const char *virQEMUCapsGetCanonicalMachine(virQEMUCapsPtr qemuCaps, const char *name); +const char *virQEMUCapsGetDefaultMachine(virQEMUCapsPtr qemuCaps); int virQEMUCapsGetMachineMaxCpus(virQEMUCapsPtr qemuCaps, const char *name); bool virQEMUCapsGetMachineHotplugCpus(virQEMUCapsPtr qemuCaps, diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index d4a2379e48..75eadbba56 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -7103,7 +7103,8 @@ static char *qemuConnectDomainXMLFromNative(virConnectPtr conn, if (!(caps = virQEMUDriverGetCapabilities(driver, false))) goto cleanup; - def = qemuParseCommandLineString(caps, driver->xmlopt, config, + def = qemuParseCommandLineString(driver->qemuCapsCache, + caps, driver->xmlopt, config, NULL, NULL, NULL); if (!def) goto cleanup; @@ -16581,7 +16582,8 @@ static virDomainPtr qemuDomainQemuAttach(virConnectPtr conn, if (!(caps = virQEMUDriverGetCapabilities(driver, false))) goto cleanup; - if (!(def = qemuParseCommandLinePid(caps, driver->xmlopt, pid, + if (!(def = qemuParseCommandLinePid(driver->qemuCapsCache, + caps, driver->xmlopt, pid, &pidfile, &monConfig, &monJSON))) goto cleanup; diff --git a/src/qemu/qemu_parse_command.c b/src/qemu/qemu_parse_command.c index 351425fedd..b66c1c3d03 100644 --- a/src/qemu/qemu_parse_command.c +++ b/src/qemu/qemu_parse_command.c @@ -1826,7 +1826,8 @@ qemuParseCommandLineBootDevs(virDomainDefPtr def, const char *str) * as is practical. This is not an exact science.... */ static virDomainDefPtr -qemuParseCommandLine(virCapsPtr caps, +qemuParseCommandLine(virFileCachePtr capsCache, + virCapsPtr caps, virDomainXMLOptionPtr xmlopt, char **progenv, char **progargv, @@ -1848,6 +1849,7 @@ qemuParseCommandLine(virCapsPtr caps, virDomainDiskDefPtr disk = NULL; const char *ceph_args = qemuFindEnv(progenv, "CEPH_ARGS"); bool have_sdl = false; + virQEMUCapsPtr qemuCaps; if (pidfile) *pidfile = NULL; @@ -1862,6 +1864,9 @@ qemuParseCommandLine(virCapsPtr caps, return NULL; } + if (!(qemuCaps = virQEMUCapsCacheLookup(capsCache, progargv[0]))) + goto error; + if (!(def = virDomainDefNew())) goto error; @@ -2014,17 +2019,18 @@ qemuParseCommandLine(virCapsPtr caps, /* If no machine type has been found among the arguments, then figure * out a reasonable value by using capabilities */ if (!def->os.machine) { - virCapsDomainDataPtr capsdata; + const char *mach = virQEMUCapsGetDefaultMachine(qemuCaps); - if (!(capsdata = virCapabilitiesDomainDataLookup(caps, def->os.type, - def->os.arch, def->virtType, NULL, NULL))) + if (!mach) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Binary '%s' does not have a default machine type " + "and no '-machine' arg is present"), + progargv[0]); goto error; + } - if (VIR_STRDUP(def->os.machine, capsdata->machinetype) < 0) { - VIR_FREE(capsdata); + if (VIR_STRDUP(def->os.machine, mach) < 0) goto error; - } - VIR_FREE(capsdata); } /* Now the real processing loop */ @@ -2715,6 +2721,7 @@ qemuParseCommandLine(virCapsPtr caps, else qemuDomainCmdlineDefFree(cmd); + virObjectUnref(qemuCaps); return def; error: @@ -2729,11 +2736,13 @@ qemuParseCommandLine(virCapsPtr caps, } if (pidfile) VIR_FREE(*pidfile); + virObjectUnref(qemuCaps); return NULL; } -virDomainDefPtr qemuParseCommandLineString(virCapsPtr caps, +virDomainDefPtr qemuParseCommandLineString(virFileCachePtr capsCache, + virCapsPtr caps, virDomainXMLOptionPtr xmlopt, const char *args, char **pidfile, @@ -2747,7 +2756,7 @@ virDomainDefPtr qemuParseCommandLineString(virCapsPtr caps, if (qemuStringToArgvEnv(args, &progenv, &progargv) < 0) goto cleanup; - def = qemuParseCommandLine(caps, xmlopt, progenv, progargv, + def = qemuParseCommandLine(capsCache, caps, xmlopt, progenv, progargv, pidfile, monConfig, monJSON); cleanup: @@ -2805,7 +2814,8 @@ static int qemuParseProcFileStrings(int pid_value, return ret; } -virDomainDefPtr qemuParseCommandLinePid(virCapsPtr caps, +virDomainDefPtr qemuParseCommandLinePid(virFileCachePtr capsCache, + virCapsPtr caps, virDomainXMLOptionPtr xmlopt, pid_t pid, char **pidfile, @@ -2825,7 +2835,7 @@ virDomainDefPtr qemuParseCommandLinePid(virCapsPtr caps, qemuParseProcFileStrings(pid, "environ", &progenv) < 0) goto cleanup; - if (!(def = qemuParseCommandLine(caps, xmlopt, progenv, progargv, + if (!(def = qemuParseCommandLine(capsCache, caps, xmlopt, progenv, progargv, pidfile, monConfig, monJSON))) goto cleanup; diff --git a/src/qemu/qemu_parse_command.h b/src/qemu/qemu_parse_command.h index b3a950a420..a4db1a50ca 100644 --- a/src/qemu/qemu_parse_command.h +++ b/src/qemu/qemu_parse_command.h @@ -24,19 +24,23 @@ #ifndef __QEMU_PARSE_COMMAND_H__ # define __QEMU_PARSE_COMMAND_H__ +# include "virfilecache.h" + # define QEMU_QXL_VGAMEM_DEFAULT 16 * 1024 /* * NB: def->name can be NULL upon return and the caller * *must* decide how to fill in a name in this case */ -virDomainDefPtr qemuParseCommandLineString(virCapsPtr caps, +virDomainDefPtr qemuParseCommandLineString(virFileCachePtr capsCache, + virCapsPtr caps, virDomainXMLOptionPtr xmlopt, const char *args, char **pidfile, virDomainChrSourceDefPtr *monConfig, bool *monJSON); -virDomainDefPtr qemuParseCommandLinePid(virCapsPtr caps, +virDomainDefPtr qemuParseCommandLinePid(virFileCachePtr capsCache, + virCapsPtr caps, virDomainXMLOptionPtr xmlopt, pid_t pid, char **pidfile, diff --git a/tests/qemuargv2xmldata/nomachine-aarch64.args b/tests/qemuargv2xmldata/nomachine-aarch64.args deleted file mode 100644 index b17c0d0c23..0000000000 --- a/tests/qemuargv2xmldata/nomachine-aarch64.args +++ /dev/null @@ -1,11 +0,0 @@ -LC_ALL=C \ -PATH=/bin \ -HOME=/home/test \ -USER=test \ -LOGNAME=test \ -QEMU_AUDIO_DRV=none \ -/usr/bin/qemu-system-aarch64 \ --name QEMUGuest1 \ --m 512 \ --hda /dev/HostVG/QEMUGuest1 \ --cdrom /root/boot.iso diff --git a/tests/qemuargv2xmldata/nomachine-aarch64.xml b/tests/qemuargv2xmldata/nomachine-aarch64.xml deleted file mode 100644 index 9492423389..0000000000 --- a/tests/qemuargv2xmldata/nomachine-aarch64.xml +++ /dev/null @@ -1,40 +0,0 @@ -<domain type='qemu'> - <name>QEMUGuest1</name> - <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> - <memory unit='KiB'>524288</memory> - <currentMemory unit='KiB'>524288</currentMemory> - <vcpu placement='static'>1</vcpu> - <os> - <type arch='aarch64' machine='virt'>hvm</type> - <boot dev='hd'/> - </os> - <features> - <gic version='2'/> - </features> - <clock offset='utc'/> - <on_poweroff>destroy</on_poweroff> - <on_reboot>restart</on_reboot> - <on_crash>destroy</on_crash> - <devices> - <emulator>/usr/bin/qemu-system-aarch64</emulator> - <disk type='block' device='disk'> - <driver name='qemu' type='raw'/> - <source dev='/dev/HostVG/QEMUGuest1'/> - <target dev='hda' bus='ide'/> - <address type='drive' controller='0' bus='0' target='0' unit='0'/> - </disk> - <disk type='file' device='cdrom'> - <driver name='qemu' type='raw'/> - <source file='/root/boot.iso'/> - <target dev='hdc' bus='ide'/> - <readonly/> - <address type='drive' controller='0' bus='1' target='0' unit='0'/> - </disk> - <controller type='ide' index='0'/> - <graphics type='sdl'/> - <video> - <model type='cirrus' vram='16384' heads='1' primary='yes'/> - </video> - <memballoon model='none'/> - </devices> -</domain> diff --git a/tests/qemuargv2xmldata/nomachine-ppc64.xml b/tests/qemuargv2xmldata/nomachine-ppc64.xml index 1f15a950e3..18b0c5c20a 100644 --- a/tests/qemuargv2xmldata/nomachine-ppc64.xml +++ b/tests/qemuargv2xmldata/nomachine-ppc64.xml @@ -5,7 +5,7 @@ <currentMemory unit='KiB'>524288</currentMemory> <vcpu placement='static'>1</vcpu> <os> - <type arch='ppc64' machine='pseries'>hvm</type> + <type arch='ppc64' machine='pseries-2.12'>hvm</type> <boot dev='hd'/> </os> <clock offset='utc'/> @@ -27,7 +27,7 @@ <readonly/> <address type='drive' controller='0' bus='0' target='0' unit='2'/> </disk> - <controller type='usb' index='0'> + <controller type='usb' index='0' model='pci-ohci'> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> </controller> <controller type='pci' index='0' model='pci-root'> diff --git a/tests/qemuargv2xmldata/nomachine-x86_64.xml b/tests/qemuargv2xmldata/nomachine-x86_64.xml index 33cde4c55a..6863c8f5f4 100644 --- a/tests/qemuargv2xmldata/nomachine-x86_64.xml +++ b/tests/qemuargv2xmldata/nomachine-x86_64.xml @@ -5,7 +5,7 @@ <currentMemory unit='KiB'>524288</currentMemory> <vcpu placement='static'>1</vcpu> <os> - <type arch='x86_64' machine='pc-0.11'>hvm</type> + <type arch='x86_64' machine='pc-i440fx-2.12'>hvm</type> <boot dev='hd'/> </os> <features> @@ -30,7 +30,7 @@ <readonly/> <address type='drive' controller='0' bus='1' target='0' unit='0'/> </disk> - <controller type='usb' index='0'> + <controller type='usb' index='0' model='piix3-uhci'> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> <controller type='pci' index='0' model='pci-root'/> diff --git a/tests/qemuargv2xmldata/pseries-disk.xml b/tests/qemuargv2xmldata/pseries-disk.xml index 1f15a950e3..18b0c5c20a 100644 --- a/tests/qemuargv2xmldata/pseries-disk.xml +++ b/tests/qemuargv2xmldata/pseries-disk.xml @@ -5,7 +5,7 @@ <currentMemory unit='KiB'>524288</currentMemory> <vcpu placement='static'>1</vcpu> <os> - <type arch='ppc64' machine='pseries'>hvm</type> + <type arch='ppc64' machine='pseries-2.12'>hvm</type> <boot dev='hd'/> </os> <clock offset='utc'/> @@ -27,7 +27,7 @@ <readonly/> <address type='drive' controller='0' bus='0' target='0' unit='2'/> </disk> - <controller type='usb' index='0'> + <controller type='usb' index='0' model='pci-ohci'> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> </controller> <controller type='pci' index='0' model='pci-root'> diff --git a/tests/qemuargv2xmldata/pseries-nvram.xml b/tests/qemuargv2xmldata/pseries-nvram.xml index 7787847a90..500227afc0 100644 --- a/tests/qemuargv2xmldata/pseries-nvram.xml +++ b/tests/qemuargv2xmldata/pseries-nvram.xml @@ -5,7 +5,7 @@ <currentMemory unit='KiB'>524288</currentMemory> <vcpu placement='static'>1</vcpu> <os> - <type arch='ppc64' machine='pseries'>hvm</type> + <type arch='ppc64' machine='pseries-2.12'>hvm</type> <boot dev='hd'/> </os> <clock offset='utc'/> @@ -14,7 +14,7 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu-system-ppc64</emulator> - <controller type='usb' index='0'> + <controller type='usb' index='0' model='pci-ohci'> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> </controller> <controller type='pci' index='0' model='pci-root'> diff --git a/tests/qemuargv2xmltest.c b/tests/qemuargv2xmltest.c index cb010268c4..966e75ef5f 100644 --- a/tests/qemuargv2xmltest.c +++ b/tests/qemuargv2xmltest.c @@ -65,7 +65,8 @@ static int testCompareXMLToArgvFiles(const char *xmlfile, if (virTestLoadFile(cmdfile, &cmd) < 0) goto fail; - if (!(vmdef = qemuParseCommandLineString(driver.caps, driver.xmlopt, + if (!(vmdef = qemuParseCommandLineString(driver.qemuCapsCache, + driver.caps, driver.xmlopt, cmd, NULL, NULL, NULL))) goto fail; @@ -154,6 +155,20 @@ mymain(void) if (qemuTestDriverInit(&driver) < 0) return EXIT_FAILURE; +# define LOAD_CAPS(arch) \ + do { \ + virQEMUCapsPtr qemuCaps; \ + qemuCaps = qemuTestParseCapabilitiesArch(VIR_ARCH_X86_64, \ + "qemucapabilitiesdata/caps_2.12.0." arch ".xml"); \ + if (virFileCacheInsertData(driver.qemuCapsCache, \ + "/usr/bin/qemu-system-" arch, \ + qemuCaps) < 0) \ + return EXIT_FAILURE; \ + } while (0) + + LOAD_CAPS("x86_64"); + LOAD_CAPS("aarch64"); + LOAD_CAPS("ppc64"); # define DO_TEST_FULL(name, flags) \ do { \ @@ -290,7 +305,6 @@ mymain(void) DO_TEST("machine-keywrap-none-argv"); DO_TEST("nomachine-x86_64"); - DO_TEST("nomachine-aarch64"); DO_TEST("nomachine-ppc64"); qemuTestDriverFree(&driver); diff --git a/tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml b/tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml index a8dd69f4fa..1b009ba32d 100644 --- a/tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml @@ -160,7 +160,7 @@ <cpu type='tcg' name='core2duo'/> <cpu type='tcg' name='phenom'/> <cpu type='tcg' name='qemu64'/> - <machine name='pc-i440fx-1.5' alias='pc' maxCpus='255'/> + <machine name='pc-i440fx-1.5' alias='pc' maxCpus='255' default='yes'/> <machine name='pc-q35-1.4' maxCpus='255'/> <machine name='pc-q35-1.5' alias='q35' maxCpus='255'/> <machine name='isapc' maxCpus='1'/> diff --git a/tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml index 536e0e19eb..fbf3d2913d 100644 --- a/tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml @@ -165,7 +165,7 @@ <cpu type='tcg' name='core2duo'/> <cpu type='tcg' name='phenom'/> <cpu type='tcg' name='qemu64'/> - <machine name='pc-i440fx-1.6' alias='pc' maxCpus='255'/> + <machine name='pc-i440fx-1.6' alias='pc' maxCpus='255' default='yes'/> <machine name='pc-q35-1.4' maxCpus='255'/> <machine name='pc-q35-1.5' maxCpus='255'/> <machine name='pc-q35-1.6' alias='q35' maxCpus='255'/> diff --git a/tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml index 41f57963fa..cbed9870e9 100644 --- a/tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml @@ -167,7 +167,7 @@ <cpu type='tcg' name='core2duo'/> <cpu type='tcg' name='phenom'/> <cpu type='tcg' name='qemu64'/> - <machine name='pc-i440fx-1.7' alias='pc' maxCpus='255'/> + <machine name='pc-i440fx-1.7' alias='pc' maxCpus='255' default='yes'/> <machine name='pc-q35-1.4' maxCpus='255'/> <machine name='pc-q35-1.5' maxCpus='255'/> <machine name='pc-q35-1.6' maxCpus='255'/> diff --git a/tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml index 28f2db1fbc..77999f7ede 100644 --- a/tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml @@ -185,7 +185,7 @@ <cpu type='tcg' name='core2duo'/> <cpu type='tcg' name='phenom'/> <cpu type='tcg' name='qemu64'/> - <machine name='pc-i440fx-2.1' alias='pc' maxCpus='255'/> + <machine name='pc-i440fx-2.1' alias='pc' maxCpus='255' default='yes'/> <machine name='pc-1.3' maxCpus='255'/> <machine name='pc-0.12' maxCpus='255'/> <machine name='pc-q35-1.6' maxCpus='255'/> diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml index 75c2230b25..b299fd9a54 100644 --- a/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml @@ -1030,7 +1030,7 @@ <cpu type='tcg' name='MPC8544E_v11'/> <cpu type='tcg' name='405GPb'/> <cpu type='tcg' name='MPC8541E_v11'/> - <machine name='pseries-2.10' alias='pseries' hotplugCpus='yes' maxCpus='1024'/> + <machine name='pseries-2.10' alias='pseries' hotplugCpus='yes' maxCpus='1024' default='yes'/> <machine name='ref405ep' maxCpus='1'/> <machine name='virtex-ml507' maxCpus='1'/> <machine name='powernv' maxCpus='2048'/> diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml b/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml index 5d134f4708..efe2dcd02f 100644 --- a/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml @@ -1265,7 +1265,7 @@ <blocker name='msa'/> <blocker name='type'/> </cpu> - <machine name='s390-ccw-virtio-2.10' alias='s390-ccw-virtio' maxCpus='248'/> + <machine name='s390-ccw-virtio-2.10' alias='s390-ccw-virtio' maxCpus='248' default='yes'/> <machine name='s390-ccw-virtio-2.7' maxCpus='248'/> <machine name='s390-ccw-virtio-2.6' maxCpus='248'/> <machine name='s390-ccw-virtio-2.5' maxCpus='248'/> diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml index e5905d727c..6d5bfb43f7 100644 --- a/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml @@ -932,7 +932,7 @@ <blocker name='3dnowprefetch'/> </cpu> <cpu type='tcg' name='486' usable='yes'/> - <machine name='pc-i440fx-2.10' alias='pc' hotplugCpus='yes' maxCpus='255'/> + <machine name='pc-i440fx-2.10' alias='pc' hotplugCpus='yes' maxCpus='255' default='yes'/> <machine name='pc-0.12' hotplugCpus='yes' maxCpus='255'/> <machine name='pc-i440fx-2.4' hotplugCpus='yes' maxCpus='255'/> <machine name='pc-1.3' hotplugCpus='yes' maxCpus='255'/> diff --git a/tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml b/tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml index df70c7d3e9..4a325068eb 100644 --- a/tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml @@ -2610,7 +2610,7 @@ <blocker name='hfpm'/> <blocker name='type'/> </cpu> - <machine name='s390-ccw-virtio-2.11' alias='s390-ccw-virtio' hotplugCpus='yes' maxCpus='248'/> + <machine name='s390-ccw-virtio-2.11' alias='s390-ccw-virtio' hotplugCpus='yes' maxCpus='248' default='yes'/> <machine name='s390-ccw-virtio-2.7' hotplugCpus='yes' maxCpus='248'/> <machine name='s390-ccw-virtio-2.6' hotplugCpus='yes' maxCpus='248'/> <machine name='s390-ccw-virtio-2.10' hotplugCpus='yes' maxCpus='248'/> diff --git a/tests/qemucapabilitiesdata/caps_2.11.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.11.0.x86_64.xml index c22d8507a6..43a1fd1872 100644 --- a/tests/qemucapabilitiesdata/caps_2.11.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.11.0.x86_64.xml @@ -923,7 +923,7 @@ <blocker name='3dnowprefetch'/> </cpu> <cpu type='tcg' name='486' usable='yes'/> - <machine name='pc-i440fx-2.11' alias='pc' hotplugCpus='yes' maxCpus='255'/> + <machine name='pc-i440fx-2.11' alias='pc' hotplugCpus='yes' maxCpus='255' default='yes'/> <machine name='pc-0.12' hotplugCpus='yes' maxCpus='255'/> <machine name='pc-i440fx-2.4' hotplugCpus='yes' maxCpus='255'/> <machine name='pc-1.3' hotplugCpus='yes' maxCpus='255'/> diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml index d94082600f..f3af6b641b 100644 --- a/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml @@ -1048,7 +1048,7 @@ <cpu type='tcg' name='750_v3.1'/> <cpu type='tcg' name='power8e_v2.1'/> <cpu type='tcg' name='mpc8568e'/> - <machine name='pseries-2.12' alias='pseries' hotplugCpus='yes' maxCpus='1024'/> + <machine name='pseries-2.12' alias='pseries' hotplugCpus='yes' maxCpus='1024' default='yes'/> <machine name='ref405ep' maxCpus='1'/> <machine name='sam460ex' maxCpus='1'/> <machine name='virtex-ml507' maxCpus='1'/> diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml b/tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml index e5b7ffc433..a52fdc4a88 100644 --- a/tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml @@ -2475,7 +2475,7 @@ <blocker name='kmac-dea'/> <blocker name='hfpm'/> </cpu> - <machine name='s390-ccw-virtio-2.12' alias='s390-ccw-virtio' hotplugCpus='yes' maxCpus='248'/> + <machine name='s390-ccw-virtio-2.12' alias='s390-ccw-virtio' hotplugCpus='yes' maxCpus='248' default='yes'/> <machine name='s390-ccw-virtio-2.7' hotplugCpus='yes' maxCpus='248'/> <machine name='s390-ccw-virtio-2.6' hotplugCpus='yes' maxCpus='248'/> <machine name='s390-ccw-virtio-2.11' hotplugCpus='yes' maxCpus='248'/> diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml index d34d762ca8..3b099c3f88 100644 --- a/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml @@ -1216,7 +1216,7 @@ <blocker name='3dnowprefetch'/> </cpu> <cpu type='tcg' name='486' usable='yes'/> - <machine name='pc-i440fx-2.12' alias='pc' hotplugCpus='yes' maxCpus='255'/> + <machine name='pc-i440fx-2.12' alias='pc' hotplugCpus='yes' maxCpus='255' default='yes'/> <machine name='isapc' hotplugCpus='yes' maxCpus='1'/> <machine name='pc-1.1' hotplugCpus='yes' maxCpus='255'/> <machine name='pc-1.2' hotplugCpus='yes' maxCpus='255'/> diff --git a/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml index 8b480889b8..ba81aeec4c 100644 --- a/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml @@ -217,7 +217,7 @@ <cpu type='tcg' name='core2duo'/> <cpu type='tcg' name='phenom'/> <cpu type='tcg' name='qemu64'/> - <machine name='pc-i440fx-2.4' alias='pc' maxCpus='255'/> + <machine name='pc-i440fx-2.4' alias='pc' maxCpus='255' default='yes'/> <machine name='pc-1.3' maxCpus='255'/> <machine name='pc-0.12' maxCpus='255'/> <machine name='pc-q35-1.6' maxCpus='255'/> diff --git a/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml index 1055b367fb..a52bbadac6 100644 --- a/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml @@ -223,7 +223,7 @@ <cpu type='tcg' name='core2duo'/> <cpu type='tcg' name='phenom'/> <cpu type='tcg' name='qemu64'/> - <machine name='pc-i440fx-2.5' alias='pc' maxCpus='255'/> + <machine name='pc-i440fx-2.5' alias='pc' maxCpus='255' default='yes'/> <machine name='pc-i440fx-2.4' maxCpus='255'/> <machine name='pc-1.3' maxCpus='255'/> <machine name='pc-0.12' maxCpus='255'/> diff --git a/tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml index be091167d3..dc185b031e 100644 --- a/tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml @@ -1005,7 +1005,7 @@ <cpu type='tcg' name='MPC8544E_v11'/> <cpu type='tcg' name='405GPb'/> <cpu type='tcg' name='MPC8541E_v11'/> - <machine name='pseries-2.6' alias='pseries' maxCpus='255'/> + <machine name='pseries-2.6' alias='pseries' maxCpus='255' default='yes'/> <machine name='ref405ep' maxCpus='1'/> <machine name='virtex-ml507' maxCpus='1'/> <machine name='ppce500' maxCpus='32'/> diff --git a/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml index ea2623c9ef..45162b618d 100644 --- a/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml @@ -235,7 +235,7 @@ <cpu type='tcg' name='core2duo'/> <cpu type='tcg' name='phenom'/> <cpu type='tcg' name='qemu64'/> - <machine name='pc-i440fx-2.6' alias='pc' maxCpus='255'/> + <machine name='pc-i440fx-2.6' alias='pc' maxCpus='255' default='yes'/> <machine name='pc-0.12' maxCpus='255'/> <machine name='pc-i440fx-2.4' maxCpus='255'/> <machine name='pc-1.3' maxCpus='255'/> diff --git a/tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml b/tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml index adc3877bd8..2425ec5869 100644 --- a/tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml @@ -113,7 +113,7 @@ <arch>s390x</arch> <cpu type='kvm' name='host'/> <cpu type='tcg' name='host'/> - <machine name='s390-ccw-virtio-2.7' alias='s390-ccw-virtio' maxCpus='248'/> + <machine name='s390-ccw-virtio-2.7' alias='s390-ccw-virtio' maxCpus='248' default='yes'/> <machine name='s390-ccw-virtio-2.5' maxCpus='248'/> <machine name='s390-ccw-virtio-2.4' maxCpus='248'/> <machine name='s390-ccw-virtio-2.6' maxCpus='248'/> diff --git a/tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml index 00557a9783..f31f1ed6bf 100644 --- a/tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml @@ -242,7 +242,7 @@ <cpu type='tcg' name='core2duo'/> <cpu type='tcg' name='phenom'/> <cpu type='tcg' name='qemu64'/> - <machine name='pc-i440fx-2.7' alias='pc' hotplugCpus='yes' maxCpus='255'/> + <machine name='pc-i440fx-2.7' alias='pc' hotplugCpus='yes' maxCpus='255' default='yes'/> <machine name='pc-0.12' hotplugCpus='yes' maxCpus='255'/> <machine name='pc-i440fx-2.4' hotplugCpus='yes' maxCpus='255'/> <machine name='pc-1.3' hotplugCpus='yes' maxCpus='255'/> diff --git a/tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml b/tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml index fdaea3fabb..b1e70a8bec 100644 --- a/tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml @@ -259,7 +259,7 @@ <cpu type='tcg' name='z196-base'/> <cpu type='tcg' name='z13-base'/> <cpu type='tcg' name='z890'/> - <machine name='s390-ccw-virtio-2.8' alias='s390-ccw-virtio' maxCpus='248'/> + <machine name='s390-ccw-virtio-2.8' alias='s390-ccw-virtio' maxCpus='248' default='yes'/> <machine name='s390-ccw-virtio-2.7' maxCpus='248'/> <machine name='s390-ccw-virtio-2.6' maxCpus='248'/> <machine name='s390-ccw-virtio-2.5' maxCpus='248'/> diff --git a/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml index 71548b6326..b27a6c6687 100644 --- a/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml @@ -367,7 +367,7 @@ <blocker name='3dnowprefetch'/> </cpu> <cpu type='tcg' name='486' usable='yes'/> - <machine name='pc-i440fx-2.8' alias='pc' hotplugCpus='yes' maxCpus='255'/> + <machine name='pc-i440fx-2.8' alias='pc' hotplugCpus='yes' maxCpus='255' default='yes'/> <machine name='pc-0.12' hotplugCpus='yes' maxCpus='255'/> <machine name='pc-i440fx-2.4' hotplugCpus='yes' maxCpus='255'/> <machine name='pc-1.3' hotplugCpus='yes' maxCpus='255'/> diff --git a/tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml index c4ebb73d21..1f912a6007 100644 --- a/tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml @@ -1021,7 +1021,7 @@ <cpu type='tcg' name='MPC8544E_v11'/> <cpu type='tcg' name='405GPb'/> <cpu type='tcg' name='MPC8541E_v11'/> - <machine name='pseries-2.9' alias='pseries' hotplugCpus='yes' maxCpus='1024'/> + <machine name='pseries-2.9' alias='pseries' hotplugCpus='yes' maxCpus='1024' default='yes'/> <machine name='ref405ep' maxCpus='1'/> <machine name='virtex-ml507' maxCpus='1'/> <machine name='powernv' maxCpus='2048'/> diff --git a/tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml b/tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml index 302cc5ffa1..4a886f8268 100644 --- a/tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml @@ -264,7 +264,7 @@ <cpu type='tcg' name='z196-base'/> <cpu type='tcg' name='z13-base'/> <cpu type='tcg' name='z890'/> - <machine name='s390-ccw-virtio-2.9' alias='s390-ccw-virtio' maxCpus='248'/> + <machine name='s390-ccw-virtio-2.9' alias='s390-ccw-virtio' maxCpus='248' default='yes'/> <machine name='s390-ccw-virtio-2.7' maxCpus='248'/> <machine name='s390-ccw-virtio-2.6' maxCpus='248'/> <machine name='s390-ccw-virtio-2.5' maxCpus='248'/> diff --git a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml index c0bfb3f07a..6425112350 100644 --- a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml @@ -850,7 +850,7 @@ <blocker name='3dnowprefetch'/> </cpu> <cpu type='tcg' name='486' usable='yes'/> - <machine name='pc-i440fx-2.9' alias='pc' hotplugCpus='yes' maxCpus='255'/> + <machine name='pc-i440fx-2.9' alias='pc' hotplugCpus='yes' maxCpus='255' default='yes'/> <machine name='pc-0.12' hotplugCpus='yes' maxCpus='255'/> <machine name='pc-i440fx-2.4' hotplugCpus='yes' maxCpus='255'/> <machine name='pc-1.3' hotplugCpus='yes' maxCpus='255'/> diff --git a/tests/qemucapabilitiesdata/caps_3.0.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_3.0.0.ppc64.xml index 64033dee51..359fe07b7d 100644 --- a/tests/qemucapabilitiesdata/caps_3.0.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_3.0.0.ppc64.xml @@ -1048,7 +1048,7 @@ <cpu type='tcg' name='750_v3.1'/> <cpu type='tcg' name='power5+_v2.1'/> <cpu type='tcg' name='mpc8568e'/> - <machine name='pseries-3.0' alias='pseries' hotplugCpus='yes' maxCpus='1024'/> + <machine name='pseries-3.0' alias='pseries' hotplugCpus='yes' maxCpus='1024' default='yes'/> <machine name='ref405ep' maxCpus='1'/> <machine name='sam460ex' maxCpus='1'/> <machine name='virtex-ml507' maxCpus='1'/> diff --git a/tests/qemucapabilitiesdata/caps_3.0.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_3.0.0.x86_64.xml index c8da1c5696..d8297620c0 100644 --- a/tests/qemucapabilitiesdata/caps_3.0.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_3.0.0.x86_64.xml @@ -1158,7 +1158,7 @@ <blocker name='3dnowprefetch'/> </cpu> <cpu type='tcg' name='486' usable='yes'/> - <machine name='pc-i440fx-3.0' alias='pc' hotplugCpus='yes' maxCpus='255'/> + <machine name='pc-i440fx-3.0' alias='pc' hotplugCpus='yes' maxCpus='255' default='yes'/> <machine name='isapc' hotplugCpus='yes' maxCpus='1'/> <machine name='pc-1.1' hotplugCpus='yes' maxCpus='255'/> <machine name='pc-1.2' hotplugCpus='yes' maxCpus='255'/> -- 2.17.1

On 08/16/2018 11:12 AM, Daniel P. Berrangé wrote:
Historically the argv -> xml convertor wanted the same default machine as we'd set when parsing xml. The latter has now changed, however, to use a default defined by libvirt. The former needs fixing to again honour the default QEMU machine.
This exposed a bug in handling for the aarch64 target, as QEMU does not define any default machine. Thus we should not having been accepting argv without a -machine provided.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- src/qemu/qemu_capabilities.c | 17 +++++++- src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_driver.c | 6 ++- src/qemu/qemu_parse_command.c | 34 ++++++++++------ src/qemu/qemu_parse_command.h | 8 +++- tests/qemuargv2xmldata/nomachine-aarch64.args | 11 ----- tests/qemuargv2xmldata/nomachine-aarch64.xml | 40 ------------------- tests/qemuargv2xmldata/nomachine-ppc64.xml | 4 +- tests/qemuargv2xmldata/nomachine-x86_64.xml | 4 +- tests/qemuargv2xmldata/pseries-disk.xml | 4 +- tests/qemuargv2xmldata/pseries-nvram.xml | 4 +- tests/qemuargv2xmltest.c | 18 ++++++++- .../caps_1.5.3.x86_64.xml | 2 +- .../caps_1.6.0.x86_64.xml | 2 +- .../caps_1.7.0.x86_64.xml | 2 +- .../caps_2.1.1.x86_64.xml | 2 +- .../caps_2.10.0.ppc64.xml | 2 +- .../caps_2.10.0.s390x.xml | 2 +- .../caps_2.10.0.x86_64.xml | 2 +- .../caps_2.11.0.s390x.xml | 2 +- .../caps_2.11.0.x86_64.xml | 2 +- .../caps_2.12.0.ppc64.xml | 2 +- .../caps_2.12.0.s390x.xml | 2 +- .../caps_2.12.0.x86_64.xml | 2 +- .../caps_2.4.0.x86_64.xml | 2 +- .../caps_2.5.0.x86_64.xml | 2 +- .../qemucapabilitiesdata/caps_2.6.0.ppc64.xml | 2 +- .../caps_2.6.0.x86_64.xml | 2 +- .../qemucapabilitiesdata/caps_2.7.0.s390x.xml | 2 +- .../caps_2.7.0.x86_64.xml | 2 +- .../qemucapabilitiesdata/caps_2.8.0.s390x.xml | 2 +- .../caps_2.8.0.x86_64.xml | 2 +- .../qemucapabilitiesdata/caps_2.9.0.ppc64.xml | 2 +- .../qemucapabilitiesdata/caps_2.9.0.s390x.xml | 2 +- .../caps_2.9.0.x86_64.xml | 2 +- .../qemucapabilitiesdata/caps_3.0.0.ppc64.xml | 2 +- .../caps_3.0.0.x86_64.xml | 2 +- 37 files changed, 97 insertions(+), 104 deletions(-) delete mode 100644 tests/qemuargv2xmldata/nomachine-aarch64.args delete mode 100644 tests/qemuargv2xmldata/nomachine-aarch64.xml
[...]
}
if (VIR_ALLOC_N(ret->gicCapabilities, qemuCaps->ngicCapabilities) < 0) @@ -2042,6 +2043,17 @@ const char *virQEMUCapsGetCanonicalMachine(virQEMUCapsPtr qemuCaps, return name; }
+const char *virQEMUCapsGetDefaultMachine(virQEMUCapsPtr qemuCaps)
Most recent preference is: const char * virQEMUCapsGetDefaultMachine(...) w/ 2 empty lines before and after.
+{ + size_t i; + + for (i = 0; i < qemuCaps->nmachineTypes; i++) { + if (qemuCaps->machineTypes[i].qemuDefault) + return qemuCaps->machineTypes[i].name; + } + + return NULL; +}
[...] Reviewed-by: John Ferlan <jferlan@redhat.com> John
participants (2)
-
Daniel P. Berrangé
-
John Ferlan