2012-01-11 12:47:33 -08:00
|
|
|
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
|
|
|
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
|
|
# not use this file except in compliance with the License. You may obtain
|
|
|
|
# a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
# License for the specific language governing permissions and limitations
|
|
|
|
# under the License.
|
|
|
|
|
|
|
|
|
2012-01-20 14:12:20 -08:00
|
|
|
from devstack import component as comp
|
|
|
|
from devstack import constants
|
|
|
|
from devstack import log as logging
|
|
|
|
from devstack import shell as sh
|
|
|
|
from devstack import utils
|
|
|
|
from devstack.components import nova_conf as nc
|
|
|
|
|
|
|
|
LOG = logging.getLogger("devstack.components.nova")
|
2012-01-19 14:04:37 -08:00
|
|
|
API_CONF = "nova.conf"
|
|
|
|
CONFIGS = [API_CONF]
|
|
|
|
DB_NAME = "nova"
|
2012-01-20 14:12:20 -08:00
|
|
|
TYPE = constants.NOVA
|
2012-01-11 12:47:33 -08:00
|
|
|
|
2012-01-19 14:04:37 -08:00
|
|
|
#what to start
|
|
|
|
# Does this start nova-compute, nova-volume, nova-network, nova-scheduler
|
|
|
|
# and optionally nova-wsproxy?
|
|
|
|
#APP_OPTIONS = {
|
|
|
|
# 'glance-api': ['--config-file', joinpths('%ROOT%', "etc", API_CONF)],
|
|
|
|
# 'glance-registry': ['--config-file', joinpths('%ROOT%', "etc", REG_CONF)]
|
|
|
|
#}
|
2012-01-11 12:47:33 -08:00
|
|
|
|
|
|
|
|
2012-01-20 14:12:20 -08:00
|
|
|
class NovaUninstaller(comp.PythonUninstallComponent):
|
2012-01-11 12:47:33 -08:00
|
|
|
def __init__(self, *args, **kargs):
|
2012-01-20 14:12:20 -08:00
|
|
|
comp.PythonUninstallComponent.__init__(self, TYPE, *args, **kargs)
|
2012-01-19 14:04:37 -08:00
|
|
|
#self.cfgdir = joinpths(self.appdir, CONFIG_ACTUAL_DIR)
|
2012-01-11 12:47:33 -08:00
|
|
|
|
|
|
|
|
2012-01-20 14:12:20 -08:00
|
|
|
class NovaInstaller(comp.PythonInstallComponent):
|
2012-01-11 12:47:33 -08:00
|
|
|
def __init__(self, *args, **kargs):
|
2012-01-20 14:12:20 -08:00
|
|
|
comp.PythonInstallComponent.__init__(self, TYPE, *args, **kargs)
|
2012-01-19 14:04:37 -08:00
|
|
|
self.gitloc = self.cfg.get("git", "nova_repo")
|
|
|
|
self.brch = self.cfg.get("git", "nova_branch")
|
2012-01-19 17:47:16 -08:00
|
|
|
# TBD is this the install location of the conf file?
|
2012-01-19 14:04:37 -08:00
|
|
|
#self.cfgdir = joinpths(self.appdir, CONFIG_ACTUAL_DIR)
|
|
|
|
|
|
|
|
def _get_download_location(self):
|
2012-01-20 14:12:20 -08:00
|
|
|
places = comp.PythonInstallComponent._get_download_locations(self)
|
2012-01-19 17:47:16 -08:00
|
|
|
places.append({
|
|
|
|
'uri': self.gitloc,
|
|
|
|
'branch': self.brch,
|
|
|
|
})
|
|
|
|
return places
|
|
|
|
|
|
|
|
def configure(self):
|
|
|
|
# FIXME, is this necessary? Is it for the template source?
|
2012-01-20 14:12:20 -08:00
|
|
|
dirsmade = sh.mkdirslist(self.cfgdir)
|
2012-01-19 17:47:16 -08:00
|
|
|
self.tracewriter.dir_made(*dirsmade)
|
2012-01-20 14:12:20 -08:00
|
|
|
nconf = nc.NovaConf(self)
|
2012-01-19 17:47:16 -08:00
|
|
|
LOG.info("Getting dynamic content for nova.conf")
|
|
|
|
# Get dynamic content for nova.conf
|
|
|
|
lines = nconf.generate()
|
|
|
|
LOG.debug("Got conf lines, %s" % (lines))
|
|
|
|
# Set up and write lines to the file
|
|
|
|
fn = API_CONF
|
|
|
|
tgtfn = self._get_full_config_name(fn)
|
2012-01-20 14:12:20 -08:00
|
|
|
dirsmade = sh.mkdirslist(os.path.dirname(tgtfn))
|
2012-01-19 17:47:16 -08:00
|
|
|
self.tracewriter.dir_made(*dirsmade)
|
|
|
|
LOG.info("Writing configuration file %s" % (tgtfn))
|
|
|
|
#this trace is used to remove the files configured
|
2012-01-20 14:12:20 -08:00
|
|
|
sh.write_file(tgtfn, os.linesep.join(lines))
|
2012-01-19 17:47:16 -08:00
|
|
|
self.tracewriter.cfg_write(tgtfn)
|
|
|
|
return 1
|
|
|
|
|
|
|
|
|
2012-01-20 14:12:20 -08:00
|
|
|
class NovaRuntime(comp.PythonRuntime):
|
2012-01-11 12:47:33 -08:00
|
|
|
def __init__(self, *args, **kargs):
|
2012-01-20 14:12:20 -08:00
|
|
|
comp.PythonRuntime.__init__(self, TYPE, *args, **kargs)
|