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

Method writeToCfgFile

python/lib/cloudutils/serviceConfig.py:347–363  ·  view source on GitHub ↗
(self, brName, dev)

Source from the content-addressed store, hash-verified

345 networkConfigBase.__init__(self, syscfg)
346
347 def writeToCfgFile(self, brName, dev):
348 self.devCfgFile = "/etc/sysconfig/network/ifcfg-%s" % dev.name
349 self.brCfgFile = "/etc/sysconfig/network/ifcfg-%s" % brName
350
351 isDevExist = os.path.exists(self.devCfgFile)
352 isBrExist = os.path.exists(self.brCfgFile)
353 if isDevExist and isBrExist:
354 logging.debug("%s:%s already configured"%(brName, dev.name))
355 return True
356 elif isDevExist and not isBrExist:
357 #reconfig bridge
358 self.addBridge(brName, dev)
359 elif not isDevExist and isBrExist:
360 #reconfig dev
361 raise CloudInternalException("Missing device configuration, Need to add your network configuration into /etc/sysconfig/network-scripts at first")
362 else:
363 raise CloudInternalException("Missing bridge/device network configuration, need to add your network configuration into /etc/sysconfig/network-scripts at first")
364
365
366 def addBridge(self, brName, dev):

Callers

nothing calls this directly

Calls 4

addBridgeMethod · 0.95
debugMethod · 0.80
existsMethod · 0.65

Tested by

no test coverage detected