Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions server/src/com/cloud/configuration/ConfigurationManagerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the rest of the change seems trivial. I just wonder why these lines where commented in the first place. Can you explain @nvazquez ?

Copy link
Copy Markdown
Contributor

@svenvogel svenvogel Oct 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @nvazquez as i can say. we tested it. it works now! Great work!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @svenvogel for testing it.

@DaanHoogland it was conflicting with the public IP range retrieval for system VMs. If the selected range was for system VMs then it won't be considered because of the entry on domain_vlan_map

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nvazquez is there any problem to merge it?

_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());
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
6 changes: 5 additions & 1 deletion ui/scripts/system.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});
}
Expand Down Expand Up @@ -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;
Expand Down