Bob Kåres homepage

Samu XenServer/XCP management application

Having started using Citrix XenServer at work I started looking at management tools that can run on an operating system I use (that is something other than windows). Things like xvp and openxencenter look promising, but there were significant problems with both. For example I couldn't get the java applet in xvp to start, and openxencenter crashed fairly frequently, at least when doing something other than _very_ basic stuff.

So I started looking into easier ways to get a console to a VM and stumbled over the awesomely cool noVNC project. I just couldn't find anybody who had integrated it in a reasonably sized management app for the XenServer API.

Thus the project started. We'll see what it ends up being in the end

Version 0.0.2, a start

I've gotten started on this, check out the code at gitorious

Haven't written any installation instructions yet, contact me if you want to test it and I'll help you get it set up

Version 0.0.1, the proof of concept

To get a console session to a host or VM in XenServer you need to do a few calls to the API and then do an almost-HTTP call before starting to forward frames to the VNC client. It's documented in the XenServer SDK documentation, and there's an example in Java that shed some light on the details

So, using wsproxy from noVNC, the xmlrpc client from xmlrpc-c, the xe utility and some very ugly scripting, here's how I got a VNC connection going one night after looking through the aforementioned documentation

WARNING: Sensitive souls please look away

$ ssh root@xenserverhost xe console-list # then manually saved the OpaqueRef from that and put it in a file called console
$ xmlrpc http://xenserverhost session.login_with_password root supersecretpassword # then saved the OpaqueRef from that in a file called session
$ nc -l -p 5901 -c '( /bin/echo -ne "CONNECT /console?ref="`cat console`" HTTP/1.1\r\nHost: xenserverhost\r\nCookie: session_id="`cat session`"\r\n\r\n"; cat ) | tee /dev/stderr | nc xenserverhost 80 | tee fromxen | perl -e "\$|=1; my \$header=1; while( sysread(*STDIN,\$_,4096) != 0 ){ warn q{read: }.\$_; if( \$header ){ if( /^RFB/ ){\$header=0} else { next } } warn q{forwarding: }.\$_; print; }"'
# Meanwhile, in a different console:
$ ./utils/launch.sh --vnc localhost:5901

And what do you know, it worked! So now it's time to write something more proper