rafaelweingartner closed pull request #2980: [4.11] Fix set initial reservation
on public IP ranges
URL: https://github.com/apache/cloudstack/pull/2980
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
index 80642f51375..9075ee903a5 100755
--- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
@@ -3569,10 +3569,10 @@ public VlanVO doInTransaction(final TransactionStatus
status) {
}
// increment resource count for dedicated public ip's
_resourceLimitMgr.incrementResourceCount(vlanOwner.getId(),
ResourceType.public_ip, new Long(ips.size()));
- } else if (domain != null) {
+ } else if (domain != null && !forSystemVms) {
// This VLAN is domain-wide, so create a DomainVlanMapVO
entry
- //final DomainVlanMapVO domainVlanMapVO = new
DomainVlanMapVO(domain.getId(), vlan.getId());
- //_domainVlanMapDao.persist(domainVlanMapVO);
+ final DomainVlanMapVO domainVlanMapVO = new
DomainVlanMapVO(domain.getId(), vlan.getId());
+ _domainVlanMapDao.persist(domainVlanMapVO);
} else if (podId != null) {
// This VLAN is pod-wide, so create a PodVlanMapVO entry
final PodVlanMapVO podVlanMapVO = new PodVlanMapVO(podId,
vlan.getId());
@@ -3754,8 +3754,10 @@ public Vlan dedicatePublicIpRange(final
DedicatePublicIpRangeCmd cmd) throws Res
// Check if any of the Public IP addresses is allocated to another
// account
+ boolean forSystemVms = false;
final List<IPAddressVO> ips =
_publicIpAddressDao.listByVlanId(vlanDbId);
for (final IPAddressVO ip : ips) {
+ forSystemVms = ip.isForSystemVms();
final Long allocatedToAccountId = ip.getAllocatedToAccountId();
if (allocatedToAccountId != null) {
final Account accountAllocatedTo =
_accountMgr.getActiveAccountById(allocatedToAccountId);
@@ -3779,7 +3781,7 @@ public Vlan dedicatePublicIpRange(final
DedicatePublicIpRangeCmd cmd) throws Res
UsageEventUtils.publishUsageEvent(EventTypes.EVENT_NET_IP_ASSIGN,
vlanOwner.getId(), ip.getDataCenterId(), ip.getId(),
ip.getAddress().toString(), ip.isSourceNat(),
vlan.getVlanType().toString(), ip.getSystem(),
ip.getClass().getName(), ip.getUuid());
}
- } else if (domain != null) {
+ } else if (domain != null && !forSystemVms) {
// Create an DomainVlanMapVO entry
DomainVlanMapVO domainVlanMapVO = new
DomainVlanMapVO(domain.getId(), vlan.getId());
_domainVlanMapDao.persist(domainVlanMapVO);
diff --git a/ui/scripts/system.js b/ui/scripts/system.js
index b568d49fe72..284dad456d9 100755
--- a/ui/scripts/system.js
+++ b/ui/scripts/system.js
@@ -126,13 +126,16 @@
var $systemvmsCb =
$systemvms.find('input[type=checkbox]');
var $account =
args.$form.find('.form-item[rel=account]');
var $accountTxt =
args.$form.find('input[name=account]');
+ var $domainid =
args.$form.find('select[name=domainid]');
$systemvmsCb.change(function() {
if ($systemvmsCb.is(':checked')) {
$accountTxt.val('');
$accountTxt.attr('disabled', true);
+ $domainid.attr('disabled', true);
}
else {
$accountTxt.attr('disabled', false);
+ $domainid.attr('disabled', false);
}
});
}
@@ -524,7 +527,8 @@
},
actionPreFilter: function (args) {
var actionsToShow =[ 'destroy'];
- if
(args.context.multiRule[0].domain == 'ROOT' &&
args.context.multiRule[0].account != null &&
args.context.multiRule[0].account.account == 'system')
+ if
(args.context.multiRule[0].domain == 'ROOT' &&
args.context.multiRule[0].account != null &&
+
args.context.multiRule[0].account.account == 'system' &&
!args.context.multiRule[0].forsystemvms)
actionsToShow.push('addAccount');
else
actionsToShow.push('releaseFromAccount');
return actionsToShow;
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services