]> xenbits.xensource.com Git - libvirt.git/commitdiff
Default to native arch, and check domain type when auto-filling guest arch (Soren...
authorDaniel P. Berrange <berrange@redhat.com>
Tue, 24 Mar 2009 11:16:29 +0000 (11:16 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Tue, 24 Mar 2009 11:16:29 +0000 (11:16 +0000)
ChangeLog
src/capabilities.c
src/capabilities.h
src/domain_conf.c
src/xm_internal.c

index 28516954ef8025f19ee5f984b8b3617cf84caaae..f1a420cfe0655130aa9cb4fd7d114dbba9bc746c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+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
index fb21d875ae9b1413d6a05b7bb0c7e00c25d46942..d6e3478f93867646bc6378dc5bdbffd9962fa1d7 100644 (file)
@@ -468,14 +468,26 @@ virCapabilitiesSupportsGuestArch(virCapsPtr caps,
  */
 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;
 }
 
 /**
index db3229129be3244ecce277913ffdcae43d118834..5b0bbabbbfdfa42eb7a215aa6636160140f106ee 100644 (file)
@@ -177,7 +177,8 @@ virCapabilitiesSupportsGuestArch(virCapsPtr caps,
 
 extern const char *
 virCapabilitiesDefaultGuestArch(virCapsPtr caps,
-                                const char *ostype);
+                                const char *ostype,
+                                const char *domain);
 extern const char *
 virCapabilitiesDefaultGuestMachine(virCapsPtr caps,
                                    const char *ostype,
index 5bf34837f4bd22aa5d71a8e7fbe465f2bd3d5386..269644983f6fd2fd75eb4f4ea41d78ffdec058c4 100644 (file)
@@ -2146,7 +2146,7 @@ static virDomainDefPtr virDomainDefParseXML(virConnectPtr conn,
             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'"),
index 3a96058d721f0729036c3c1731e3804a815cbe7d..851939196680995512dc67ce131c2cf2049c5371 100644 (file)
@@ -695,7 +695,7 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
     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'"),