@@ -1650,7 +1650,7 @@ public Network createGuestNetwork(long networkOfferingId, final String name, fin
16501650 final boolean updateResourceCount = resourceCountNeedsUpdate (ntwkOff , aclType );
16511651 //check resource limits
16521652 if (updateResourceCount ) {
1653- _resourceLimitMgr .checkResourceLimit (owner , ResourceType .network );
1653+ _resourceLimitMgr .checkResourceLimit (owner , ResourceType .network , isDisplayNetworkEnabled );
16541654 }
16551655
16561656 // Validate network offering
@@ -1928,7 +1928,7 @@ public Network doInTransaction(TransactionStatus status) {
19281928 }
19291929
19301930 if (updateResourceCount ) {
1931- _resourceLimitMgr .incrementResourceCount (owner .getId (), ResourceType .network );
1931+ _resourceLimitMgr .incrementResourceCount (owner .getId (), ResourceType .network , isDisplayNetworkEnabled );
19321932 }
19331933
19341934 return network ;
@@ -2217,7 +2217,7 @@ public void doInTransactionWithoutResult(TransactionStatus status) {
22172217 NetworkOffering ntwkOff = _entityMgr .findById (NetworkOffering .class , networkFinal .getNetworkOfferingId ());
22182218 boolean updateResourceCount = resourceCountNeedsUpdate (ntwkOff , networkFinal .getAclType ());
22192219 if (updateResourceCount ) {
2220- _resourceLimitMgr .decrementResourceCount (networkFinal .getAccountId (), ResourceType .network );
2220+ _resourceLimitMgr .decrementResourceCount (networkFinal .getAccountId (), ResourceType .network , networkFinal . getDisplayNetwork () );
22212221 }
22222222 }
22232223 }
@@ -2232,7 +2232,8 @@ public void doInTransactionWithoutResult(TransactionStatus status) {
22322232 return success ;
22332233 }
22342234
2235- private boolean resourceCountNeedsUpdate (NetworkOffering ntwkOff , ACLType aclType ) {
2235+ @ Override
2236+ public boolean resourceCountNeedsUpdate (NetworkOffering ntwkOff , ACLType aclType ) {
22362237 //Update resource count only for Isolated account specific non-system networks
22372238 boolean updateResourceCount = (ntwkOff .getGuestType () == GuestType .Isolated && !ntwkOff .isSystemOnly () && aclType == ACLType .Account );
22382239 return updateResourceCount ;
0 commit comments