From c05b4dbfb8c44ac79d6f90777e3755b6ca80871d Mon Sep 17 00:00:00 2001 From: Sheng Yang Date: Tue, 6 Dec 2011 17:05:41 -0800 Subject: [PATCH] Add router.check.interval configuration for interval of checking redundant router status --- server/src/com/cloud/configuration/Config.java | 1 + .../router/VirtualNetworkApplianceManagerImpl.java | 12 ++++++++++-- setup/db/db/schema-2214to30.sql | 1 + 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java index feb01e292bd..7c6078d4f09 100755 --- a/server/src/com/cloud/configuration/Config.java +++ b/server/src/com/cloud/configuration/Config.java @@ -165,6 +165,7 @@ public enum Config { RouterCpuMHz("Advanced", NetworkManager.class, Integer.class, "router.cpu.mhz", String.valueOf(VirtualNetworkApplianceManager.DEFAULT_ROUTER_CPU_MHZ), "Default CPU speed (MHz) for router VM.", null), RestartRetryInterval("Advanced", HighAvailabilityManager.class, Integer.class, "restart.retry.interval", "600", "Time (in seconds) between retries to restart a vm", null), RouterStatsInterval("Advanced", NetworkManager.class, Integer.class, "router.stats.interval", "300", "Interval (in seconds) to report router statistics.", null), + RouterCheckInterval("Advanced", NetworkManager.class, Integer.class, "router.check.interval", "30", "Interval (in seconds) to report redundant router status.", null), RouterTemplateId("Advanced", NetworkManager.class, Long.class, "router.template.id", "1", "Default ID for template.", null), RouterExtraPublicNics("Advanced", NetworkManager.class, Integer.class, "router.extra.public.nics", "2", "specify extra public nics used for virtual router(up to 5)", "0-5"), StartRetry("Advanced", AgentManager.class, Integer.class, "start.retry", "10", "Number of times to retry create and start commands", null), diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java index 6bf550fe0bc..20471f80391 100755 --- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java +++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java @@ -341,7 +341,7 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian String _mgmt_cidr; int _routerStatsInterval = 300; - int _checkRouterInterval = 30; + int _routerCheckInterval = 30; private ServiceOfferingVO _offering; private String _dnsBasicZoneUpdates = "all"; @@ -627,6 +627,9 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian value = configs.get("router.stats.interval"); _routerStatsInterval = NumbersUtil.parseInt(value, 300); + value = configs.get("router.check.interval"); + _routerCheckInterval = NumbersUtil.parseInt(value, 30); + _instance = configs.get("instance.name"); if (_instance == null) { _instance = "DEFAULT"; @@ -719,7 +722,12 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian }else{ s_logger.debug("router.stats.interval - " + _routerStatsInterval+ " so not scheduling the router stats thread"); } - _checkExecutor.scheduleAtFixedRate(new CheckRouterTask(), _checkRouterInterval, _checkRouterInterval, TimeUnit.SECONDS); + + if (_routerCheckInterval > 0) { + _checkExecutor.scheduleAtFixedRate(new CheckRouterTask(), _routerCheckInterval, _routerCheckInterval, TimeUnit.SECONDS); + } else { + s_logger.debug("router.check.interval - " + _routerCheckInterval+ " so not scheduling the redundant router checking thread"); + } return true; } diff --git a/setup/db/db/schema-2214to30.sql b/setup/db/db/schema-2214to30.sql index c3aa0acefaf..162151ebff1 100755 --- a/setup/db/db/schema-2214to30.sql +++ b/setup/db/db/schema-2214to30.sql @@ -274,6 +274,7 @@ CREATE TABLE `cloud_usage`.`usage_vpn_user` ( DELETE FROM configuration WHERE name='host.capacity.checker.wait'; DELETE FROM configuration WHERE name='host.capacity.checker.interval'; INSERT IGNORE INTO configuration VALUES ('Advanced', 'DEFAULT', 'management-server', 'disable.extraction' , 'false', 'Flag for disabling extraction of template, isos and volumes'); +INSERT IGNORE INTO configuration VALUES ('Advanced', 'DEFAULT', 'NetworkManager', 'router.check.interval' , '30', 'Interval (in seconds) to report redundant router status.'); ALTER TABLE `cloud_usage`.`usage_vpn_user` ADD INDEX `i_usage_vpn_user__account_id`(`account_id`); ALTER TABLE `cloud_usage`.`usage_vpn_user` ADD INDEX `i_usage_vpn_user__created`(`created`); ALTER TABLE `cloud_usage`.`usage_vpn_user` ADD INDEX `i_usage_vpn_user__deleted`(`deleted`);