Merge pull request #1162 from greenqloud/pr-no-start

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.

Executing the cloud-setup-management script with this new `--no-start` option will simply leave the management server stopped after a successful configuration. systemd can then be bypassed with `export _SYSTEMCTL_SKIP_REDIRECT=1` and using the init.d script.

* pr/1162:
  Add support for not (re)starting server after cloud-setup-management.

Signed-off-by: Remi Bergsma <github@remi.nl>
This commit is contained in:
Remi Bergsma 2015-12-07 21:06:18 +01:00
commit e9de865989
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

@ -139,7 +139,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