From 74fe010db3b8cb8205d59274ed44de8704bd637f Mon Sep 17 00:00:00 2001 From: Sheng Yang Date: Wed, 16 Apr 2014 20:13:16 -0700 Subject: [PATCH] CLOUDSTACK-6434: Make RvR advert_int configurable In some network environment, 1*3 seconds by default make RvR setup too sensitive. A configurable parameter would be better for fitting different network environments. --- server/src/com/cloud/configuration/Config.java | 9 +++++++++ .../router/VirtualNetworkApplianceManagerImpl.java | 3 +++ setup/db/db/schema-430to440.sql | 2 ++ .../patches/debian/config/etc/init.d/cloud-early-config | 9 +++++++++ 4 files changed, 23 insertions(+) diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java index af1f062c48f..682719712ba 100755 --- a/server/src/com/cloud/configuration/Config.java +++ b/server/src/com/cloud/configuration/Config.java @@ -1898,6 +1898,15 @@ public enum Config { "the interval cloudstack sync with UCS manager for available blades in case user remove blades from chassis without notifying CloudStack", null), + RedundantRouterVrrpInterval( + "Advanced", + NetworkOrchestrationService.class, + Integer.class, + "router.redundant.vrrp.interval", + "1", + "seconds between VRRP broadcast. It would 3 times broadcast fail to trigger fail-over mechanism of redundant router", + null), + ManagementServerVendor("Advanced", ManagementServer.class, String.class, "mgt.server.vendor", "ACS", "the vendor of management server", null); private final String _category; diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java index d552001abcc..5e4c6a5ddec 100755 --- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java +++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java @@ -2339,6 +2339,9 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V buf.append(" guestbrd=").append(brd); buf.append(" guestcidrsize=").append(NetUtils.getCidrSize(guestNic.getNetmask())); buf.append(" router_pr=").append(router.getPriority()); + + int advertInt = NumbersUtil.parseInt(_configDao.getValue(Config.RedundantRouterVrrpInterval.key()), 1); + buf.append(" advert_int=").append(advertInt); } //setup network domain diff --git a/setup/db/db/schema-430to440.sql b/setup/db/db/schema-430to440.sql index 72187c358cc..028720a8f89 100644 --- a/setup/db/db/schema-430to440.sql +++ b/setup/db/db/schema-430to440.sql @@ -770,3 +770,5 @@ ALTER TABLE `cloud`.`vpc_offerings` ADD COLUMN supports_region_level_vpc boolean ALTER TABLE `cloud`.`network_offerings` ADD COLUMN supports_streched_l2 boolean default false; ALTER TABLE `cloud`.`networks` ADD COLUMN streched_l2 boolean default false; ALTER TABLE `cloud`.`vpc` ADD COLUMN region_level_vpc boolean default false; + +INSERT INTO `cloud`.`configuration`(category, instance, component, name, value, description, default_value) VALUES ('Advanced', 'DEFAULT', 'NetworkOrchestrationService', 'router.redundant.vrrp.interval', '1', 'seconds between VRRP broadcast. It would 3 times broadcast fail to trigger fail-over mechanism of redundant router', '1') ON DUPLICATE KEY UPDATE category='Advanced'; diff --git a/systemvm/patches/debian/config/etc/init.d/cloud-early-config b/systemvm/patches/debian/config/etc/init.d/cloud-early-config index f8ba8a16878..ffb23ec7cbe 100755 --- a/systemvm/patches/debian/config/etc/init.d/cloud-early-config +++ b/systemvm/patches/debian/config/etc/init.d/cloud-early-config @@ -865,6 +865,12 @@ setup_redundant_router() { sed -i "s/\[RROUTER_LOG\]/$rrouter_log_str/g" $rrouter_bin_path/check_heartbeat.sh sed -i "s/\[RROUTER_LOG\]/$rrouter_log_str/g" $rrouter_bin_path/arping_gateways.sh sed -i "s/\[RROUTER_LOG\]/$rrouter_log_str/g" /opt/cloud/bin/checkrouter.sh + + if [ $ADVERT_INT ] + then + sed -i "s/advert_int 1/advert_int $ADVERT_INT/g" /etc/keepalived/keepalived.conf + fi + chmod a+x $rrouter_bin_path/*.sh sed -i "s/--exec\ \$DAEMON;/--exec\ \$DAEMON\ --\ --vrrp;/g" /etc/init.d/keepalived @@ -1431,6 +1437,9 @@ for i in $CMDLINE cidrsize) CIDR_SIZE=$VALUE ;; + advert_int) + ADVERT_INT=$VALUE + ;; esac done