[pve-devel] [PATCH manager 2/2] add 'max_{relocate, restart}' fields to UI

Thomas Lamprecht t.lamprecht at proxmox.com
Mon Oct 31 11:07:00 CET 2016


The 'max_reloacte' and 'max_restart' properties can be set via CLI
and API for about a year, expose them to the user alsow via web
interface

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 www/manager6/ha/ResourceEdit.js | 33 ++++++++++++++++++++++++++++++++-
 www/manager6/ha/Resources.js    | 21 ++++++++++++++++++++-
 2 files changed, 52 insertions(+), 2 deletions(-)

diff --git a/www/manager6/ha/ResourceEdit.js b/www/manager6/ha/ResourceEdit.js
index e3ba286..83db647 100644
--- a/www/manager6/ha/ResourceEdit.js
+++ b/www/manager6/ha/ResourceEdit.js
@@ -25,7 +25,20 @@ Ext.define('PVE.ha.VMResourceInputPanel', {
 	    values.state = 'disabled';
 	}
 	delete values.enable;
-	
+
+	if (values.max_restart == '1') {
+	    if (!me.create) {
+		values['delete'] = values['delete'] ? values['delete'] + ',max_restart' : 'max_restart';
+	    }
+	    delete values.max_restart;
+	}
+	if (values.max_relocate == '1') {
+	    if (!me.create) {
+		values['delete'] = values['delete'] ? values['delete'] + ',max_relocate' : 'max_relocate';
+	    }
+	    delete values.max_relocate;
+	}
+
 	return values;
     },
 
@@ -48,6 +61,24 @@ Ext.define('PVE.ha.VMResourceInputPanel', {
 		value: me.vmid,
 		loadNextFreeVMID: false,
 		validateExists: true
+	    },
+	    {
+		xtype: 'numberfield',
+		name: 'max_restart',
+		fieldLabel: gettext('Max. Restart'),
+		value: 1,
+		minValue: 0,
+		maxValue: 10,
+		allowBlank: false
+	    },
+	    {
+		xtype: 'numberfield',
+		name: 'max_relocate',
+		fieldLabel: gettext('Max. Relocate'),
+		value: 1,
+		minValue: 0,
+		maxValue: 10,
+		allowBlank: false
 	    }
 	];
 
diff --git a/www/manager6/ha/Resources.js b/www/manager6/ha/Resources.js
index b40c99b..af9775d 100644
--- a/www/manager6/ha/Resources.js
+++ b/www/manager6/ha/Resources.js
@@ -124,6 +124,24 @@ Ext.define('PVE.ha.ResourcesView', {
 		    dataIndex: 'state'
 		},
 		{
+		    header: gettext('Max. Restart'),
+		    width: 100,
+		    sortable: true,
+		    renderer: function(v) {
+			return v || '1';
+		    },
+		    dataIndex: 'max_restart'
+		},
+		{
+		    header: gettext('Max. Relocate'),
+		    width: 100,
+		    sortable: true,
+		    renderer: function(v) {
+			return v || '1';
+		    },
+		    dataIndex: 'max_relocate'
+		},
+		{
 		    header: gettext('Group'),
 		    width: 200,
 		    sortable: true,
@@ -157,7 +175,8 @@ Ext.define('PVE.ha.ResourcesView', {
     Ext.define('pve-ha-resources', {
 	extend: 'Ext.data.Model',
 	fields: [ 
-	  'sid', 'state', 'digest', 'errors', 'group', 'comment'
+	  'sid', 'state', 'digest', 'errors', 'group', 'comment',
+	  'max_restart', 'max_relocate',
 	],
 	idProperty: 'sid'
     });
-- 
2.1.4





More information about the pve-devel mailing list