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

[Ovirt-devel] [PATCH] use vinagre launcher plugin for VM console access



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 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>
-- 
1.5.4.1


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