Add support for not (re)starting server after cloud-setup-management.

This adds an option to the cloud-setup-management script to not start
the management server after a successful configuration of it. The
primary motivation for this is to avoid circular dependency issues on
systems that use systemd. When calling cloud-setup-management from a
unit with a Before= directive on a service depending on
cloudstack-management, the process will deadlock because
/usr/bin/service will delegate to systemd, which is waiting for the
Before service to start.
This commit is contained in:
jeff 2015-12-03 18:36:10 +00:00
parent 37cee3309c
commit e0e65f5cd6
3 changed files with 31 additions and 21 deletions

View File

@ -30,11 +30,14 @@ if __name__ == '__main__':
parser = OptionParser()
parser.add_option("--https", action="store_true", dest="https", help="Enable HTTPs connection of management server")
parser.add_option("--tomcat7", action="store_true", dest="tomcat7", help="Use Tomcat7 configuration files in Management Server")
parser.add_option("--no-start", action="store_true", dest="nostart", help="Do not start management server after successful configuration")
(options, args) = parser.parse_args()
if options.https:
glbEnv.svrMode = "HttpsServer"
if options.tomcat7:
glbEnv.svrConf = "Tomcat7"
if options.nostart:
glbEnv.noStart = True
glbEnv.mode = "Server"

View File

@ -20,6 +20,8 @@ class globalEnv:
self.mode = None
#server mode: normal/mycloud
self.svrMode = None
#noStart: do not start mgmt server after configuration?
self.noStart = False
#myCloud/Agent/Console
self.agentMode = None
#Tomcat6/Tomcat7

View File

@ -137,7 +137,12 @@ class cloudManagementConfig(serviceCfgBase):
pass
self.syscfg.svo.stopService("cloudstack-management")
if self.syscfg.env.noStart == False:
if self.syscfg.svo.enableService("cloudstack-management"):
return True
else:
raise CloudRuntimeException("Failed to configure %s, please see the /var/log/cloudstack/management/setupManagement.log for detail"%self.serviceName)
else:
print "Configured successfully, but not starting management server."
return True