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

[Xen-changelog] [xen staging] Revert "libxl: add helper function to set device_model_version"



commit 3c16684d062965c5c9dc411f602ec31700ed9ace
Author:     Wei Liu <wei.liu2@xxxxxxxxxx>
AuthorDate: Wed May 22 09:09:08 2019 +0100
Commit:     Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Wed May 22 09:09:08 2019 +0100

    Revert "libxl: add helper function to set device_model_version"
    
    This reverts commit 3802ecbaa9eb36cbadce39ab03a4f6d36f29ae5c.
    
    Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 tools/libxl/libxl_create.c   | 90 +++++++++++++++++---------------------------
 tools/libxl/libxl_dm.c       |  2 -
 tools/libxl/libxl_internal.h |  2 -
 3 files changed, 35 insertions(+), 59 deletions(-)

diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index 42a218cf3a..03ce166f4f 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -27,53 +27,6 @@
 
 #include <xen-xsm/flask/flask.h>
 
-int libxl__domain_set_device_model(libxl__gc *gc, libxl_domain_config 
*d_config)
-{
-    libxl_domain_build_info *b_info = &d_config->b_info;
-    int ret;
-
-    libxl_defbool_setdefault(&b_info->device_model_stubdomain, false);
-
-    if (b_info->device_model_version)
-        return 0;
-
-    switch (b_info->type) {
-    case LIBXL_DOMAIN_TYPE_HVM:
-        if (libxl_defbool_val(b_info->device_model_stubdomain)) {
-            b_info->device_model_version =
-                LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL;
-        } else {
-            b_info->device_model_version = libxl__default_device_model(gc);
-        }
-        break;
-    default:
-        b_info->device_model_version =
-            LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL;
-        break;
-    }
-
-    if (b_info->device_model_version == LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN) {
-        const char *dm;
-
-        dm = libxl__domain_device_model(gc, b_info);
-        ret = access(dm, X_OK);
-        if (ret < 0) {
-            /* qemu-xen unavailable, use qemu-xen-traditional */
-            if (errno == ENOENT) {
-                LOGE(INFO, "qemu-xen is unavailable"
-                     ", using qemu-xen-traditional instead");
-                b_info->device_model_version =
-                    LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL;
-            } else {
-                LOGE(ERROR, "qemu-xen access error");
-                return ERROR_FAIL;
-            }
-        }
-    }
-
-    return 0;
-}
-
 int libxl__domain_create_info_setdefault(libxl__gc *gc,
                                          libxl_domain_create_info *c_info)
 {
@@ -120,8 +73,6 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
         return ERROR_INVAL;
     }
 
-    assert(b_info->device_model_version);
-
     /* Copy deprecated options to it's new position. */
     rc = libxl__domain_build_info_copy_deprecated(CTX, b_info);
     if (rc) {
@@ -129,10 +80,45 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
         return rc;
     }
 
+    libxl_defbool_setdefault(&b_info->device_model_stubdomain, false);
+
     if (libxl_defbool_val(b_info->device_model_stubdomain) &&
         !b_info->device_model_ssidref)
         b_info->device_model_ssidref = SECINITSID_DOMDM;
 
+    if (!b_info->device_model_version) {
+        if (b_info->type == LIBXL_DOMAIN_TYPE_HVM) {
+            if (libxl_defbool_val(b_info->device_model_stubdomain)) {
+                b_info->device_model_version =
+                    LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL;
+            } else {
+                b_info->device_model_version = libxl__default_device_model(gc);
+            }
+        } else {
+            b_info->device_model_version =
+                LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN;
+        }
+        if (b_info->device_model_version
+                == LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN) {
+            const char *dm;
+
+            dm = libxl__domain_device_model(gc, b_info);
+            rc = access(dm, X_OK);
+            if (rc < 0) {
+                /* qemu-xen unavailable, use qemu-xen-traditional */
+                if (errno == ENOENT) {
+                    LOGE(INFO, "qemu-xen is unavailable"
+                         ", using qemu-xen-traditional instead");
+                    b_info->device_model_version =
+                        LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL;
+                } else {
+                    LOGE(ERROR, "qemu-xen access error");
+                    return ERROR_FAIL;
+                }
+            }
+        }
+    }
+
     if (b_info->blkdev_start == NULL)
         b_info->blkdev_start = libxl__strdup(NOGC, "xvda");
 
@@ -953,12 +939,6 @@ static void initiate_domain_create(libxl__egc *egc,
         goto error_out;
     }
 
-    ret = libxl__domain_set_device_model(gc, d_config);
-    if (ret) {
-        LOGD(ERROR, domid, "Unable to set domain device model");
-        goto error_out;
-    }
-
     ret = libxl__domain_create_info_setdefault(gc, &d_config->c_info);
     if (ret) {
         LOGD(ERROR, domid, "Unable to set domain create info defaults");
diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index 209deedce6..f4fc96415d 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -2157,8 +2157,6 @@ void libxl__spawn_stub_dm(libxl__egc *egc, 
libxl__stub_dm_spawn_state *sdss)
     dm_config->c_info.run_hotplug_scripts =
         guest_config->c_info.run_hotplug_scripts;
 
-    ret = libxl__domain_set_device_model(gc, dm_config);
-    if (ret) goto out;
     ret = libxl__domain_create_info_setdefault(gc, &dm_config->c_info);
     if (ret) goto out;
     ret = libxl__domain_build_info_setdefault(gc, &dm_config->b_info);
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 698cf70356..3be5c644c1 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -1374,8 +1374,6 @@ _hidden int libxl__device_nextid(libxl__gc *gc, uint32_t 
domid,
 _hidden int libxl__resolve_domid(libxl__gc *gc, const char *name,
                                  uint32_t *domid);
 
-_hidden int libxl__domain_set_device_model(libxl__gc *gc,
-                                           libxl_domain_config *d_config);
 /*
  * For each aggregate type which can be used as an input we provide:
  *
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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