[pve-devel] [PATCH manager 3/3] ui/vnc: reload IFrame-embedded noVNC on VM startup
Stefan Reiter
s.reiter at proxmox.com
Wed Dec 18 13:19:50 CET 2019
Avoids having to do the 'Console' -> 'Summary' -> 'Console' dance
everytime the VM is started and the Console window is currently open.
Signed-off-by: Stefan Reiter <s.reiter at proxmox.com>
---
www/manager6/VNCConsole.js | 6 ++++++
www/manager6/qemu/Config.js | 11 +++++++++++
2 files changed, 17 insertions(+)
diff --git a/www/manager6/VNCConsole.js b/www/manager6/VNCConsole.js
index 758b6839..039c9687 100644
--- a/www/manager6/VNCConsole.js
+++ b/www/manager6/VNCConsole.js
@@ -57,6 +57,12 @@ Ext.define('PVE.noVncConsole', {
me.on('afterrender', function() {
me.focus();
});
+ },
+
+ reloadConsole: function() {
+ // reload IFrame content to forcibly reconnect VNC/xterm.js to VM
+ var box = this.down();
+ box.getWin().location.reload();
}
});
diff --git a/www/manager6/qemu/Config.js b/www/manager6/qemu/Config.js
index 58a1568c..8c15dadb 100644
--- a/www/manager6/qemu/Config.js
+++ b/www/manager6/qemu/Config.js
@@ -365,6 +365,7 @@ Ext.define('PVE.qemu.Config', {
me.callParent();
+ var prevQmpstatus = 'unknown';
me.mon(me.statusStore, 'load', function(s, records, success) {
var status;
var qmpstatus;
@@ -412,6 +413,16 @@ Ext.define('PVE.qemu.Config', {
shutdownBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status !== 'running');
me.down('#removeBtn').setDisabled(!caps.vms['VM.Allocate'] || status !== 'stopped');
consoleBtn.setDisabled(template);
+
+ if (['prelaunch', 'stopped', 'suspended'].indexOf(prevQmpstatus) !== -1
+ && qmpstatus === 'running') {
+ var con = me.down('#console');
+ if (con) {
+ con.reloadConsole();
+ }
+ }
+
+ prevQmpstatus = qmpstatus;
});
me.on('afterrender', function() {
--
2.20.1
More information about the pve-devel
mailing list