[PATCH] libxl: Use enum values for qemu version not raw numbers

Ian Campbell
Thu, 22 Mar 2012 09:13:01 -0000

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1332406949 0
# Node ID 691063aaf0dee77576fb6c2c69b186334d80bbfa
# Parent  f588c69fd12f17e81d3289653ae1e3b20cd41c11
libxl: Use enum values for qemu version not raw numbers

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>

diff -r f588c69fd12f -r 691063aaf0de tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Mon Mar 19 15:06:19 2012 +0000
+++ b/tools/libxl/libxl_create.c	Thu Mar 22 09:02:29 2012 +0000
@@ -85,18 +85,20 @@ int libxl__domain_build_info_setdefault(
     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;
+            case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL:
+                b_info->u.hvm.bios = LIBXL_BIOS_TYPE_ROMBIOS; break;
+            case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN:
+                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:
+        case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL:
             if (b_info->u.hvm.bios != LIBXL_BIOS_TYPE_ROMBIOS)
                 return ERROR_INVAL;
             break;
-        case 2:
+        case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN:
             if (b_info->u.hvm.bios == LIBXL_BIOS_TYPE_ROMBIOS)
                 return ERROR_INVAL;
             break;