cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [cloudstack] anuragaw commented on a change in pull request #3575: [WIP DO NOT MERGE] Health check feature for virtual router
Date Tue, 17 Dec 2019 11:36:16 GMT
anuragaw commented on a change in pull request #3575: [WIP DO NOT MERGE] Health check feature
for virtual router
URL: https://github.com/apache/cloudstack/pull/3575#discussion_r358742618
 
 

 ##########
 File path: core/src/main/java/com/cloud/agent/resource/virtualnetwork/facade/SetMonitorServiceConfigItem.java
 ##########
 @@ -21,21 +21,50 @@
 
 import java.util.List;
 
+import org.apache.log4j.Logger;
+
 import com.cloud.agent.api.routing.NetworkElementCommand;
 import com.cloud.agent.api.routing.SetMonitorServiceCommand;
 import com.cloud.agent.resource.virtualnetwork.ConfigItem;
+import com.cloud.agent.resource.virtualnetwork.ScriptConfigItem;
 import com.cloud.agent.resource.virtualnetwork.VRScripts;
 import com.cloud.agent.resource.virtualnetwork.model.ConfigBase;
 import com.cloud.agent.resource.virtualnetwork.model.MonitorService;
 
 public class SetMonitorServiceConfigItem extends AbstractConfigItemFacade {
+    private static final Logger s_logger = Logger.getLogger(SetMonitorServiceConfigItem.class);
 
     @Override
     public List<ConfigItem> generateConfig(final NetworkElementCommand cmd) {
         final SetMonitorServiceCommand command = (SetMonitorServiceCommand) cmd;
 
-        final MonitorService monitorService = new MonitorService(command.getConfiguration(),
cmd.getAccessDetail(NetworkElementCommand.ROUTER_MONITORING_ENABLE));
-        return generateConfigItems(monitorService);
+        final MonitorService monitorService = new MonitorService(
+                command.getConfiguration(),
+                cmd.getAccessDetail(SetMonitorServiceCommand.ROUTER_MONITORING_ENABLED),
+                cmd.getAccessDetail(SetMonitorServiceCommand.ROUTER_HEALTH_CHECKS_ENABLED));
+
+        try {
+            monitorService.setHealthChecksBasicRunInterval(Integer.parseInt(cmd.getAccessDetail(SetMonitorServiceCommand.ROUTER_HEALTH_CHECKS_BASIC_INTERVAL)));
+        } catch (NumberFormatException exception) {
+            s_logger.error("Unexpected health check basic interval set" + cmd.getAccessDetail(SetMonitorServiceCommand.ROUTER_HEALTH_CHECKS_BASIC_INTERVAL)
+
+                    ". Exception: " + exception + "Will use default value");
+        }
+
+        try {
+            monitorService.setHealthChecksAdvanceRunInterval(Integer.parseInt(cmd.getAccessDetail(SetMonitorServiceCommand.ROUTER_HEALTH_CHECKS_ADVANCED_INTERVAL)));
+        } catch (NumberFormatException exception) {
+            s_logger.error("Unexpected health check advance interval set" + cmd.getAccessDetail(SetMonitorServiceCommand.ROUTER_HEALTH_CHECKS_ADVANCED_INTERVAL)
+
+                    ". Exception: " + exception + "Will use default value");
+        }
+
+        monitorService.setExcludedHealthChecks(cmd.getAccessDetail(SetMonitorServiceCommand.ROUTER_HEALTH_CHECKS_EXCLUDED));
+        monitorService.setAdditionalData(command.getAdditionalData());
+        monitorService.setDeleteFromProcessedCache(command.shouldDeleteFromProcessedCache());
+        List<ConfigItem> configItems = generateConfigItems(monitorService);
+        if (configItems != null && command.shouldReconfigureAfterUpdate()) {
+            configItems.add(new ScriptConfigItem(VRScripts.CONFIGURE, "monitor_service.json"));
+        }
 
 Review comment:
   Done.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message