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

Thomas Lamprecht t.lamprecht at proxmox.com
Tue Oct 17 11:48:04 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>
Acked-By: Dominik Csapak <d.csapak 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 dd3d645a..d21d6bd0 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);
@@ -161,11 +159,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 208c3580..910f63a4 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