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

2015-10-22 Thread Ian Campbell
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.


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


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

2015-10-21 Thread Wei Liu
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 
---
 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@lists.xen.org
http://lists.xen.org/xen-devel