[pve-devel] [PATCH manager 6/7] ui: qemu: add HA manage menu item to panel

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Oct 11 12:09:46 CEST 2017


Allows to add an unmanaged VM to HA or to edit the HA settings of a
managed one.

Fixes: #1518
Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 www/manager6/ha/ResourceEdit.js |  9 +++++----
 www/manager6/qemu/Config.js     | 12 ++++++++++++
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/www/manager6/ha/ResourceEdit.js b/www/manager6/ha/ResourceEdit.js
index f57668e8..f8682985 100644
--- a/www/manager6/ha/ResourceEdit.js
+++ b/www/manager6/ha/ResourceEdit.js
@@ -6,11 +6,9 @@ Ext.define('PVE.ha.VMResourceInputPanel', {
     onGetValues: function(values) {
 	var me = this;
 
-	if (me.isCreate) {
+	if (values.vmid) {
 	    values.sid = values.vmid;
 	}
-	
-
 	delete values.vmid;
 
 	PVE.Utils.delete_if_default(values, 'group', '', me.isCreate);
@@ -160,11 +158,14 @@ Ext.define('PVE.ha.VMResourceEdit', {
 
     vmid: undefined,
     guestType: undefined,
+    isCreate: undefined,
 
     initComponent : function() {
 	var me = this;
  
-	me.isCreate = !me.vmid;
+	if (me.isCreate === undefined) {
+	    me.isCreate = !me.vmid;
+	}
 
 	if (me.isCreate) {
             me.url = '/api2/extjs/cluster/ha/resources';
diff --git a/www/manager6/qemu/Config.js b/www/manager6/qemu/Config.js
index 45c27530..f1752afb 100644
--- a/www/manager6/qemu/Config.js
+++ b/www/manager6/qemu/Config.js
@@ -106,6 +106,18 @@ Ext.define('PVE.qemu.Config', {
 		    }
 		},
 		{
+		    iconCls: 'fa fa-heartbeat ',
+		    hidden: !caps.nodes['Sys.Console'],
+		    text: gettext('Manage HA'),
+		    handler: function() {
+			var ha = me.pveSelNode.data.hastate;
+			Ext.create('PVE.ha.VMResourceEdit', {
+			    vmid: vmid,
+			    isCreate: (!ha || ha === 'unmanaged')
+			}).show();
+		    }
+		},
+		{
 		    text: gettext('Remove'),
 		    itemId: 'removeBtn',
 		    disabled: !caps.vms['VM.Allocate'],
-- 
2.11.0





More information about the pve-devel mailing list