[pve-devel] [PATCH] add spicexpi button console
Alexandre Derumier
aderumier at odiso.com
Tue Jun 25 02:54:42 CEST 2013
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 | 23 ++++++++++++++++++++++-
2 files changed, 26 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..3bbc557 100644
--- a/www/manager/qemu/Config.js
+++ b/www/manager/qemu/Config.js
@@ -133,13 +133,34 @@ 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.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