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

[Xen-devel] [PATCH 18/20] tools/libxl: Plumb domain_create_state down into libxl__build_pre()



To fix CPUID handling, libxl__build_pre() is going to have to distinguish
between a brand new VM vs one which is being migrated-in/resumed.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: Ian Jackson <Ian.Jackson@xxxxxxxxxx>
CC: Wei Liu <wl@xxxxxxx>
CC: Anthony PERARD <anthony.perard@xxxxxxxxxx>

The data handling is completely chaotic, but I can't find a less bad way of
doing this.  It really doesn't help that DCS is the superset contining
domain_{build,create}_config and domain_build_state, rather than being
symetric with its similarly named counterparts.

Suggestions welcome.
---
 tools/libxl/libxl_create.c   | 16 ++++++++--------
 tools/libxl/libxl_dm.c       |  5 +++--
 tools/libxl/libxl_dom.c      |  4 +++-
 tools/libxl/libxl_internal.h | 11 ++++-------
 4 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index fdc76917dc..a8fa4ca11b 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -431,17 +431,17 @@ static void init_console_info(libxl__gc *gc,
        Only 'channels' when mapped to consoles have a string name. */
 }
 
-int libxl__domain_build(libxl__gc *gc,
-                        libxl_domain_config *d_config,
-                        uint32_t domid,
-                        libxl__domain_build_state *state)
+int libxl__domain_build(libxl__gc *gc, uint32_t domid,
+                        libxl__domain_create_state *dcs)
 {
+    libxl_domain_config *d_config = dcs->guest_config;
     libxl_domain_build_info *const info = &d_config->b_info;
+    libxl__domain_build_state *state = &dcs->build_state;
     char **vments = NULL, **localents = NULL;
     struct timeval start_time;
     int i, ret;
 
-    ret = libxl__build_pre(gc, domid, d_config, state);
+    ret = libxl__build_pre(gc, domid, dcs);
     if (ret)
         goto out;
 
@@ -1218,7 +1218,7 @@ static void domcreate_bootloader_done(libxl__egc *egc,
     dcs->sdss.callback = domcreate_devmodel_started;
 
     if (restore_fd < 0 && dcs->domid_soft_reset == INVALID_DOMID) {
-        rc = libxl__domain_build(gc, d_config, domid, state);
+        rc = libxl__domain_build(gc, domid, dcs);
         domcreate_rebuild_done(egc, dcs, rc);
         return;
     }
@@ -1245,7 +1245,7 @@ static void domcreate_bootloader_done(libxl__egc *egc,
         goto out;
     }
 
-    rc = libxl__build_pre(gc, domid, d_config, state);
+    rc = libxl__build_pre(gc, domid, dcs);
     if (rc)
         goto out;
 
@@ -1567,7 +1567,7 @@ static void domcreate_launch_dm(libxl__egc *egc, 
libxl__multidev *multidev,
 
         dcs->sdss.dm.guest_domid = domid;
         if (libxl_defbool_val(d_config->b_info.device_model_stubdomain))
-            libxl__spawn_stub_dm(egc, &dcs->sdss);
+            libxl__spawn_stub_dm(egc, dcs);
         else
             libxl__spawn_local_dm(egc, &dcs->sdss.dm);
 
diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index dac1b8ddb8..b595dc03b3 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -2094,8 +2094,9 @@ char *libxl__stub_dm_name(libxl__gc *gc, const char 
*guest_name)
     return GCSPRINTF("%s-dm", guest_name);
 }
 
-void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_state *sdss)
+void libxl__spawn_stub_dm(libxl__egc *egc, libxl__domain_create_state *dcs)
 {
+    libxl__stub_dm_spawn_state *sdss = &dcs->sdss;
     STATE_AO_GC(sdss->dm.spawn.ao);
     libxl_ctx *ctx = libxl__gc_owner(gc);
     int ret;
@@ -2194,7 +2195,7 @@ void libxl__spawn_stub_dm(libxl__egc *egc, 
libxl__stub_dm_spawn_state *sdss)
     if (ret)
         goto out;
     uint32_t dm_domid = sdss->pvqemu.guest_domid;
-    ret = libxl__domain_build(gc, dm_config, dm_domid, stubdom_state);
+    ret = libxl__domain_build(gc, dm_domid, dcs);
     if (ret)
         goto out;
 
diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c
index 573c63692b..01aefa6ce4 100644
--- a/tools/libxl/libxl_dom.c
+++ b/tools/libxl/libxl_dom.c
@@ -244,9 +244,11 @@ static int numa_place_domain(libxl__gc *gc, uint32_t domid,
 }
 
 int libxl__build_pre(libxl__gc *gc, uint32_t domid,
-              libxl_domain_config *d_config, libxl__domain_build_state *state)
+                     libxl__domain_create_state *dcs)
 {
+    libxl_domain_config *d_config = dcs->guest_config;
     libxl_domain_build_info *const info = &d_config->b_info;
+    libxl__domain_build_state *state = &dcs->build_state;
     libxl_ctx *ctx = libxl__gc_owner(gc);
     char *xs_domid, *con_domid;
     int rc;
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index b5adbfe4b7..16dc02e8a3 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -1389,8 +1389,7 @@ _hidden void 
libxl__domain_build_state_init(libxl__domain_build_state *s);
 _hidden void libxl__domain_build_state_dispose(libxl__domain_build_state *s);
 
 _hidden int libxl__build_pre(libxl__gc *gc, uint32_t domid,
-              libxl_domain_config * const d_config,
-              libxl__domain_build_state *state);
+                             libxl__domain_create_state *dcs);
 _hidden int libxl__build_post(libxl__gc *gc, uint32_t domid,
                libxl_domain_build_info *info, libxl__domain_build_state *state,
                char **vms_ents, char **local_ents);
@@ -1960,10 +1959,8 @@ _hidden int libxl__domain_make(libxl__gc *gc,
                                libxl__domain_build_state *state,
                                uint32_t *domid);
 
-_hidden int libxl__domain_build(libxl__gc *gc,
-                                libxl_domain_config *d_config,
-                                uint32_t domid,
-                                libxl__domain_build_state *state);
+_hidden int libxl__domain_build(libxl__gc *gc, uint32_t domid,
+                                libxl__domain_create_state *dcs);
 
 /* for device model creation */
 _hidden const char *libxl__domain_device_model(libxl__gc *gc,
@@ -4114,7 +4111,7 @@ typedef struct {
     libxl__xswait_state xswait;
 } libxl__stub_dm_spawn_state;
 
-_hidden void libxl__spawn_stub_dm(libxl__egc *egc, 
libxl__stub_dm_spawn_state*);
+_hidden void libxl__spawn_stub_dm(libxl__egc *egc, libxl__domain_create_state 
*dcs);
 
 _hidden char *libxl__stub_dm_name(libxl__gc *gc, const char * guest_name);
 
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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