Guest VM Console Creation/Access using REST API and noVNC

Hi All, We want to access vm console by using noVNC and Rest api. We are using websocket proxy on the same machine where engine runs and we try to get the console access from the another server that is outside from this cluster. But when we try to connect the vnc_auto.html from the server using host ip, port and the password which we get from the ticket creation… it shows a Failed to connect to server (code: 1006). The following are the codes which we use to create the ticket… host,port and the password will get from the ticket and with the same details (host,port & password) we are able to connect the console using the vnc clients(TigerVNC etc.) try { var host = WebUtil.getQueryVar('host', '<?php echo $host?>'); var port = WebUtil.getQueryVar('port', '<?php echo $port?>'); var path = WebUtil.getQueryVar('path', 'websockify'); var password = '<?php echo $password?>'; if ((!host) || (!port)) { updateState('failed', "Must specify host and port in URL"); return; } rfb = new RFB({'target': $D('noVNC_canvas'), 'encrypt': WebUtil.getQueryVar('encrypt', (window.location.protocol === "https:")), 'true_color': WebUtil.getQueryVar('true_color', true), 'local_cursor': WebUtil.getQueryVar('cursor', true), 'shared': WebUtil.getQueryVar('shared', true), 'view_only': WebUtil.getQueryVar('view_only', false), 'updateState': updateState, 'onPasswordRequired': passwordRequired}); rfb.connect(host, port, password, path); }catch(e) {alert(e); Could you please check if there any issues with it and guide me how to get rid of this failed to connect error? I have attached the screen shots for further reference… -- Regards Shanil

Hi All, We are waiting for your suggestions or comments on the same. If anyone knows, please help us to sort out this issue. -- Regards Shanil On Tue, Jul 15, 2014 at 3:55 PM, Shanil S <xielesshanil@gmail.com> wrote:
Hi All,
We want to access vm console by using noVNC and Rest api. We are using websocket proxy on the same machine where engine runs and we try to get the console access from the another server that is outside from this cluster.
But when we try to connect the vnc_auto.html from the server using host ip, port and the password which we get from the ticket creation… it shows a Failed to connect to server (code: 1006).
The following are the codes which we use to create the ticket… host,port and the password will get from the ticket and with the same details (host,port & password) we are able to connect the console using the vnc clients(TigerVNC etc.)
try { var host = WebUtil.getQueryVar('host', '<?php echo $host?>'); var port = WebUtil.getQueryVar('port', '<?php echo $port?>'); var path = WebUtil.getQueryVar('path', 'websockify');
var password = '<?php echo $password?>';
if ((!host) || (!port)) { updateState('failed', "Must specify host and port in URL"); return; }
rfb = new RFB({'target': $D('noVNC_canvas'), 'encrypt': WebUtil.getQueryVar('encrypt', (window.location.protocol === "https:")), 'true_color': WebUtil.getQueryVar('true_color', true), 'local_cursor': WebUtil.getQueryVar('cursor', true), 'shared': WebUtil.getQueryVar('shared', true), 'view_only': WebUtil.getQueryVar('view_only', false), 'updateState': updateState, 'onPasswordRequired': passwordRequired}); rfb.connect(host, port, password, path); }catch(e) {alert(e);
Could you please check if there any issues with it and guide me how to get rid of this failed to connect error?
I have attached the screen shots for further reference…
-- Regards Shanil

Okay, I can give you a short design overview how you can make this work: a) client browser -> gets novnc from ovirt-engine or any other host where you host it. b) client browser(novnc) gets the ticket and path via rest api c) client browser(novnc) -> connects to websocket-proxy with the rest-api ticket and "path" (destination host where the vm is hosted) please note, that websocket-proxy must be reachable from client browser d) websocket-proxy needs a connection to the cluster and host where the vm runs, keep in mind you need to configure your display network in ovirt accordingly. I guess you just have an error in your network setup. So you need to expose at least the websocket-proxy to the client browser and this proxy must be able to reach the vm host. furthermore for passing the ticket you need a host example.com which can connect to engine and can connect to the client browser, e.g. the websocket proxy or any other machine you want to use for that. you could also expose the engine itself, but it depends on your client browser if you want to do this (security)! HTH -- Mit freundlichen Grüßen / Regards Sven Kieske Systemadministrator Mittwald CM Service GmbH & Co. KG Königsberger Straße 6 32339 Espelkamp T: +49-5772-293-100 F: +49-5772-293-333 https://www.mittwald.de Geschäftsführer: Robert Meyer St.Nr.: 331/5721/1033, USt-IdNr.: DE814773217, HRA 6640, AG Bad Oeynhausen Komplementärin: Robert Meyer Verwaltungs GmbH, HRB 13260, AG Bad Oeynhausen

Hi Sven, Thanks for your reply.. There is no network errors found in the ovirt and we are able to access the console from the ovirt panel,the only problem is we are not abel to access from the other host via API….as we don't want to use the Ovirt panel for the end users…so we use our own portal and open the console with the help of API function call….so right now we can access the console from the ovirt panel but can not from our portal. We will get the ticket details like host,port and password from the ticket api funcion call but didn't get the "path" value. Will it get it from the ticket details ? i couldn't find out any from the ticket details. -- Regards Shanil On Wed, Jul 16, 2014 at 12:34 PM, Sven Kieske <S.Kieske@mittwald.de> wrote:
Okay, I can give you a short design overview how you can make this work:
a) client browser -> gets novnc from ovirt-engine or any other host where you host it. b) client browser(novnc) gets the ticket and path via rest api c) client browser(novnc) -> connects to websocket-proxy with the rest-api ticket and "path" (destination host where the vm is hosted)
please note, that websocket-proxy must be reachable from client browser
d) websocket-proxy needs a connection to the cluster and host where the vm runs, keep in mind you need to configure your display network in ovirt accordingly.
I guess you just have an error in your network setup.
So you need to expose at least the websocket-proxy to the client browser and this proxy must be able to reach the vm host. furthermore for passing the ticket you need a host example.com which can connect to engine and can connect to the client browser, e.g. the websocket proxy or any other machine you want to use for that.
you could also expose the engine itself, but it depends on your client browser if you want to do this (security)!
HTH
-- Mit freundlichen Grüßen / Regards
Sven Kieske
Systemadministrator Mittwald CM Service GmbH & Co. KG Königsberger Straße 6 32339 Espelkamp T: +49-5772-293-100 F: +49-5772-293-333 https://www.mittwald.de Geschäftsführer: Robert Meyer St.Nr.: 331/5721/1033, USt-IdNr.: DE814773217, HRA 6640, AG Bad Oeynhausen Komplementärin: Robert Meyer Verwaltungs GmbH, HRB 13260, AG Bad Oeynhausen

----- Original Message -----
From: "Shanil S" <xielesshanil@gmail.com> To: "Sven Kieske" <S.Kieske@mittwald.de> Cc: users@ovirt.org, danken@redhat.com, asegurap@redhat.com Sent: Wednesday, July 16, 2014 11:30:32 AM Subject: Re: Guest VM Console Creation/Access using REST API and noVNC
Hi Sven,
Thanks for your reply..
There is no network errors found in the ovirt and we are able to access the console from the ovirt panel,the only problem is we are not abel to access from the other host via API….as we don't want to use the Ovirt panel for the end users…so we use our own portal and open the console with the help of API function call….so right now we can access the console from the ovirt panel but can not from our portal.
We will get the ticket details like host,port and password from the ticket api funcion call but didn't get the "path" value. Will it get it from the ticket details ? i couldn't find out any from the ticket details.
-- Regards Shanil
On Wed, Jul 16, 2014 at 12:34 PM, Sven Kieske <S.Kieske@mittwald.de> wrote:
Okay, I can give you a short design overview how you can make this work:
a) client browser -> gets novnc from ovirt-engine or any other host where you host it. b) client browser(novnc) gets the ticket and path via rest api c) client browser(novnc) -> connects to websocket-proxy with the rest-api ticket and "path" (destination host where the vm is hosted)
please note, that websocket-proxy must be reachable from client browser
d) websocket-proxy needs a connection to the cluster and host where the vm runs, keep in mind you need to configure your display network in ovirt accordingly.
I guess you just have an error in your network setup.
So you need to expose at least the websocket-proxy to the client browser and this proxy must be able to reach the vm host.
Could it be that there is some iptables rule preventing the communication?
furthermore for passing the ticket you need a host example.com which can connect to engine and can connect to the client browser, e.g. the websocket proxy or any other machine you want to use for that.
you could also expose the engine itself, but it depends on your client browser if you want to do this (security)!
HTH
-- Mit freundlichen Grüßen / Regards
Sven Kieske
Systemadministrator Mittwald CM Service GmbH & Co. KG Königsberger Straße 6 32339 Espelkamp T: +49-5772-293-100 F: +49-5772-293-333 https://www.mittwald.de Geschäftsführer: Robert Meyer St.Nr.: 331/5721/1033, USt-IdNr.: DE814773217, HRA 6640, AG Bad Oeynhausen Komplementärin: Robert Meyer Verwaltungs GmbH, HRB 13260, AG Bad Oeynhausen
participants (3)
-
Antoni Segura Puimedon
-
Shanil S
-
Sven Kieske