CPU&RAM overcommit ratio uI integration code
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/215621da Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/215621da Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/215621da Branch: refs/heads/master Commit: 215621daa88883dde4f09d55fde49e0bf0cd75f5 Parents: 2beb66f Author: Pranav Saxena <[email protected]> Authored: Sat Feb 16 22:01:43 2013 +0530 Committer: Pranav Saxena <[email protected]> Committed: Sat Feb 16 22:01:43 2013 +0530 ---------------------------------------------------------------------- ui/scripts/system.js | 57 +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 57 insertions(+), 0 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/215621da/ui/scripts/system.js ---------------------------------------------------------------------- diff --git a/ui/scripts/system.js b/ui/scripts/system.js index e51bf90..d76aa3e 100644 --- a/ui/scripts/system.js +++ b/ui/scripts/system.js @@ -7440,6 +7440,18 @@ validation: { required: true } }, + cpuovercommit:{ + label: 'CPU overcommit ratio', + defaultValue:'1' + + }, + + ramovercommit:{ + label: 'RAM overcommit ratio', + defaultValue:'1' + + }, + //hypervisor==VMWare begins here vCenterHost: { label: 'label.vcenter.host', @@ -7497,6 +7509,13 @@ array1.push("&podId=" + args.data.podId); var clusterName = args.data.name; + + if(args.data.cpuovercommit != "") + array1.push("&cpuovercommitratio=" + todb(args.data.cpuovercommit)); + + if(args.data.ramovercommit != "") + array1.push("&ramovercommitratio=" + todb(args.data.ramovercommit)); + if(args.data.hypervisor == "VMware") { array1.push("&username=" + todb(args.data.vCenterUsername)); array1.push("&password=" + todb(args.data.vCenterPassword)); @@ -7572,6 +7591,38 @@ }, actions: { + + edit: { + label: 'label.edit', + action: function(args) { + var array1 = []; + + if (args.data.cpuovercommitratio != "" && args.data.cpuovercommitratio > 0) + array1.push("&cpuovercommitratio=" + args.data.cpuovercommitratio); + + if (args.data.ramovercommitratio != "" && args.data.ramovercommitratio > 0) + array1.push("&ramovercommitratio=" + args.data.ramovercommitratio); + + $.ajax({ + + url: createURL("updateCluster&id=" + args.context.clusters[0].id + array1.join("")), + dataType: "json", + async: true, + success: function(json) { + var item = json.updateclusterresponse.cluster; + args.context.clusters[0].cpuovercommitratio = item.cpuovercommitratio; + args.context.clusters[0].ramovercommitratio = item.ramovercommitratio; + addExtraPropertiesToClusterObject(item); + args.response.success({ + actionFilter: clusterActionfilter, + data:item + }); + + } + }); + } + }, + enable: { label: 'label.action.enable.cluster', messages: { @@ -7741,6 +7792,8 @@ podname: { label: 'label.pod' }, hypervisortype: { label: 'label.hypervisor' }, clustertype: { label: 'label.cluster.type' }, + cpuovercommitratio:{ label: 'CPU overcommit Ratio', isEditable:true}, + ramovercommitratio:{ label: 'RAM overcommit Ratio', isEditable:true}, //allocationstate: { label: 'label.allocation.state' }, //managedstate: { label: 'Managed State' }, state: { label: 'label.state' } @@ -10407,10 +10460,14 @@ if(jsonObj.state == "Enabled") {//managed, allocation enabled allowedActions.push("unmanage"); allowedActions.push("disable"); + allowedActions.push("edit"); + } else if(jsonObj.state == "Disabled") { //managed, allocation disabled allowedActions.push("unmanage"); allowedActions.push("enable"); + allowedActions.push("edit"); + } else { //Unmanaged, PrepareUnmanaged , PrepareUnmanagedError allowedActions.push("manage");
