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

Method config

python/lib/cloudutils/serviceConfig.py:506–520  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

504 self.serviceName = "Host"
505
506 def config(self):
507 try:
508 cfo = configFileOps("/etc/cloudstack/agent/agent.properties", self)
509 reservedMemory = float(cfo.getEntry("host.reserved.mem.mb").strip() or 1024)
510 totalMemory = float(bash("awk '/MemTotal/ { printf \"%.3f \\n\", $2/1024 }' /proc/meminfo").getStdout().strip())
511 if totalMemory < reservedMemory :
512 raise CloudRuntimeException("CloudStack requires more than %d MB memory since %d MB is reserved" %(reservedMemory, reservedMemory))
513
514 if int(bash('ip a | grep "^\\w" | grep -iv "^lo" | wc -l').getStdout()) < 1 :
515 raise CloudRuntimeException("CloudStack requires at least a single NIC")
516
517 return True
518 except Exception as e:
519 logging.debug(e)
520 return False
521
522class securityPolicyConfigUbuntu(serviceCfgBase):
523 def __init__(self, syscfg):

Callers

nothing calls this directly

Calls 7

configFileOpsClass · 0.90
bashClass · 0.85
intFunction · 0.85
debugMethod · 0.80
getEntryMethod · 0.45
getStdoutMethod · 0.45

Tested by

no test coverage detected