[pve-devel] [PATCH 2/2] add embedded qemu novnc console

Alexandre Derumier aderumier at odiso.com
Fri Jun 26 11:25:09 CEST 2015


Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 www/manager/Makefile        |  1 +
 www/manager/qemu/Config.js  |  8 ++++++++
 www/manager/qemu/Console.js | 38 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 47 insertions(+)
 create mode 100644 www/manager/qemu/Console.js

diff --git a/www/manager/Makefile b/www/manager/Makefile
index 05eee89..7f2acde 100644
--- a/www/manager/Makefile
+++ b/www/manager/Makefile
@@ -115,6 +115,7 @@ JSSRC= 				                 	\
 	window/Migrate.js				\
 	window/MigrateAll.js				\
 	qemu/Monitor.js					\
+	qemu/Console.js					\
 	qemu/Summary.js					\
 	qemu/OSTypeEdit.js				\
 	qemu/ProcessorEdit.js				\
diff --git a/www/manager/qemu/Config.js b/www/manager/qemu/Config.js
index 1d1c8a2..f3882bf 100644
--- a/www/manager/qemu/Config.js
+++ b/www/manager/qemu/Config.js
@@ -178,6 +178,14 @@ Ext.define('PVE.qemu.Config', {
 	}
 
 	if (caps.vms['VM.Console']) {
+	    me.items.push({
+		title: gettext('Console'),
+		itemId: 'console',
+		xtype: 'pveQemuConsole'
+	    });
+	}
+
+	if (caps.vms['VM.Console']) {
 	    me.items.push([
 		{
 		    xtype: 'pveFirewallPanel',
diff --git a/www/manager/qemu/Console.js b/www/manager/qemu/Console.js
new file mode 100644
index 0000000..376e3fa
--- /dev/null
+++ b/www/manager/qemu/Console.js
@@ -0,0 +1,38 @@
+Ext.define('PVE.qemu.Console', {
+    extend: 'Ext.panel.Panel',
+
+    alias: 'widget.pveQemuConsole',
+
+    initComponent : function() {
+	var me = this;
+
+	var nodename = me.pveSelNode.data.node;
+	if (!nodename) {
+	    throw "no node name specified";
+	}
+
+	var vmid = me.pveSelNode.data.vmid;
+	if (!vmid) {
+	    throw "no VM ID specified";
+	}
+
+	var myid = "vncconsole";
+
+	var box = Ext.create('widget.uxiframe', {
+		    id: myid
+		});
+
+	Ext.apply(me, {
+	    layout: { type: 'fit' },
+	    border: false,
+	    items: box,
+	    listeners: {
+		show: function() {
+		    box.load('/?console=kvm&novnc=1&vmid='+ vmid + '&node=' + nodename + '&resize=scale');
+		}
+	    }
+	});		
+
+	me.callParent();
+    }
+});
-- 
2.1.4




More information about the pve-devel mailing list