All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libxl: make libxl_vncviewer_exec work with stubdom
@ 2015-10-21 13:07 Wei Liu
  2015-10-22 16:31 ` Ian Campbell
  0 siblings, 1 reply; 2+ messages in thread
From: Wei Liu @ 2015-10-21 13:07 UTC (permalink / raw)
  To: Xen-devel; +Cc: Wei Liu, Ian Jackson, Ian Campbell, Stefano Stabellini

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@citrix.com>
---
 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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] libxl: make libxl_vncviewer_exec work with stubdom
  2015-10-21 13:07 [PATCH] libxl: make libxl_vncviewer_exec work with stubdom Wei Liu
@ 2015-10-22 16:31 ` Ian Campbell
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Campbell @ 2015-10-22 16:31 UTC (permalink / raw)
  To: Wei Liu, Xen-devel; +Cc: Ian Jackson, Stefano Stabellini

On Wed, 2015-10-21 at 14:07 +0100, Wei Liu wrote:
> The xenstore path to look at when stubdom is in used is different. Libxl
> should look at stubdom path instead.

It took me a while to work this out, so please mention that the VNC in
question is the backend corresponding to the stubdom's PVFB (into which it
writes the emulated VGA content) and that the port for that is written into
the PVFB frontend dir, i.e. on the stubdom path.

Or alternatively since semantically this is the guest's console (albiet
laundered through a stubdom) perhaps we should be writing these vnc-* keys
there instead/as well?

Either way these vnc-* keys need to be documented in docs/misc/xenstore
-paths.markdown, either directly or by a reference to pvfb.h (which would
then need to talk about them), so we know what they mean and where they
should live (which in turn may render at least half what I said above
moot).

Ian.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-10-22 16:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-21 13:07 [PATCH] libxl: make libxl_vncviewer_exec work with stubdom Wei Liu
2015-10-22 16:31 ` Ian Campbell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.