MCPcopy Create free account
hub / github.com/apache/cloudstack / add_table

Method add_table

systemvm/debian/opt/cloud/bin/cs/CsRoute.py:32–43  ·  view source on GitHub ↗
(self, devicename)

Source from the content-addressed store, hash-verified

30 return self.table_prefix + name
31
32 def add_table(self, devicename):
33 tablenumber = 100 + int(devicename[3:])
34 tablename = self.get_tablename(devicename)
35 str = "%s %s" % (tablenumber, tablename)
36 filename = "/etc/iproute2/rt_tables"
37 logging.info("Adding route table: " + str + " to " + filename + " if not present ")
38 if not CsHelper.definedinfile(filename, str):
39 CsHelper.execute("sudo echo " + str + " >> /etc/iproute2/rt_tables")
40 # remove "from all table tablename" if exists, else it will interfer with
41 # routing of unintended traffic
42 if self.findRule("from all lookup " + tablename):
43 CsHelper.execute("sudo ip rule delete from all table " + tablename)
44
45 def flush_table(self, tablename):
46 CsHelper.execute("ip route flush table %s" % (tablename))

Callers 2

mainFunction · 0.95
post_configureMethod · 0.95

Calls 5

get_tablenameMethod · 0.95
findRuleMethod · 0.95
intFunction · 0.85
executeMethod · 0.65
infoMethod · 0.45

Tested by

no test coverage detected