From 8e778151e1cc6064ea46b457be266a8ec3afc7d7 Mon Sep 17 00:00:00 2001 From: Nitin Kumar Maharana Date: Thu, 7 Jan 2016 16:57:54 +0530 Subject: [PATCH 1/3] CLOUDSTACK-9229: Autoscale policy creation failing in VPC due to zoneid missing in createAutoScaleVmProfile Added a conditon to check whether the zoneid in networks is undefined, If that is undefined, it gets the zoneid from ipaddresses argument. Fixed a localization issue. --- ui/scripts/autoscaler.js | 2 +- ui/scripts/ui-custom/autoscaler.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/scripts/autoscaler.js b/ui/scripts/autoscaler.js index bbd6d9ac977..e8ac0443662 100644 --- a/ui/scripts/autoscaler.js +++ b/ui/scripts/autoscaler.js @@ -1116,7 +1116,7 @@ var apiCmd, apiCmdRes; if (!('multiRules' in args.context)) { //from a new LB var data = { - zoneid: args.context.networks[0].zoneid, //get zoneid from args.context.networks[0] instead of args.context.ipAddresses[0] because args.context.ipAddresses is null when adding AutoScale rule from Add Load Balancer tab in Network page + zoneid: args.context.networks[0].zoneid ? args.context.networks[0].zoneid : args.context.ipAddresses[0].zoneid, //get zoneid from args.context.networks[0]. If it is not null then get it from args.context.ipAddresses[0] because args.context.ipAddresses is null when adding AutoScale rule from Add Load Balancer tab in Network page serviceofferingid: args.data.serviceOfferingId, templateid: args.data.templateNames, destroyvmgraceperiod: args.data.destroyVMgracePeriod, diff --git a/ui/scripts/ui-custom/autoscaler.js b/ui/scripts/ui-custom/autoscaler.js index ca37bea3ce3..52eb5ea334b 100644 --- a/ui/scripts/ui-custom/autoscaler.js +++ b/ui/scripts/ui-custom/autoscaler.js @@ -333,7 +333,7 @@ var $loading = $('
').addClass('loading-overlay').appendTo($autoscalerDialog); $autoscalerDialog.dialog({ - title: 'label.autoscale.configuration.wizard', + title: _l('label.autoscale.configuration.wizard'), width: 825, height: 600, draggable: true, From b02e9f00106a705e862cd859e021d21c9780da68 Mon Sep 17 00:00:00 2001 From: Nitin Kumar Maharana Date: Thu, 14 Jan 2016 12:04:13 +0530 Subject: [PATCH 2/3] CLOUDSTACK-9235: Autoscale button is missing in VPC In case of VPC, it checks the services available. If LB is there, It checks the provider is Netscaler then it shows the button or hides it. --- ui/scripts/network.js | 49 +++++++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/ui/scripts/network.js b/ui/scripts/network.js index cdfbcaa2d5a..e4a54e11b63 100755 --- a/ui/scripts/network.js +++ b/ui/scripts/network.js @@ -3643,22 +3643,7 @@ success: function(json) { var networkOffering = json.listnetworkofferingsresponse.networkoffering[0]; var services = networkOffering.service; - if (services != null) { - for (var i = 0; i < services.length; i++) { - if (services[i].name == 'Lb') { - var providers = services[i].provider; - if (providers != null) { - for (var k = 0; k < providers.length; k++) { - if (providers[k].name == 'Netscaler') { - lbProviderIsNetscaler = true; - break; - } - } - } - break; - } - } - } + lbProviderIsNetscaler = checkIfNetScalerProviderIsEnabled(services); } }); if (lbProviderIsNetscaler == true) { //AutoScale is only supported on Netscaler (but not on any other provider like VirtualRouter) @@ -3667,8 +3652,16 @@ return 2; //hide Autoscale button (both header and form) } } else { //from VPC section - //VPC doesn't support autoscale - return 2; + var lbProviderIsNetscaler; + var services = args.context.vpc[0].service; + + lbProviderIsNetscaler = checkIfNetScalerProviderIsEnabled(services); + + if (lbProviderIsNetscaler == true) { //AutoScale is only supported on Netscaler (but not on any other provider like VirtualRouter) + return false; //show AutoScale button + } else { + return 2; //hide Autoscale button (both header and form) + } } } }, @@ -6525,6 +6518,26 @@ } }; + function checkIfNetScalerProviderIsEnabled(services) { + if (services != null) { + for (var i = 0; i < services.length; i++) { + if (services[i].name == 'Lb') { + var providers = services[i].provider; + if (providers != null) { + for (var k = 0; k < providers.length; k++) { + if (providers[k].name == 'Netscaler') { + return true; + } + } + } + return false; + } + } + } + + return false; + } + function getExtaPropertiesForIpObj(ipObj, args) { if (!('vpc' in args.context)) { //***** Guest Network section > Guest Network page > IP Address page ***** var services = args.context.networks[0].service; From 49f78d18a88f8156dde1051df76496b8e5180745 Mon Sep 17 00:00:00 2001 From: Nitin Kumar Maharana Date: Thu, 14 Jan 2016 15:23:01 +0530 Subject: [PATCH 3/3] CLOUDSTACK-9237: Create LB Healthcheck issues - button alignment and error message goes outside the window Increased the size of width of dialog box. Json response parsing was missing. Added it. --- .../network/lb/LoadBalancingRulesManagerImpl.java | 2 +- ui/scripts/ui-custom/healthCheck.js | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java b/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java index 402984329d5..8730a7a3a8a 100644 --- a/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java +++ b/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java @@ -596,7 +596,7 @@ public class LoadBalancingRulesManagerImpl extends ManagerBase implements */ if (!validateHealthCheck(cmd)) { throw new InvalidParameterValueException( - "Failed to create HealthCheck policy: Validation Failed (HealthCheck Policy is not supported by LB Provider for the LB rule id :)" + cmd.getLbRuleId()); + "Failed to create HealthCheck policy: Validation Failed (HealthCheck Policy is not supported by LB Provider for the LB rule id :" + cmd.getLbRuleId() + ")"); } /* Validation : check for the multiple hc policies to the rule id */ diff --git a/ui/scripts/ui-custom/healthCheck.js b/ui/scripts/ui-custom/healthCheck.js index 3280dd9c821..43070c3d211 100644 --- a/ui/scripts/ui-custom/healthCheck.js +++ b/ui/scripts/ui-custom/healthCheck.js @@ -35,9 +35,9 @@ var topFieldForm, bottomFieldForm, $topFieldForm, $bottomFieldForm; var topfields = forms.topFields; - var $healthCheckDesc = $('
' + 'label.health.check.message.desc' + '
').addClass('health-check-description'); - var $healthCheckConfigTitle = $('


' + 'label.health.check.configurations.options' + '
').addClass('health-check-config-title'); - var $healthCheckAdvancedTitle = $('


' + 'label.health.check.advanced.options' + '
').addClass('health-check-advanced-title'); + var $healthCheckDesc = $('
' + _l('label.health.check.message.desc') + '
').addClass('health-check-description'); + var $healthCheckConfigTitle = $('


' + _l('label.health.check.configurations.options') + '
').addClass('health-check-config-title'); + var $healthCheckAdvancedTitle = $('


' + _l('label.health.check.advanced.options') + '
').addClass('health-check-advanced-title'); var $healthCheckDialog = $('
').addClass('health-check'); $healthCheckDialog.append($healthCheckDesc); @@ -200,7 +200,7 @@ error: function(json) { cloudStack.dialog.notice({ - message: _s(json.responseText) + message: parseXMLHttpResponse(json) }); //Error message in the API needs to be improved $healthCheckDialog.dialog('close'); $('.overlay').remove(); @@ -361,8 +361,8 @@ } $healthCheckDialog.dialog({ - title: 'label.health.check.wizard', - width: 600, + title: _l('label.health.check.wizard'), + width: 630, height: 600, draggable: true, closeonEscape: false,