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

[Xen-devel] [PATCH] libxl: make libxl_vncviewer_exec work with stubdom



The xenstore path to look at when stubdom is in used is different. Libxl
should look at stubdom path instead.

Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 tools/libxl/libxl.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index 22bbc29..fb98043 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -1921,6 +1921,7 @@ int libxl_vncviewer_exec(libxl_ctx *ctx, uint32_t domid, 
int autopass)
     GC_INIT(ctx);
     const char *vnc_port;
     const char *vnc_listen = NULL, *vnc_pass = NULL;
+    uint32_t stubdom_id, vnc_domid = domid;
     int port = 0, autopass_fd = -1;
     char *vnc_bin, *args[] = {
         "vncviewer",
@@ -1929,11 +1930,19 @@ int libxl_vncviewer_exec(libxl_ctx *ctx, uint32_t 
domid, int autopass)
         NULL,
     };
 
+    stubdom_id = libxl_get_stubdom_id(ctx, domid);
+    if (stubdom_id != 0)
+        vnc_domid = stubdom_id;
+
     vnc_port = libxl__xs_read(gc, XBT_NULL,
                             libxl__sprintf(gc,
-                            "/local/domain/%d/console/vnc-port", domid));
+                            "/local/domain/%d/console/vnc-port", vnc_domid));
     if (!vnc_port) {
-        LOG(ERROR, "Cannot get vnc-port of domain %d", domid);
+        if (stubdom_id != 0)
+            LOG(ERROR, "Cannot get vnc-port of domain %d (stubdom %d)",
+                domid, stubdom_id);
+        else
+            LOG(ERROR, "Cannot get vnc-port of domain %d", domid);
         goto x_fail;
     }
 
@@ -1941,12 +1950,12 @@ int libxl_vncviewer_exec(libxl_ctx *ctx, uint32_t 
domid, int autopass)
 
     vnc_listen = libxl__xs_read(gc, XBT_NULL,
                                 libxl__sprintf(gc,
-                            "/local/domain/%d/console/vnc-listen", domid));
+                            "/local/domain/%d/console/vnc-listen", vnc_domid));
 
     if ( autopass )
         vnc_pass = libxl__xs_read(gc, XBT_NULL,
                                   libxl__sprintf(gc,
-                            "/local/domain/%d/console/vnc-pass", domid));
+                            "/local/domain/%d/console/vnc-pass", vnc_domid));
 
     if ( NULL == vnc_listen )
         vnc_listen = "localhost";
-- 
2.1.4


_______________________________________________
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®.