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

Method createBridge

python/lib/cloudutils/networkConfig.py:62–76  ·  view source on GitHub ↗
(dev, brName)

Source from the content-addressed store, hash-verified

60
61 @staticmethod
62 def createBridge(dev, brName):
63 if not networkConfig.isBridgeSupported():
64 logging.debug("bridge is not supported")
65 return False
66 if networkConfig.isBridgeEnslavedWithDevices(brName):
67 logging.debug("bridge: %s has devices enslaved"%brName)
68 return False
69
70 cmds = ""
71 if not networkConfig.isBridge(brName):
72 cmds = "ip link add name %s type bridge ;"%brName
73
74 cmds += "ifconfig %s up;"%brName
75 cmds += "ip link set dev %s master %s"%(dev, brName)
76 return bash(cmds).isSuccess()
77
78 @staticmethod
79 def isBridgeEnslavedWithDevices(brName):

Callers

nothing calls this directly

Calls 6

bashClass · 0.85
isBridgeSupportedMethod · 0.80
debugMethod · 0.80
isBridgeMethod · 0.80
isSuccessMethod · 0.65

Tested by

no test coverage detected