CLOUDSTACK-8301: Enable configuring local storage use for system VMs at zone level. This commit contains the UI changes for the feature.
Signed-off-by: Koushik Das <[email protected]> This closes #259 Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/2148dca2 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/2148dca2 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/2148dca2 Branch: refs/heads/master Commit: 2148dca24b1d3f7a345a6e5c7653b4df20a86c02 Parents: 8ff9000 Author: ramamurtis <[email protected]> Authored: Tue May 19 16:52:43 2015 +0530 Committer: Koushik Das <[email protected]> Committed: Tue May 19 21:53:24 2015 +0530 ---------------------------------------------------------------------- .../classes/resources/messages.properties | 3 +- ui/dictionary2.jsp | 3 +- ui/scripts/zoneWizard.js | 92 ++++++++++++-------- 3 files changed, 59 insertions(+), 39 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2148dca2/client/WEB-INF/classes/resources/messages.properties ---------------------------------------------------------------------- diff --git a/client/WEB-INF/classes/resources/messages.properties b/client/WEB-INF/classes/resources/messages.properties index 54ac2f3..20970fe 100644 --- a/client/WEB-INF/classes/resources/messages.properties +++ b/client/WEB-INF/classes/resources/messages.properties @@ -757,7 +757,8 @@ label.load.balancer=Load Balancer label.load.balancing.policies=Load balancing policies label.load.balancing=Load Balancing label.loading=Loading -label.local.storage.enabled=Local storage enabled +label.local.storage.enabled=Enable local storage for User VMs +label.local.storage.enabled.system.vms=Enable local storage for System VMs label.local.storage=Local Storage label.local=Local label.login=Login http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2148dca2/ui/dictionary2.jsp ---------------------------------------------------------------------- diff --git a/ui/dictionary2.jsp b/ui/dictionary2.jsp index e588528..12518be 100644 --- a/ui/dictionary2.jsp +++ b/ui/dictionary2.jsp @@ -1057,6 +1057,7 @@ under the License. 'label.add.private.gateway': '<fmt:message key="label.add.private.gateway" />', 'label.ovm3.pool': '<fmt:message key="label.ovm3.pool" />', 'label.ovm3.cluster': '<fmt:message key="label.ovm3.cluster" />', -'label.ovm3.vip': '<fmt:message key="label.ovm3.vip" />' +'label.ovm3.vip': '<fmt:message key="label.ovm3.vip" />', +'label.local.storage.enabled.system.vms': '<fmt:message key="label.local.storage.enabled.system.vms" />' }); </script> http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2148dca2/ui/scripts/zoneWizard.js ---------------------------------------------------------------------- diff --git a/ui/scripts/zoneWizard.js b/ui/scripts/zoneWizard.js index 2ae056b..f39f25e 100755 --- a/ui/scripts/zoneWizard.js +++ b/ui/scripts/zoneWizard.js @@ -388,7 +388,10 @@ }, addPrimaryStorage: function(args) { - return args.data.localstorageenabled != 'on'; + if(args.data.localstorageenabled == 'on' && args.data.localstorageenabledforsystemvm == 'on') { + return false; //skip step only when both localstorage and localstorage for system vm are checked + } + return true; } }, @@ -689,23 +692,15 @@ label: 'label.local.storage.enabled', isBoolean: true, onChange: function(args) { - var $checkbox = args.$checkbox; - if ($checkbox.is(':checked')) { - cloudStack.dialog.confirm({ - message: 'message.zoneWizard.enable.local.storage', - action: function() { - $checkbox.attr('checked', true); - }, - cancelAction: function() { - $checkbox.attr('checked', false); - } - }); + } + }, - return false; - } + localstorageenabledforsystemvm: { + label: 'label.local.storage.enabled.system.vms', + isBoolean: true, + onChange: function(args) { - return true; } } } @@ -2346,8 +2341,8 @@ }, action: function(args) { - var $wizard = args.wizard; - + var $wizard = args.wizard; + var formData = args.data; var advZoneConfiguredVirtualRouterCount = 0; //for multiple physical networks in advanced zone. Each physical network has 2 virtual routers: regular one and VPC one. var success = args.response.success; @@ -4522,29 +4517,52 @@ }); } - $.ajax({ - url: createURL("addHost"), - type: "POST", - data: data, - success: function(json) { - stepFns.addPrimaryStorage({ - data: $.extend(args.data, { - returnedHost: json.addhostresponse.host[0] - }) - }); - }, - error: function(XMLHttpResponse) { - var errorMsg = parseXMLHttpResponse(XMLHttpResponse); - error('addHost', errorMsg, { - fn: 'addHost', - args: args - }); - } - }); + var addHostAjax = function() { + $.ajax({ + url: createURL("addHost"), + type: "POST", + data: data, + success: function(json) { + stepFns.addPrimaryStorage({ + data: $.extend(args.data, { + returnedHost: json.addhostresponse.host[0] + }) + }); + }, + error: function(XMLHttpResponse) { + var errorMsg = parseXMLHttpResponse(XMLHttpResponse); + error('addHost', errorMsg, { + fn: 'addHost', + args: args + }); + } + }); + }; + + if(args.data.zone.localstorageenabledforsystemvm == 'on') { + $.ajax({ + url: createURL("updateConfiguration&name=system.vm.use.local.storage&value=true&zoneid=" + args.data.returnedZone.id), + dataType: "json", + success: function(json) { + addHostAjax(); + }, + error: function(XMLHttpResponse) { + var errorMsg = parseXMLHttpResponse(XMLHttpResponse); + error('addHost', errorMsg, { + fn: 'addHost', + args: args + }); + } + }); + } else { + addHostAjax(); + } + + }, addPrimaryStorage: function(args) { - if (args.data.zone.localstorageenabled == 'on') { //use local storage, don't need primary storage. So, skip this step. + if (args.data.zone.localstorageenabled == 'on' && args.data.zone.localstorageenabledforsystemvm == 'on') { //use local storage, don't need primary storage. So, skip this step. stepFns.addSecondaryStorage({ data: args.data });
