bernardodemarco commented on code in PR #14373:
URL: https://github.com/apache/cloudstack/pull/14373#discussion_r4538794650


##########
server/src/main/java/com/cloud/network/vpc/VpcManagerImpl.java:
##########
@@ -2580,9 +2576,12 @@ public void doInTransactionWithoutResult(final 
TransactionStatus status) {
 
                 try {
                     // check number of active networks in vpc
-                    if (_ntwkDao.countVpcNetworks(vpc.getId()) >= 
_maxNetworks) {
-                        logger.warn(String.format("Failed to create a new VPC 
Guest Network because the number of networks per VPC has reached its maximum 
capacity of [%s]. Increase it by modifying global config [%s].", _maxNetworks, 
Config.VpcMaxNetworks));
-                        throw new CloudRuntimeException(String.format("Number 
of networks per VPC cannot surpass [%s].", _maxNetworks));
+                    final int maxNetworks = VpcMaxNetworks.value();
+                    if (_ntwkDao.countVpcNetworks(vpc.getId()) >= maxNetworks) 
{
+                        logger.warn("Failed to create a new network in VPC 
[{}] because it has reached the maximum of [{}] networks for {}. "
+                                + "Increase it by modifying the global setting 
[{}].", vpc, maxNetworks, _accountMgr.getAccount(vpc.getAccountId()), 
VpcMaxNetworks.key());

Review Comment:
   ```suggestion
                                   + "Increase it by modifying the global 
setting [{}].", vpc, maxNetworks, VpcMaxNetworks.key());
   ```



##########
server/src/main/java/com/cloud/network/vpc/VpcManagerImpl.java:
##########
@@ -2580,9 +2576,12 @@ public void doInTransactionWithoutResult(final 
TransactionStatus status) {
 
                 try {
                     // check number of active networks in vpc
-                    if (_ntwkDao.countVpcNetworks(vpc.getId()) >= 
_maxNetworks) {
-                        logger.warn(String.format("Failed to create a new VPC 
Guest Network because the number of networks per VPC has reached its maximum 
capacity of [%s]. Increase it by modifying global config [%s].", _maxNetworks, 
Config.VpcMaxNetworks));
-                        throw new CloudRuntimeException(String.format("Number 
of networks per VPC cannot surpass [%s].", _maxNetworks));
+                    final int maxNetworks = VpcMaxNetworks.value();
+                    if (_ntwkDao.countVpcNetworks(vpc.getId()) >= maxNetworks) 
{
+                        logger.warn("Failed to create a new network in VPC 
[{}] because it has reached the maximum of [{}] networks for {}. "

Review Comment:
   Since the setting is global, we do not need to mention that the maximum 
number of networks of a specific account has been reached.
   
   ```suggestion
                           logger.warn("Failed to create a new network in VPC 
[{}] because it has reached the maximum of [{}] networks. "
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to