+Tue Mar 24 11:14:22 GMT 2009 Daniel P. Berrange <berrange@redhat.com>
+
+ * src/capabilities.c, file src/capabilities.h,
+ src/domain_conf.c, src/xm_internal.c: Prefer native arch
+ when auto-filling guest architecture. Match on domain type
+ when auto-filling architecture (Soren Hansen)
+
Tue Mar 24 10:51:22 GMT 2009 Daniel P. Berrange <berrange@redhat.com>
* src/Makefile.maint: Include 'CHECK: ' prefix when printing
*/
extern const char *
virCapabilitiesDefaultGuestArch(virCapsPtr caps,
- const char *ostype)
+ const char *ostype,
+ const char *domain)
{
- int i;
+ int i, j;
+ const char *arch = NULL;
for (i = 0 ; i < caps->nguests ; i++) {
- if (STREQ(caps->guests[i]->ostype, ostype))
- return caps->guests[i]->arch.name;
+ if (STREQ(caps->guests[i]->ostype, ostype)) {
+ for (j = 0 ; j < caps->guests[i]->arch.ndomains ; j++) {
+ if (STREQ(caps->guests[i]->arch.domains[j]->type, domain)) {
+ /* Use the first match... */
+ if (!arch)
+ arch = caps->guests[i]->arch.name;
+ /* ...unless we can match the host's architecture. */
+ if (STREQ(caps->guests[i]->arch.name, caps->host.arch))
+ return caps->guests[i]->arch.name;
+ }
+ }
+ }
}
- return NULL;
+ return arch;
}
/**
extern const char *
virCapabilitiesDefaultGuestArch(virCapsPtr caps,
- const char *ostype);
+ const char *ostype,
+ const char *domain);
extern const char *
virCapabilitiesDefaultGuestMachine(virCapsPtr caps,
const char *ostype,
goto error;
}
} else {
- const char *defaultArch = virCapabilitiesDefaultGuestArch(caps, def->os.type);
+ const char *defaultArch = virCapabilitiesDefaultGuestArch(caps, def->os.type, virDomainVirtTypeToString(def->virtType));
if (defaultArch == NULL) {
virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
_("no supported architecture for os type '%s'"),
if (!(def->os.type = strdup(hvm ? "hvm" : "xen")))
goto no_memory;
- defaultArch = virCapabilitiesDefaultGuestArch(priv->caps, def->os.type);
+ defaultArch = virCapabilitiesDefaultGuestArch(priv->caps, def->os.type, virDomainVirtTypeToString(def->virtType));
if (defaultArch == NULL) {
xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
_("no supported architecture for os type '%s'"),