From 8ec26fb531eedc8fdb9f4731900c047760178fb6 Mon Sep 17 00:00:00 2001 From: Brian Federle Date: Wed, 12 Nov 2014 09:55:27 -0800 Subject: [PATCH 1/4] CLOUDSTACK-7645: UI: Fix method for extending dictionary Instead of mapping both dictionary JSP files to separate objects, extend dictionary2's object onto single 'dictionary' object. -- The previous approach was causing issues on certain dialogs, which were not opening due to possible missing labels. Conflicts: ui/dictionary2.jsp --- ui/dictionary2.jsp | 4 ++-- ui/scripts/cloudStack.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ui/dictionary2.jsp b/ui/dictionary2.jsp index 28b4f05787b..a76ba3b678c 100644 --- a/ui/dictionary2.jsp +++ b/ui/dictionary2.jsp @@ -24,7 +24,7 @@ under the License. <% long now = System.currentTimeMillis(); %> diff --git a/ui/scripts/cloudStack.js b/ui/scripts/cloudStack.js index a76e10169c4..7a5988248a7 100644 --- a/ui/scripts/cloudStack.js +++ b/ui/scripts/cloudStack.js @@ -407,9 +407,9 @@ // Localization if (!$.isFunction(cloudStack.localizationFn)) { // i.e., localize is overridden by a plugin/module cloudStack.localizationFn = function(str) { - // look in dictionary first; if not found, try dictionary2 var localized = dictionary[str]; - return localized ? localized : dictionary2[str]; + + return localized ? localized : str; }; } From 2ee3d4258e52f2f2ef2b14e818f95b3d11a49139 Mon Sep 17 00:00:00 2001 From: Brian Federle Date: Thu, 13 Nov 2014 15:25:12 -0800 Subject: [PATCH 2/4] CLOUDSTACK-7645: UI: Fix dictionary JSP include order -Places dictionary JSP includes at top of script includes, to help solve a potential issue where the dictionary may not always be loaded before the UI initializes --- ui/index.jsp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ui/index.jsp b/ui/index.jsp index 42973f70855..bab00eb2cea 100644 --- a/ui/index.jsp +++ b/ui/index.jsp @@ -1692,6 +1692,10 @@ + + + + @@ -1776,9 +1780,5 @@ - - - - From 03505901bccd507a391955a3850a876194b15246 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Thu, 13 Nov 2014 16:24:41 -0800 Subject: [PATCH 3/4] CLOUDSTACK-7910: UI > Instance Wizard > declare serviceOfferingObjs before using it. --- ui/scripts/instanceWizard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/scripts/instanceWizard.js b/ui/scripts/instanceWizard.js index 3a588e751c2..0baad4f6422 100644 --- a/ui/scripts/instanceWizard.js +++ b/ui/scripts/instanceWizard.js @@ -16,7 +16,7 @@ // under the License. (function($, cloudStack) { - var zoneObjs, hypervisorObjs, featuredTemplateObjs, communityTemplateObjs, myTemplateObjs, featuredIsoObjs, community, networkObjs; + var zoneObjs, hypervisorObjs, featuredTemplateObjs, communityTemplateObjs, myTemplateObjs, featuredIsoObjs, serviceOfferingObjs, community, networkObjs; var selectedZoneObj, selectedTemplateObj, selectedHypervisor, selectedDiskOfferingObj; var selectedTemplateOrIso; //'select-template', 'select-iso' var step6ContainerType = 'nothing-to-select'; //'nothing-to-select', 'select-network', 'select-security-group', 'select-advanced-sg'(advanced sg-enabled zone) From 7e6ec2ce826969aeb79ddb1113cdc45289bc89d3 Mon Sep 17 00:00:00 2001 From: Damodar Date: Tue, 11 Nov 2014 11:25:03 +0530 Subject: [PATCH 4/4] CLOUDSTACK-7877: The NET.IPRELEASE events are not added to usage_event on IP range deletion from Physical Networks. Signed-off-by: Jayapal --- .../ConfigurationManagerImpl.java | 109 +++++++++--------- 1 file changed, 53 insertions(+), 56 deletions(-) diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java index 1f71c0f2691..628cbc7d1bc 100755 --- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java +++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java @@ -3159,69 +3159,66 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati } // Check if the VLAN has any allocated public IPs - long allocIpCount = _publicIpAddressDao.countIPs(vlanRange.getDataCenterId(), vlanDbId, true); List ips = _publicIpAddressDao.listByVlanId(vlanDbId); - boolean success = true; - if (allocIpCount > 0) { - if (isAccountSpecific) { - try { - vlanRange = _vlanDao.acquireInLockTable(vlanDbId, 30); - if (vlanRange == null) { - throw new CloudRuntimeException("Unable to acquire vlan configuration: " + vlanDbId); - } - - if (s_logger.isDebugEnabled()) { - s_logger.debug("lock vlan " + vlanDbId + " is acquired"); - } - for (IPAddressVO ip : ips) { - if (ip.isOneToOneNat()) { - throw new InvalidParameterValueException("Can't delete account specific vlan " + vlanDbId + " as ip " + ip - + " belonging to the range is used for static nat purposes. Cleanup the rules first"); - } - - if (ip.isSourceNat()) { - throw new InvalidParameterValueException("Can't delete account specific vlan " + vlanDbId + " as ip " + ip - + " belonging to the range is a source nat ip for the network id=" + ip.getSourceNetworkId() - + ". IP range with the source nat ip address can be removed either as a part of Network, or account removal"); - } - - if (_firewallDao.countRulesByIpId(ip.getId()) > 0) { - throw new InvalidParameterValueException("Can't delete account specific vlan " + vlanDbId + " as ip " + ip - + " belonging to the range has firewall rules applied. Cleanup the rules first"); - } - // release public ip address here - success = success && _ipAddrMgr.disassociatePublicIpAddress(ip.getId(), userId, caller); - } - if (!success) { - s_logger.warn("Some ip addresses failed to be released as a part of vlan " + vlanDbId + " removal"); - } else { - for (IPAddressVO ip : ips) { - UsageEventUtils.publishUsageEvent(EventTypes.EVENT_NET_IP_RELEASE, acctVln.get(0).getId(), ip.getDataCenterId(), ip.getId(), - ip.getAddress().toString(), ip.isSourceNat(), vlanRange.getVlanType().toString(), ip.getSystem(), ip.getClass().getName(), ip.getUuid()); - } - } - } finally { - _vlanDao.releaseFromLockTable(vlanDbId); - } - } else { // !isAccountSpecific - NicIpAliasVO ipAlias = _nicIpAliasDao.findByGatewayAndNetworkIdAndState(vlanRange.getVlanGateway(), vlanRange.getNetworkId(), NicIpAlias.state.active); - //check if the ipalias belongs to the vlan range being deleted. - if (ipAlias != null && vlanDbId == _publicIpAddressDao.findByIpAndSourceNetworkId(vlanRange.getNetworkId(), ipAlias.getIp4Address()).getVlanId()) { - throw new InvalidParameterValueException("Cannot delete vlan range " + vlanDbId + " as " + ipAlias.getIp4Address() - + "is being used for providing dhcp service in this subnet. Delete all VMs in this subnet and try again"); - } - allocIpCount = _publicIpAddressDao.countIPs(vlanRange.getDataCenterId(), vlanDbId, true); - if (allocIpCount > 0) { - throw new InvalidParameterValueException(allocIpCount + " Ips are in use. Cannot delete this vlan"); - } + if (isAccountSpecific) { + try { + vlanRange = _vlanDao.acquireInLockTable(vlanDbId, 30); + if (vlanRange == null) { + throw new CloudRuntimeException("Unable to acquire vlan configuration: " + vlanDbId); } + + if (s_logger.isDebugEnabled()) { + s_logger.debug("lock vlan " + vlanDbId + " is acquired"); + } + for (IPAddressVO ip : ips) { + boolean success = true; + if (ip.isOneToOneNat()) { + throw new InvalidParameterValueException("Can't delete account specific vlan " + vlanDbId + " as ip " + ip + + " belonging to the range is used for static nat purposes. Cleanup the rules first"); + } + + if (ip.isSourceNat()) { + throw new InvalidParameterValueException("Can't delete account specific vlan " + vlanDbId + " as ip " + ip + + " belonging to the range is a source nat ip for the network id=" + ip.getSourceNetworkId() + + ". IP range with the source nat ip address can be removed either as a part of Network, or account removal"); + } + + if (_firewallDao.countRulesByIpId(ip.getId()) > 0) { + throw new InvalidParameterValueException("Can't delete account specific vlan " + vlanDbId + " as ip " + ip + + " belonging to the range has firewall rules applied. Cleanup the rules first"); + } + if(ip.getAllocatedTime() != null) {// This means IP is allocated + // release public ip address here + success = _ipAddrMgr.disassociatePublicIpAddress(ip.getId(), userId, caller); + } + if (!success) { + s_logger.warn("Some ip addresses failed to be released as a part of vlan " + vlanDbId + " removal"); + } else { + UsageEventUtils.publishUsageEvent(EventTypes.EVENT_NET_IP_RELEASE, acctVln.get(0).getAccountId(), ip.getDataCenterId(), ip.getId(), + ip.getAddress().toString(), ip.isSourceNat(), vlanRange.getVlanType().toString(), ip.getSystem(), ip.getClass().getName(), ip.getUuid()); + } + } + } finally { + _vlanDao.releaseFromLockTable(vlanDbId); + } + } else { // !isAccountSpecific + NicIpAliasVO ipAlias = _nicIpAliasDao.findByGatewayAndNetworkIdAndState(vlanRange.getVlanGateway(), vlanRange.getNetworkId(), NicIpAlias.state.active); + //check if the ipalias belongs to the vlan range being deleted. + if (ipAlias != null && vlanDbId == _publicIpAddressDao.findByIpAndSourceNetworkId(vlanRange.getNetworkId(), ipAlias.getIp4Address()).getVlanId()) { + throw new InvalidParameterValueException("Cannot delete vlan range " + vlanDbId + " as " + ipAlias.getIp4Address() + + "is being used for providing dhcp service in this subnet. Delete all VMs in this subnet and try again"); + } + long allocIpCount = _publicIpAddressDao.countIPs(vlanRange.getDataCenterId(), vlanDbId, true); + if (allocIpCount > 0) { + throw new InvalidParameterValueException(allocIpCount + " Ips are in use. Cannot delete this vlan"); + } } Transaction.execute(new TransactionCallbackNoReturn() { @Override public void doInTransactionWithoutResult(TransactionStatus status) { - _publicIpAddressDao.deletePublicIPRange(vlanDbId); - _vlanDao.remove(vlanDbId); + _publicIpAddressDao.deletePublicIPRange(vlanDbId); + _vlanDao.remove(vlanDbId); } });