Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion systemvm/patches/debian/config/opt/cloud/bin/cs/CsDatabag.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ def get_vpccidr(self):
else:
return "unknown"

def get_eth2_ip(self):
if "eth2ip" in self.idata():
return self.idata()['eth2ip']
else:
return "unknown"

def is_master(self):
if not self.is_redundant():
return False
Expand Down Expand Up @@ -130,7 +136,10 @@ def get_router_password(self):
This is slightly difficult to happen, but if it does, destroy the router with the password generated with the
code below and restart the VPC with out the clean up option.
'''
passwd = "%s-%s" % (self.get_vpccidr, self.get_router_id())
if(self.get_type()=='router'):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • run pep8, fix errors
  • consider using -- if self.get_type() == "router" or if self.get_type() is "router"
  • stick to uniform usage to quotes, double quotes for strings here so "router" instead of 'router'

passwd="%s-%s" % (self.get_eth2_ip(), self.get_router_id())
else:
passwd = "%s-%s" % (self.get_vpccidr(), self.get_router_id())
md5 = hashlib.md5()
md5.update(passwd)
return md5.hexdigest()
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def set_backup(self):
if dev == o.get_device():
continue
logging.info("Bringing public interface %s down" % o.get_device())
cmd2 = "ip link set %s up" % o.get_device()
cmd2 = "ip link set %s down" % o.get_device()
CsHelper.execute(cmd2)
dev = o.get_device()
cmd = "%s -C %s" % (self.CONNTRACKD_BIN, self.CONNTRACKD_CONF)
Expand Down Expand Up @@ -317,8 +317,11 @@ def _collect_ips(self):
lines = []
for o in self.address.get_ips():
if o.needs_vrrp():
str = " %s brd %s dev %s\n" % (
o.get_gateway_cidr(), o.get_broadcast(), o.get_device())
cmdline=self.config.get_cmdline_instance()
if(cmdline.get_type()=='router'):
str = " %s brd %s dev %s\n" % (cmdline.get_guest_gw(), o.get_broadcast(), o.get_device())
else:
str = " %s brd %s dev %s\n" % (o.get_ip(), o.get_broadcast(), o.get_device())
lines.append(str)
self.check_is_up(o.get_device())
return lines
Expand Down