@@ -3569,10 +3569,10 @@ public VlanVO doInTransaction(final TransactionStatus status) {
35693569 }
35703570 // increment resource count for dedicated public ip's
35713571 _resourceLimitMgr .incrementResourceCount (vlanOwner .getId (), ResourceType .public_ip , new Long (ips .size ()));
3572- } else if (domain != null ) {
3572+ } else if (domain != null && ! forSystemVms ) {
35733573 // This VLAN is domain-wide, so create a DomainVlanMapVO entry
3574- // final DomainVlanMapVO domainVlanMapVO = new DomainVlanMapVO(domain.getId(), vlan.getId());
3575- // _domainVlanMapDao.persist(domainVlanMapVO);
3574+ final DomainVlanMapVO domainVlanMapVO = new DomainVlanMapVO (domain .getId (), vlan .getId ());
3575+ _domainVlanMapDao .persist (domainVlanMapVO );
35763576 } else if (podId != null ) {
35773577 // This VLAN is pod-wide, so create a PodVlanMapVO entry
35783578 final PodVlanMapVO podVlanMapVO = new PodVlanMapVO (podId , vlan .getId ());
@@ -3754,8 +3754,10 @@ public Vlan dedicatePublicIpRange(final DedicatePublicIpRangeCmd cmd) throws Res
37543754
37553755 // Check if any of the Public IP addresses is allocated to another
37563756 // account
3757+ boolean forSystemVms = false ;
37573758 final List <IPAddressVO > ips = _publicIpAddressDao .listByVlanId (vlanDbId );
37583759 for (final IPAddressVO ip : ips ) {
3760+ forSystemVms = ip .isForSystemVms ();
37593761 final Long allocatedToAccountId = ip .getAllocatedToAccountId ();
37603762 if (allocatedToAccountId != null ) {
37613763 final Account accountAllocatedTo = _accountMgr .getActiveAccountById (allocatedToAccountId );
@@ -3779,7 +3781,7 @@ public Vlan dedicatePublicIpRange(final DedicatePublicIpRangeCmd cmd) throws Res
37793781 UsageEventUtils .publishUsageEvent (EventTypes .EVENT_NET_IP_ASSIGN , vlanOwner .getId (), ip .getDataCenterId (), ip .getId (), ip .getAddress ().toString (), ip .isSourceNat (),
37803782 vlan .getVlanType ().toString (), ip .getSystem (), ip .getClass ().getName (), ip .getUuid ());
37813783 }
3782- } else if (domain != null ) {
3784+ } else if (domain != null && ! forSystemVms ) {
37833785 // Create an DomainVlanMapVO entry
37843786 DomainVlanMapVO domainVlanMapVO = new DomainVlanMapVO (domain .getId (), vlan .getId ());
37853787 _domainVlanMapDao .persist (domainVlanMapVO );
0 commit comments