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

Re: [Xen-devel] [PATCH v1 01/12] libxl/hotplug: add support for getting domid



On Fri, 2013-11-01 at 18:42 +0000, Ian Jackson wrote:
> Roger Pau Monne writes ("[PATCH v1 01/12] libxl/hotplug: add support for 
> getting domid"):
> > This patch writes Dom0 domid on xenstore (like it's done for other
> > guests), and adds a libxl helper function to fetch that domid from
> > xenstore.
> > 
> > Signed-off-by: Roger Pau Monnà <roger.pau@xxxxxxxxxx>
> > Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
> > Cc: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
> 
> Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>

I applied this, dropping the xencommons change which already happened.
Here is what went in:

commit d6bc83a531e4cfdd29da95afa992b95be8316080
Author: Roger Pau Monne <roger.pau@xxxxxxxxxx>
Date:   Wed Oct 2 11:24:23 2013 +0200

    libxl/hotplug: add support for getting domid
    
    This patch writes Dom0 domid on xenstore (like it's done for other
    guests), and adds a libxl helper function to fetch that domid from
    xenstore.
    
    Signed-off-by: Roger Pau Monnà <roger.pau@xxxxxxxxxx>
    Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
    Acked-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
    [ ijc -- dropped xencommons hunk, same change was made independently
      in 02ebea7768fe ]

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index bede011..0f0f56c 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -1692,6 +1692,23 @@ int libxl_vncviewer_exec(libxl_ctx *ctx, uint32_t domid, 
int autopass)
     return ERROR_FAIL;
 }
 
+int libxl__get_domid(libxl__gc *gc, uint32_t *domid)
+{
+    int rc;
+    const char *xs_domid;
+
+    rc = libxl__xs_read_checked(gc, XBT_NULL, DOMID_XS_PATH, &xs_domid);
+    if (rc || !xs_domid) {
+        rc = rc ? rc : ERROR_FAIL;
+        goto out;
+    }
+
+    *domid = atoi(xs_domid);
+
+out:
+    return rc;
+}
+
 
/******************************************************************************/
 
 /* generic callback for devices that only need to set ao_complete */
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 4f92522..4729566 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -101,6 +101,7 @@
 #define STUBDOM_SPECIAL_CONSOLES 3
 #define TAP_DEVICE_SUFFIX "-emu"
 #define DISABLE_UDEV_PATH "libxl/disable_udev"
+#define DOMID_XS_PATH "domid"
 
 #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
 
@@ -978,6 +979,8 @@ _hidden const char *libxl__device_nic_devname(libxl__gc *gc,
                                               uint32_t devid,
                                               libxl_nic_type type);
 
+_hidden int libxl__get_domid(libxl__gc *gc, uint32_t *domid);
+
 /*
  * libxl__ev_devstate - waits a given time for a device to
  * reach a given state.  Follows the libxl_ev_* conventions.



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

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