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

[Xen-API] noVNC and consoles from XAPI



Hi guys,

Xen-Orchestra team reporting ;)


We are experiencing some difficulties to get VNC consoles from XAPI
witn noVNC. We try to get some inspiration from XAC project and other
resources on the web [1], but without any success. The documentation
is quite unclear about the HTTP Connect [2], because despite the steps
we followed, we've got "strange" errors.

Our code is fairly simple by the way [3], but we've got "Error during
WebSocket handshake: Sec-WebSocket-Protocol mismatch". I think we miss
something with the HTTP connect step, but XAC is pretty similar to our
code, and it seems to connect directly VNC console like us.

Important thing to note: we aren't executing XO on the XAPI host. And
we are testing this XenServer's hosts (6.2)

If you have any clue, It can really help us to speed up release date for XO :)


Thanks,


Olivier.



[1] : 
http://olivier.monaco.free.fr/techblog/index.php/2009/10/03/access-vnc-console-of-a-citrix-xen-vm-using-xen-sdk/
[2] : 
http://community.citrix.com/display/xs/XenServer+Software+Development+Kit+Guide#XenServerSoftwareDevelopmentKitGuide-6.1.1.%26nbsp%3BRetrievingVNCconsolesviatheAPI
[3] : important stuff is between lines 636 to 687 ->
https://github.com/vatesfr/xo-web/blob/web-app/public/js/xo.js

Condensed version:
------
        var VMConsoleView = ItemView.extend({
                'template': '#tpl-vm-console',
                'initialize': function () {
                        var view = this;
                        var vm_console = 
_.findWhere(this.model.get('consoles'), {
                                'protocol': 'rfb',
                        });
                        // @todo Comment.
                        var parse_url = function (url) {
                                var a = window.document.createElement('a');
                                a.href = url;
                                return {
                                        'host': a.hostname,
                                        'port': a.port || ('https:' === 
a.protocol) ? 443 :80,
                                        'path': a.pathname,
                                        'query': a.search,
                                };
                        };
                        var url = parse_url(vm_console.location);
                        var pool = app.pools.get(this.model.get('pool_uuid'));
                        url.query += '&session_id='+ pool.get('sessionId');
                        console.log(url);
                        view.on('dom:refresh', function () {
                                view.rfb = new RFB({
                                        // Options.
                                        'encrypt': (443 === url.port),
                                        'target': view.$('canvas')[0],
                                        // Callbacks.
                                        'onPasswordRequired': function (rfb) {
                                                
rfb.sendPassword(window.prompt('password:'));
                                        },
                                        'onUpdateState': function () {
                                                console.log(arguments);
                                        },
                                });
                                view.rfb.connect(
                                        url.host,
                                        url.port,
                                        '',
                                        url.path.substr(1) + url.query
                                );
                        });
                },
        });
---------

_______________________________________________
Xen-api mailing list
Xen-api@xxxxxxxxxxxxx
http://lists.xen.org/cgi-bin/mailman/listinfo/xen-api


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.