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

[Xen-changelog] [xen-unstable] libxl: add libxl__spawn_confirm_offspring_startup



# HG changeset patch
# User Olaf Hering <olaf@xxxxxxxxx>
# Date 1319707409 -7200
# Node ID feee3cb40887d43e3de301324655c7655311cfbd
# Parent  62360c6aff9f7676eeea42ccd9b0e8e248cd8305
libxl: add libxl__spawn_confirm_offspring_startup

libxl__spawn_confirm_offspring_startup() is a generic version of
libxl__confirm_device_model_startup().

Use libxl__spawn_confirm_offspring_startup for device model.

Signed-off-by: Olaf Hering <olaf@xxxxxxxxx>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r 62360c6aff9f -r feee3cb40887 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c    Thu Oct 27 11:23:24 2011 +0200
+++ b/tools/libxl/libxl_dm.c    Thu Oct 27 11:23:29 2011 +0200
@@ -890,25 +890,16 @@
     return rc;
 }
 
-static int detach_device_model(libxl__gc *gc,
-                               libxl__spawner_starting *starting)
-{
-    int rc;
-    rc = libxl__spawn_detach(gc, starting->for_spawn);
-    if (starting->for_spawn)
-        free(starting->for_spawn);
-    free(starting);
-    return rc;
-}
 
 int libxl__confirm_device_model_startup(libxl__gc *gc,
                                        libxl__spawner_starting *starting)
 {
-    int detach;
-    int problem = libxl__wait_for_device_model(gc, starting->domid, "running",
-                                               starting->for_spawn, NULL, 
NULL);
-    detach = detach_device_model(gc, starting);
-    return problem ? problem : detach;
+    char *path;
+    int domid = starting->domid;
+    path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/state", domid);
+    return libxl__spawn_confirm_offspring_startup(gc,
+                                     LIBXL_DEVICE_MODEL_START_TIMEOUT,
+                                     "Device Model", path, "running", 
starting);
 }
 
 int libxl__destroy_device_model(libxl__gc *gc, uint32_t domid)
diff -r 62360c6aff9f -r feee3cb40887 tools/libxl/libxl_exec.c
--- a/tools/libxl/libxl_exec.c  Thu Oct 27 11:23:24 2011 +0200
+++ b/tools/libxl/libxl_exec.c  Thu Oct 27 11:23:29 2011 +0200
@@ -262,6 +262,30 @@
     return -1;
 }
 
+static int detach_offspring(libxl__gc *gc,
+                               libxl__spawner_starting *starting)
+{
+    int rc;
+    rc = libxl__spawn_detach(gc, starting->for_spawn);
+    if (starting->for_spawn)
+        free(starting->for_spawn);
+    free(starting);
+    return rc;
+}
+
+int libxl__spawn_confirm_offspring_startup(libxl__gc *gc,
+                                       uint32_t timeout, char *what,
+                                       char *path, char *state,
+                                       libxl__spawner_starting *starting)
+{
+    int detach;
+    int problem = libxl__wait_for_offspring(gc, starting->domid, timeout, what,
+                                               path, state,
+                                               starting->for_spawn, NULL, 
NULL);
+    detach = detach_offspring(gc, starting);
+    return problem ? problem : detach;
+}
+
 static int libxl__set_fd_flag(libxl__gc *gc, int fd, int flag)
 {
     int flags;
diff -r 62360c6aff9f -r feee3cb40887 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h      Thu Oct 27 11:23:24 2011 +0200
+++ b/tools/libxl/libxl_internal.h      Thu Oct 27 11:23:29 2011 +0200
@@ -331,6 +331,12 @@
                                                        const char *state,
                                                        void *userdata),
                                  void *check_callback_userdata);
+
+_hidden int libxl__spawn_confirm_offspring_startup(libxl__gc *gc,
+                                       uint32_t timeout, char *what,
+                                       char *path, char *state,
+                                       libxl__spawner_starting *starting);
+
   /* Logs errors.  A copy of "what" is taken.  Return values:
    *  < 0   error, for_spawn need not be detached
    *   +1   caller is the parent, must call detach on *for_spawn eventually

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
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®.