DaanHoogland commented on code in PR #13219:
URL: https://github.com/apache/cloudstack/pull/13219#discussion_r3302434345


##########
server/src/main/java/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java:
##########
@@ -1568,16 +1568,23 @@ private SetMonitorServiceCommand 
createMonitorServiceCommand(DomainRouterVO rout
         
command.setAccessDetail(SetMonitorServiceCommand.ROUTER_HEALTH_CHECKS_ENABLED, 
RouterHealthChecksEnabled.value().toString());
         
command.setAccessDetail(SetMonitorServiceCommand.ROUTER_HEALTH_CHECKS_BASIC_INTERVAL,
 RouterHealthChecksBasicInterval.value().toString());
         
command.setAccessDetail(SetMonitorServiceCommand.ROUTER_HEALTH_CHECKS_ADVANCED_INTERVAL,
 RouterHealthChecksAdvancedInterval.value().toString());
+
+        final List<Long> routerGuestNtwkIds = 
_routerDao.getRouterNetworks(router.getId());
         String excludedTests = 
RouterHealthChecksToExclude.valueIn(router.getDataCenterId());
         if (router.getIsRedundantRouter()) {
             // Disable gateway check if VPC has no tiers or no active VM's in 
it
-            final List<Long> routerGuestNtwkIds = 
_routerDao.getRouterNetworks(router.getId());
             if (RedundantState.BACKUP.equals(router.getRedundantState()) ||
                     routerGuestNtwkIds == null || 
routerGuestNtwkIds.isEmpty()) {
                 excludedTests = excludedTests.isEmpty() ? 
BACKUP_ROUTER_EXCLUDED_TESTS : excludedTests + "," + 
BACKUP_ROUTER_EXCLUDED_TESTS;
             }
         }
 
+        if (router.getVpcId() != null && 
CollectionUtils.isEmpty(routerGuestNtwkIds)) {
+            // If router belongs to a VPC and has no guest network associated, 
exclude webserver service which is expected to fail
+            String webserverServiceName = 
_monitorServiceDao.getServiceByName(MonitoringService.Service.Webserver.toString()).getServiceName();
+            excludedTests = excludedTests.isEmpty() ? webserverServiceName : 
excludedTests + "," + webserverServiceName;

Review Comment:
   ```suggestion
               if (excludedTests.isEmpty()) {
                   excludedTests = webserverServiceName;
               } else if (! excludedTests.contains(webserverServiceName)) {
                   excludedTests += "," + webserverServiceName;
               }
   ```



-- 
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