diff --git a/client/bindir/cloud-setup-management.in b/client/bindir/cloud-setup-management.in index c0b1724eac2..29126e34df9 100755 --- a/client/bindir/cloud-setup-management.in +++ b/client/bindir/cloud-setup-management.in @@ -1,7 +1,9 @@ +#!/usr/bin/python from cloudutils.syscfg import sysConfigFactory from cloudutils.utilities import initLoging from cloudutils.cloudException import CloudRuntimeException, CloudInternalException from cloudutils.globalEnv import globalEnv +from cloudutils.serviceConfigServer import cloudManagementConfig if __name__ == '__main__': initLoging("/var/log/cloud/setupManagement.log") glbEnv = globalEnv() @@ -11,6 +13,7 @@ if __name__ == '__main__': print "Starting to configure CloudStack Management Server:" syscfg = sysConfigFactory.getSysConfigFactory(glbEnv) try: + syscfg.registerService(cloudManagementConfig) syscfg.config() print "CloudStack Management Server setup is Done!" except (CloudRuntimeException, CloudInternalException), e: diff --git a/python/lib/cloudutils/serviceConfig.py b/python/lib/cloudutils/serviceConfig.py index d4dfdcf919b..cf43e67d1e1 100644 --- a/python/lib/cloudutils/serviceConfig.py +++ b/python/lib/cloudutils/serviceConfig.py @@ -621,7 +621,8 @@ class sudoersConfig(serviceCfgBase): class firewallConfigServer(firewallConfigBase): def __init__(self, syscfg): super(firewallConfigServer, self).__init__(syscfg) + #9090 is used for cluster management server if self.syscfg.env.svrMode == "myCloud": - self.ports = "443 8080 8096 8250 8443".split() + self.ports = "443 8080 8096 8250 8443 9090".split() else: - self.ports = "8080 8096 8250".split() + self.ports = "8080 8096 8250 9090".split() diff --git a/python/lib/cloudutils/serviceConfigServer.py b/python/lib/cloudutils/serviceConfigServer.py index 781e7e389c0..9ed4eec67bb 100644 --- a/python/lib/cloudutils/serviceConfigServer.py +++ b/python/lib/cloudutils/serviceConfigServer.py @@ -67,6 +67,7 @@ class cloudManagementConfig(serviceCfgBase): except: pass + self.syscfg.svo.stopService("cloud-management") if self.syscfg.svo.enableService("cloud-management"): return True else: diff --git a/python/lib/cloudutils/syscfg.py b/python/lib/cloudutils/syscfg.py index 8956e08a3b9..1604a9be7b9 100644 --- a/python/lib/cloudutils/syscfg.py +++ b/python/lib/cloudutils/syscfg.py @@ -49,7 +49,7 @@ class sysConfig(object): self.services = [] def registerService(self, service): - self.services.append(service) + self.services.append(service(self)) def config(self): if not self.check(): @@ -124,6 +124,9 @@ class sysConfigServer(sysConfig): def check(self): if os.geteuid() != 0: raise CloudInternalException("Need to execute with root permission") + hostname = bash("hostname -f") + if not hostname.isSuccess(): + raise CloudInternalException("Checking hostname ... [Failed]\nNeed to have a Fully Qualified Domain Name as your hostname") return True class sysConfigServerRedhat(sysConfigServer): diff --git a/python/lib/cloudutils/utilities.py b/python/lib/cloudutils/utilities.py index 3aca6d5d880..a9663a1207c 100644 --- a/python/lib/cloudutils/utilities.py +++ b/python/lib/cloudutils/utilities.py @@ -110,7 +110,7 @@ class serviceOpsRedhat(serviceOps): def isServiceRunning(self, servicename): try: o = bash("service " + servicename + " status") - if "start/running" in o.getStdout(): + if "running" in o.getStdout() or "start" in o.getStdout(): return True else: return False @@ -146,7 +146,7 @@ class serviceOpsUbuntu(serviceOps): def isServiceRunning(self, servicename): try: o = bash("service " + servicename + " status") - if "start/running" in o.getStdout(): + if "running" in o.getStdout() or "start" in o.getStdout(): return True else: return False