Skip to content

Commit f78a65c

Browse files
CLOUDSTACK-8616 - Installing KeepaliveD from Debian Wheezy backports
- preempt delay reverted on version 1.2.13 - from the backports - vrrp : Revert "Honor preempt_delay setting on startup.". - See changelog: http://www.keepalived.org/changelog.html - Refactoring some variable names to avoid misunderstanding Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>
1 parent 12ee36a commit f78a65c

File tree

3 files changed

+19
-22
lines changed

3 files changed

+19
-22
lines changed

systemvm/patches/debian/buildsystemvm.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,8 +375,10 @@ packages() {
375375
chroot . apt-get --no-install-recommends -q -y --force-yes install open-vm-tools
376376
#xenstore utils
377377
chroot . apt-get --no-install-recommends -q -y --force-yes install xenstore-utils libxenstore3.0
378-
#keepalived and conntrackd
379-
chroot . apt-get --no-install-recommends -q -y --force-yes install keepalived conntrackd ipvsadm libnetfilter-conntrack3 libnl1
378+
#keepalived - install version 1.2.13 from wheezy backports
379+
chroot . apt-get --no-install-recommends -t wheezy-backports -q -y --force-yes install keepalived
380+
#conntrackd
381+
chroot . apt-get --no-install-recommends -q -y --force-yes install conntrackd ipvsadm libnetfilter-conntrack3 libnl1
380382
#ipcalc
381383
chroot . apt-get --no-install-recommends -q -y --force-yes install ipcalc
382384
#irqbalance from wheezy-backports

systemvm/patches/debian/config/opt/cloud/bin/cs/CsFile.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,9 @@ def load(self):
3535
self.new_config.append(line)
3636
except IOError:
3737
logging.debug("File %s does not exist" % self.filename)
38-
return
3938
else:
4039
logging.debug("Reading file %s" % self.filename)
41-
self.config = copy.deepcopy(self.new_config)
40+
self.config = list(self.new_config)
4241

4342
def is_changed(self):
4443
if set(self.config) != set(self.new_config):
@@ -58,6 +57,7 @@ def repopulate(self):
5857

5958
def commit(self):
6059
if not self.is_changed():
60+
logging.info("Nothing to commit. The %s file did not change" % self.filename)
6161
return
6262
handle = open(self.filename, "w+")
6363
for line in self.new_config:

systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -101,21 +101,19 @@ def _redundant_on(self):
101101

102102
CsHelper.execute('sed -i "s/--exec\ \$DAEMON;/--exec\ \$DAEMON\ --\ --vrrp;/g" /etc/init.d/keepalived')
103103
# checkrouter.sh configuration
104-
file = CsFile("/opt/cloud/bin/checkrouter.sh")
105-
file.greplace("[RROUTER_LOG]", self.RROUTER_LOG)
106-
file.commit()
104+
check_router = CsFile("/opt/cloud/bin/checkrouter.sh")
105+
check_router.greplace("[RROUTER_LOG]", self.RROUTER_LOG)
106+
check_router.commit()
107107

108108
# keepalived configuration
109-
file = CsFile(self.KEEPALIVED_CONF)
110-
ads = [o for o in self.address.get_ips() if o.is_public()]
111-
112-
file.search(" router_id ", " router_id %s" % self.cl.get_name())
113-
file.search(" interface ", " interface %s" % guest.get_device())
114-
file.search(" virtual_router_id ", " virtual_router_id %s" % self.cl.get_router_id())
115-
file.greplace("[RROUTER_BIN_PATH]", self.CS_ROUTER_DIR)
116-
file.section("authentication {", "}", [" auth_type AH \n", " auth_pass %s\n" % self.cl.get_router_password()])
117-
file.section("virtual_ipaddress {", "}", self._collect_ips())
118-
file.commit()
109+
keepalived_conf = CsFile(self.KEEPALIVED_CONF)
110+
keepalived_conf.search(" router_id ", " router_id %s" % self.cl.get_name())
111+
keepalived_conf.search(" interface ", " interface %s" % guest.get_device())
112+
keepalived_conf.search(" virtual_router_id ", " virtual_router_id %s" % self.cl.get_router_id())
113+
keepalived_conf.greplace("[RROUTER_BIN_PATH]", self.CS_ROUTER_DIR)
114+
keepalived_conf.section("authentication {", "}", [" auth_type AH \n", " auth_pass %s\n" % self.cl.get_router_password()])
115+
keepalived_conf.section("virtual_ipaddress {", "}", self._collect_ips())
116+
keepalived_conf.commit()
119117

120118
# conntrackd configuration
121119
connt = CsFile(self.CONNTRACKD_CONF)
@@ -134,9 +132,6 @@ def _redundant_on(self):
134132
if connt.is_changed():
135133
CsHelper.service("conntrackd", "restart")
136134

137-
if file.is_changed():
138-
CsHelper.service("keepalived", "reload")
139-
140135
# Configure heartbeat cron job - runs every 30 seconds
141136
heartbeat_cron = CsFile("/etc/cron.d/heartbeat")
142137
heartbeat_cron.add("SHELL=/bin/bash", 0)
@@ -153,8 +148,8 @@ def _redundant_on(self):
153148
keepalived_cron.commit()
154149

155150
proc = CsProcess(['/usr/sbin/keepalived', '--vrrp'])
156-
if not proc.find():
157-
CsHelper.service("keepalived", "start")
151+
if not proc.find() or keepalived_conf.is_changed():
152+
CsHelper.service("keepalived", "restart")
158153

159154
def release_lock(self):
160155
try:

0 commit comments

Comments
 (0)