[pve-devel] [PATCH manager] merge cores, cpulimit and cpuunits for containers

Dominik Csapak d.csapak at proxmox.com
Fri Apr 6 13:03:57 CEST 2018


like we do for qemu vms

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/lxc/Resources.js | 41 +++++++++++++++++++++++------------------
 1 file changed, 23 insertions(+), 18 deletions(-)

diff --git a/www/manager6/lxc/Resources.js b/www/manager6/lxc/Resources.js
index c4ae2db8..676ad340 100644
--- a/www/manager6/lxc/Resources.js
+++ b/www/manager6/lxc/Resources.js
@@ -59,32 +59,37 @@ Ext.define('PVE.lxc.RessourceView', {
 		defaultValue: '',
 		tdCls: 'pve-itype-icon-processor',
 		renderer: function(value) {
-		    if (value) { return value; }
-		    return gettext('unlimited');
-		}
-	    },
-	    cpulimit: {
-		header: gettext('CPU limit'),
-		editor: caps.vms['VM.Config.CPU'] ? 'PVE.lxc.CPUEdit' : undefined,
-		defaultValue: 0,
-		tdCls: 'pve-itype-icon-processor',
-		renderer: function(value) {
-		    if (value > 0) { return value; }
-		    return gettext('unlimited');
+		    var cpulimit = me.getObjectValue('cpulimit');
+		    var cpuunits = me.getObjectValue('cpuunits');
+		    var res;
+		    if (value) {
+			res = value;
+		    } else {
+			res = gettext('unlimited');
+		    }
+
+		    if (cpulimit) {
+			res += ' [cpulimit=' + cpulimit + ']';
+		    }
+
+		    if (cpuunits) {
+			res += ' [cpuunits=' + cpuunits + ']';
+		    }
+		    return res;
 		}
 	    },
-	    cpuunits: {
-		header: gettext('CPU units'),
-		editor: caps.vms['VM.Config.CPU'] ? 'PVE.lxc.CPUEdit' : undefined,
-		defaultValue: 1024,
-		tdCls: 'pve-itype-icon-processor'
-	    },
 	    rootfs: {
 		header: gettext('Root Disk'),
 		defaultValue: Proxmox.Utils.noneText,
 		editor: mpeditor,
 		tdCls: 'pve-itype-icon-storage'
 	    },
+	    cpulimit: {
+		visible: false
+	    },
+	    cpuunits: {
+		visible: false
+	    },
 	    unprivileged: {
 		visible: false
 	    }
-- 
2.11.0





More information about the pve-devel mailing list