[pve-devel] [PATCH] add spicexpi button console v2

Alexandre Derumier aderumier at odiso.com
Tue Jun 25 15:11:23 CEST 2013


without http proxy

this is a test button, browser need spice-xpi 2.9 (git), as 2.8 don't have http connect proxy support

Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 bin/pveproxy               |    5 ++++-
 www/manager/qemu/Config.js |   24 +++++++++++++++++++++++-
 2 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/bin/pveproxy b/bin/pveproxy
index 8238721..c80fcf3 100755
--- a/bin/pveproxy
+++ b/bin/pveproxy
@@ -262,7 +262,10 @@ _EOJS
     <script type="text/javascript" src="/pve2/ext4/ext-all-debug.js"></script>
     <script type="text/javascript" src="/pve2/ext4/pvemanagerlib.js"></script>
     <script type="text/javascript">$jssrc</script>
-    
+    <embed type="application/x-spice" width="0" height="0" id="spice-xpi" />
+    <script type="text/javascript">
+	var spicexpi = document.getElementById("spice-xpi");
+    </script>
   </head>
   <body>
     <!-- Fields required for history management -->
diff --git a/www/manager/qemu/Config.js b/www/manager/qemu/Config.js
index 56fe289..182fa03 100644
--- a/www/manager/qemu/Config.js
+++ b/www/manager/qemu/Config.js
@@ -133,13 +133,35 @@ Ext.define('PVE.qemu.Config', {
 	    }
 	});
 
+	var spicexpiconsoleBtn = Ext.create('Ext.Button', {
+	    text: gettext('Spice XPI Console'),
+	    disabled: !caps.vms['VM.Console'],
+	    handler: function() {
+		PVE.Utils.API2Request({
+		    url: '/api2/extjs/nodes/' + nodename + '/qemu/' + vmid + '/spiceproxy',
+		    waitMsgTarget: me,
+		    failure: function(response, opts) {
+			me.update("Error " + response.htmlStatus);
+		    },
+		    success: function(response, opts) {
+			spicexpi.port = response.result.data.port;
+			spicexpi.hostIP = response.result.data.host;
+			//spicexpi.Proxy = response.result.data.proxy;
+			spicexpi.Password = response.result.data.password;
+			spicexpi.AdminConsole = 1;
+			spicexpi.connect();
+		    }
+		});
+	    }
+	});
+
 	var descr = vmid + " (" + (vmname ? "'" + vmname + "' " : "'VM " + vmid + "'") + ")";
 
 	Ext.apply(me, {
 	    title: Ext.String.format(gettext("Virtual Machine {0} on node {1}"), descr, "'" + nodename + "'"),
 	    hstateid: 'kvmtab',
 	    tbar: [ resumeBtn, startBtn, shutdownBtn, stopBtn, resetBtn, 
-		    removeBtn, migrateBtn, consoleBtn, spiceconsoleBtn ],
+		    removeBtn, migrateBtn, consoleBtn, spiceconsoleBtn, spicexpiconsoleBtn ],
 	    defaults: { statusStore: me.statusStore },
 	    items: [
 		{
-- 
1.7.10.4




More information about the pve-devel mailing list