libxl/libxl_dm.c: Enable websocket functionality
PATCH 1/1 libxl/libxl_dm.c: Enable websocket functionality
Hi all,
I have been testing the Xen 4.6.0 packages - however there is no way that I have found to enable websocket support in any of the xen / qemu configuration files.
The only way that I have been able to do this is with the following patch - which works perfectly for my use case on a CentOS 6.x derived system:
-------------------------------------
diff -uNr xen-4.6.0.original/tools/libxl/libxl_dm.c xen-4.6.0.modified/tools/libxl/libxl_dm.c
--- xen-4.6.0.original/tools/libxl/libxl_dm.c 2015-10-06
01:33:39.000000000 +1100
+++ xen-4.6.0.modified/tools/libxl/libxl_dm.c 2016-01-29
08:50:18.860371704 +1100
@@ -440,11 +440,11 @@
}
vncarg = vnc->listen;
} else {
- vncarg = libxl__sprintf(gc, "%s:%d", vnc->listen,
+ vncarg = libxl__sprintf(gc,
"%s:%d,websocket,x509=/etc/pki/xen", vnc->listen,
vnc->display);
}
} else- vncarg = libxl__sprintf(gc, "127.0.0.1:%d", vnc->display);
+ vncarg = libxl__sprintf(gc,
"127.0.0.1:%d,websocket,x509=/etc/pki/xen", vnc->display);
if (vnc->passwd && vnc->passwd[0]) {
vncarg = libxl__sprintf(gc, "%s,password", vncarg);
@@ -806,11 +806,11 @@
}
vncarg = vnc->listen;
} else {
- vncarg = libxl__sprintf(gc, "%s:%d", vnc->listen,
+ vncarg = libxl__sprintf(gc,
"%s:%d,websocket,x509=/etc/pki/xen", vnc->listen,
vnc->display);
}
} else- vncarg = libxl__sprintf(gc, "127.0.0.1:%d", vnc->display);
+ vncarg = libxl__sprintf(gc,
"127.0.0.1:%d,websocket,x509=/etc/pki/xen", vnc->display);
if (vnc->passwd && vnc->passwd[0]) {
vncarg = libxl__sprintf(gc, "%s,password", vncarg);-------------------------------------
This however introduces 2 hard-coded items:
- Websocket will be enabled each time VNC is enabled.
- x509 certificate path
By default, the websocket port mirrors the vnc port = so vnc port = 5900, then websocket port = 5700 and so on.
A better solution however in my mind would be to store the websocket & x509 path in the .cfg file for each virtual machine:
-------------------------------------
vnc=1
vncconsole=1
vnclisten='0.0.0.0'
vncpasswd='abcd1234'
vncdisplay=0
websocket=1 <- where 0 = disabled, 1 = enabled
x509={path} <- File system path to x509 files to cater for OS
system variance or user preference, would also allow for different certificates per websocket connection if required
-------------------------------------
Best regards,
Alex
Quoted 2 lines · Alex Braunegg
A better solution however in my mind would be to store the websocket & x509 path in the .cfg file for each virtual machine:
Correct. This would involve adding the appropriate fields to the struct(s) in tools/libxl/libxl_types.idl, populating them from the xl cfg parser (xl_cmdimple.c) and obeying them in the code you have patched above.
Please also see http://wiki.xen.org/wiki/Submitting_Xen_Patches for guidance on submitting patches to Xen, in particular the requirement for a Signed-off-by (and what that means).
Thanks,
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel