diff --git a/src/sunstone/models/SunstoneServer.rb b/src/sunstone/models/SunstoneServer.rb index 8f0d0e69ab..60616aa6b6 100644 --- a/src/sunstone/models/SunstoneServer.rb +++ b/src/sunstone/models/SunstoneServer.rb @@ -246,7 +246,7 @@ class SunstoneServer # and serving as proxy for the VM host on the configured VNC port. # TODO - This path is in public... begin - pipe = IO.popen("#{File.dirname(__FILE__)}/../public/vendor/noVNC/utils/launch.sh --listen #{proxy_port} --vnc #{host}:#{vnc_port}") + pipe = IO.popen("#{File.dirname(__FILE__)}/../lib/vendor/noVNC/utils/launch.sh --listen #{proxy_port} --vnc #{host}:#{vnc_port}") rescue Exception => e error = Error.new(e.message) return [500, error.to_json] diff --git a/src/sunstone/public/js/plugins/vms-tab.js b/src/sunstone/public/js/plugins/vms-tab.js index 8417fefe36..a184d75b1e 100644 --- a/src/sunstone/public/js/plugins/vms-tab.js +++ b/src/sunstone/public/js/plugins/vms-tab.js @@ -15,6 +15,12 @@ /* -------------------------------------------------------------------------- */ /*Virtual Machines tab plugin*/ +var INCLUDE_URI = "vendor/noVNC/include/"; +function loadVNC(){ + var script = ''; + document.write(script); +} +loadVNC(); var vms_tab_content = '
\ diff --git a/src/sunstone/sunstone-server.rb b/src/sunstone/sunstone-server.rb index 912a71f982..83a01f550d 100755 --- a/src/sunstone/sunstone-server.rb +++ b/src/sunstone/sunstone-server.rb @@ -172,7 +172,7 @@ post '/vm/:id/stopvnc' do return [403, OpenNebula::Error.new(msg).to_json] end - rc = @SunstoneServer.stopvnc(vm_id, vnc_hash[vm_id]) + rc = @SunstoneServer.stopvnc(vm_id, vnc_hash[vm_id][:pipe]) if rc[0] == 200 session['vnc'].delete(vm_id) end @@ -188,14 +188,17 @@ post '/vm/:id/startvnc' do if !vnc_hash session['vnc']= {} elsif vnc_hash[vm_id] - msg = "There is a VNC server running for this VM" - return [403, OpenNebula::Error.new(msg).to_json] + #return existing information + info = vnc_hash[vm_id].clone + info.delete(:pipe) + + return [200, info.to_json] end rc = @SunstoneServer.startvnc(vm_id) if rc[0] == 200 info = rc[1] - session['vnc'][vm_id] = info[:pipe] + session['vnc'][vm_id] = info.clone info.delete(:pipe) [200, info.to_json] diff --git a/src/sunstone/templates/index.html b/src/sunstone/templates/index.html index 4f09996395..ba030497ea 100644 --- a/src/sunstone/templates/index.html +++ b/src/sunstone/templates/index.html @@ -16,7 +16,7 @@ - +