[Ovirt-devel] [PATCH] use vinagre launcher plugin for VM console access
Hugh O. Brock
hbrock at redhat.com
Fri Aug 22 19:42:20 UTC 2008
On Fri, Aug 22, 2008 at 09:30:01PM +0200, Alan Pevec wrote:
> connects directly to the VNC port on the Node running selected VM
> needs virt-viewer-0.0.3-3ovirt1
>
> Signed-off-by: Alan Pevec <apevec at redhat.com>
> ---
> wui/src/app/controllers/vm_controller.rb | 6 ++++++
> wui/src/app/views/vm/console.rhtml | 8 ++++----
> 2 files changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/wui/src/app/controllers/vm_controller.rb b/wui/src/app/controllers/vm_controller.rb
> index a9deff5..e55ec28 100644
> --- a/wui/src/app/controllers/vm_controller.rb
> +++ b/wui/src/app/controllers/vm_controller.rb
> @@ -16,6 +16,7 @@
> # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
> # MA 02110-1301, USA. A copy of the GNU General Public License is
> # also available at http://www.gnu.org/copyleft/gpl.html.
> +require 'socket'
>
> class VmController < ApplicationController
> # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
> @@ -183,6 +184,11 @@ class VmController < ApplicationController
>
> def console
> @show_vnc_error = "Console is unavailable for VM #{@vm.description}" unless @vm.has_console
> + if @vm.host.hostname.match("priv\.ovirt\.org$")
> + @vnc_hostname = IPSocket.getaddress(@vm.host.hostname)
> + else
> + @vnc_hostname = @vm.host.hostname
> + end
> render :layout => false
> end
>
> diff --git a/wui/src/app/views/vm/console.rhtml b/wui/src/app/views/vm/console.rhtml
> index 5a853de..8724c51 100644
> --- a/wui/src/app/views/vm/console.rhtml
> +++ b/wui/src/app/views/vm/console.rhtml
> @@ -28,11 +28,11 @@
> <%else -%>
> <embed type="application/x-virt-viewer"
> hidden="1"
> - uri="qemu+tcp://<%= @vm.host.hostname%>/system"
> + uri="<%= @vnc_hostname%>:<%= @vm.vnc_port%>"
> name="<%= @vm.uuid%>">
> </embed>
> -virt-viewer started<br/>
> -hypervisor qemu+tcp://<%= @vm.host.hostname%>/system<br/>
> -virtual machine <%= @vm.uuid%> <br/>
> +Console started for virtual machine <%= @vm.uuid%> <br/>
> +host <%= @vm.host.hostname%><br/>
> +VNC port <%= @vm.vnc_port%><br/>
> <%end -%>
> </html>
Yes this is a temporary hack... but it will do what we need for this release.
ACK
--Hugh
More information about the ovirt-devel
mailing list