[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] libxl: only set b_info->u.hvm.bios if type if HVM



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1330691605 0
# Node ID 33659563f5897b3dabc93284252f8570ed825e63
# Parent  5e38c834f7958bf8fbd4330d27369e8571285063
libxl: only set b_info->u.hvm.bios if type if HVM

This fixes a PV guest breakage causes by 24932:6eac4a1ee646 "libxl: Select BIOS
using libxl_domain_build_info_setdefaults".

I have also included a sanity check on b_info->type.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Acked-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Committed-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---


diff -r 5e38c834f795 -r 33659563f589 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c        Thu Mar 01 19:00:09 2012 +0000
+++ b/tools/libxl/libxl_create.c        Fri Mar 02 12:33:25 2012 +0000
@@ -67,28 +67,34 @@
 int libxl__domain_build_info_setdefault(libxl__gc *gc,
                                         libxl_domain_build_info *b_info)
 {
+    if (b_info->type != LIBXL_DOMAIN_TYPE_HVM &&
+        b_info->type != LIBXL_DOMAIN_TYPE_PV)
+        return ERROR_INVAL;
+
     if (!b_info->device_model_version)
         b_info->device_model_version =
             LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL;
 
-    if (!b_info->u.hvm.bios)
+    if (b_info->type == LIBXL_DOMAIN_TYPE_HVM) {
+        if (!b_info->u.hvm.bios)
+            switch (b_info->device_model_version) {
+            case 1: b_info->u.hvm.bios = LIBXL_BIOS_TYPE_ROMBIOS; break;
+            case 2: b_info->u.hvm.bios = LIBXL_BIOS_TYPE_SEABIOS; break;
+            default:return ERROR_INVAL;
+            }
+
+        /* Enforce BIOS<->Device Model version relationship */
         switch (b_info->device_model_version) {
-        case 1: b_info->u.hvm.bios = LIBXL_BIOS_TYPE_ROMBIOS; break;
-        case 2: b_info->u.hvm.bios = LIBXL_BIOS_TYPE_SEABIOS; break;
-        default:return ERROR_INVAL;
-    }
-
-    /* Enforce BIOS<->Device Model version relationship */
-    switch (b_info->device_model_version) {
-    case 1:
-        if (b_info->u.hvm.bios != LIBXL_BIOS_TYPE_ROMBIOS)
-            return ERROR_INVAL;
-        break;
-    case 2:
-        if (b_info->u.hvm.bios == LIBXL_BIOS_TYPE_ROMBIOS)
-            return ERROR_INVAL;
-        break;
-    default:abort();
+        case 1:
+            if (b_info->u.hvm.bios != LIBXL_BIOS_TYPE_ROMBIOS)
+                return ERROR_INVAL;
+            break;
+        case 2:
+            if (b_info->u.hvm.bios == LIBXL_BIOS_TYPE_ROMBIOS)
+                return ERROR_INVAL;
+            break;
+        default:abort();
+        }
     }
 
     libxl_defbool_setdefault(&b_info->device_model_stubdomain, false);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.