diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 5c0a00350b..bfcdc026e6 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -175,7 +175,11 @@ and machine referring to the machine type. The Capabilities XML provides details on allowed values for - these. Since 0.0.1 + these. If arch is omitted then for most hypervisor + drivers, the host native arch will be chosen. For the test, + ESX and VMWare hypervisor drivers, however, + the i686 arch will always be chosen even on an + x86_64 host. Since 0.0.1
loader
The optional loader tag refers to a firmware blob, which is specified by absolute path, diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index a7a89b61b9..3d36bb9ac9 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -19613,6 +19613,7 @@ virDomainCachetuneDefParse(virDomainDefPtr def, static int virDomainDefParseCaps(virDomainDefPtr def, xmlXPathContextPtr ctxt, + virDomainXMLOptionPtr xmlopt, virCapsPtr caps, unsigned int flags) { @@ -19673,6 +19674,13 @@ virDomainDefParseCaps(virDomainDefPtr def, return -1; } + if (def->os.arch == VIR_ARCH_NONE) { + if (xmlopt && xmlopt->config.defArch != VIR_ARCH_NONE) + def->os.arch = xmlopt->config.defArch; + else + def->os.arch = virArchFromHost(); + } + if (!(capsdata = virCapabilitiesDomainDataLookup(caps, def->os.type, def->os.arch, def->virtType, @@ -19681,8 +19689,6 @@ virDomainDefParseCaps(virDomainDefPtr def, return -1; virResetLastError(); } else { - if (!def->os.arch) - def->os.arch = capsdata->arch; if (!def->os.machine) def->os.machine = g_strdup(capsdata->machinetype); } @@ -19840,7 +19846,7 @@ virDomainDefParseXML(xmlDocPtr xml, id = -1; def->id = (int)id; - if (virDomainDefParseCaps(def, ctxt, caps, flags) < 0) + if (virDomainDefParseCaps(def, ctxt, xmlopt, caps, flags) < 0) goto error; /* Extract domain name */ diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 6b70eda14e..462323ec76 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2705,6 +2705,7 @@ struct _virDomainDefParserConfig { /* data */ unsigned int features; /* virDomainDefFeatures */ unsigned char macPrefix[VIR_MAC_PREFIX_BUFLEN]; + virArch defArch; }; typedef void *(*virDomainXMLPrivateDataAllocFunc)(void *); diff --git a/src/test/test_driver.c b/src/test/test_driver.c index e7ec537bb0..f2700d90bc 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -424,6 +424,7 @@ testDriverNew(void) VIR_DOMAIN_DEF_FEATURE_USER_ALIAS | VIR_DOMAIN_DEF_FEATURE_FW_AUTOSELECT | VIR_DOMAIN_DEF_FEATURE_NET_MODEL_STRING, + .defArch = VIR_ARCH_I686, }; virDomainXMLPrivateDataCallbacks privatecb = { .alloc = testDomainObjPrivateAlloc, diff --git a/src/vmware/vmware_driver.c b/src/vmware/vmware_driver.c index c0071fc18c..bab4fdb82b 100644 --- a/src/vmware/vmware_driver.c +++ b/src/vmware/vmware_driver.c @@ -139,6 +139,7 @@ vmwareDomainDeviceDefPostParse(virDomainDeviceDefPtr dev G_GNUC_UNUSED, virDomainDefParserConfig vmwareDomainDefParserConfig = { .devicesPostParseCallback = vmwareDomainDeviceDefPostParse, .domainPostParseCallback = vmwareDomainDefPostParse, + .defArch = VIR_ARCH_I686, }; static virDomainXMLOptionPtr diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index 0ccc4eefe6..c4af7b1ce9 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -556,6 +556,7 @@ static virDomainDefParserConfig virVMXDomainDefParserConfig = { .features = (VIR_DOMAIN_DEF_FEATURE_WIDE_SCSI | VIR_DOMAIN_DEF_FEATURE_NAME_SLASH | VIR_DOMAIN_DEF_FEATURE_NO_BOOT_ORDER), + .defArch = VIR_ARCH_I686, }; struct virVMXDomainDefNamespaceData {