self.errorAndExit("Cloud DB required file %s was not found"%f)
self.info(None, True)
defcheckDbserverHostname():
self.info("Checking mysql server hostname ...", None)
ifresolves_to_ipv6(self, self.port):
err="%s resolves to an IPv6 address. The CloudStack does not support IPv6 yet.\nPlease fix this issue in either /etc/hosts or your DNS configuration.\n"%self.host
self.errorAndExit(err)
self.info(None, True)
defcheckHostName():
self.info("Checking local machine hostname ...", None)
try:
output=socket.getfqdn()
exceptException, e:
err="The host name of this computer does not resolve to an IP address.\nPlease use your operating system's network setup tools to fix this ('hostname --fqdn' %s).\n"%e.__str__()
self.errorAndExit(err)
self.info(None, True)
defcheckSELinux():
self.info("Checking SELinux setup ...", None)
try:
check_selinux()
exceptCheckFailed, e:
self.info("checkSelinux failed with error continuing...", None)
self.errorAndContinue(e.__str__())
exceptOSError, e:
ife.errno==2: pass
else:
self.info("checkSelinux failed with error continuing...", None)
This command sets up the CloudStack Management Server and CloudStack Usage Server database configuration (connection credentials and host information) based on the first argument.
If the the --deploy-as option is present, this command will also connect to the database using the administrative credentials specified as the value for the --deploy-as argument, construct the database environment needed to run the CloudStack Management Server, and alter the password specified for the user in the first argument. In this case, the user name specified in --deploy-as= cannot be the same as the user name specified for the connection credentials that the CloudStack Management Server will be set up with.
If a server-setup.xml cloud setup information file is specified with the --auto option, this command will also construct a customized database environment according to the cloud setup information in the file.
The port and the password are optional and can be left out.. If host is omitted altogether, it will default to localhost.
Examples:
%prog cloud:secret
sets user cloud and password 'secret' up in
@MSCONF@/db.properties, using localhost as the
database server
%prog sheng:rules@192.168.1.1
sets these credentials up in @MSCONF@/db.properties
help="Region Id for the management server cluster")
self.parser.add_option("-c", "--db-conf-path", action="store", dest="dbConfPath", help="The path to find db.properties which hold db properties")
self.parser.add_option("-f", "--db-files-path", action="store", dest="dbFilesPath", help="The path to find sql files to create initial database(s)")
self.parser.add_option("-j", "--encryption-jar-path", action="store", dest="encryptionJarPath", help="The path to the jasypt library to be used to encrypt the values in db.properties")
self.parser.add_option("-n", "--encryption-key-file", action="store", dest="encryptionKeyFile", help="The name of the file in which encryption key to be generated")
self.parser.add_option("-b", "--mysql-bin-path", action="store", dest="mysqlbinpath", help="The mysql installed bin path")
print"CloudStack has successfully initialized database, you can check your database configuration in %s"%os.path.join(self.dbConfPath, 'db.properties')