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 log as logging
|
2012-01-22 16:09:47 -08:00
|
|
|
from devstack import settings
|
2012-01-20 14:12:20 -08:00
|
|
|
from devstack import shell as sh
|
|
|
|
from devstack.components import nova_conf as nc
|
|
|
|
|
|
|
|
LOG = logging.getLogger("devstack.components.nova")
|
2012-01-20 17:00:23 -08:00
|
|
|
|
2012-01-19 14:04:37 -08:00
|
|
|
API_CONF = "nova.conf"
|
2012-01-20 17:00:23 -08:00
|
|
|
PASTE_CONF = 'nova-api-paste.ini'
|
2012-01-19 14:04:37 -08:00
|
|
|
CONFIGS = [API_CONF]
|
2012-01-20 17:00:23 -08:00
|
|
|
|
2012-01-19 14:04:37 -08:00
|
|
|
DB_NAME = "nova"
|
2012-01-20 17:00:23 -08:00
|
|
|
BIN_DIR = 'bin'
|
2012-01-22 16:09:47 -08:00
|
|
|
TYPE = settings.NOVA
|
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 17:11:50 -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-20 17:00:23 -08:00
|
|
|
self.git_repo = self.cfg.get("git", "nova_repo")
|
|
|
|
self.git_branch = self.cfg.get("git", "nova_branch")
|
2012-01-20 19:05:13 -08:00
|
|
|
self.bindir = sh.joinpths(self.appdir, BIN_DIR)
|
2012-01-19 14:04:37 -08:00
|
|
|
|
2012-01-20 19:05:13 -08:00
|
|
|
def _get_download_locations(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({
|
2012-01-20 17:00:23 -08:00
|
|
|
'uri': self.git_repo,
|
|
|
|
'branch': self.git_branch,
|
2012-01-19 17:47:16 -08:00
|
|
|
})
|
|
|
|
return places
|
2012-01-20 17:11:50 -08:00
|
|
|
|
2012-01-20 17:00:23 -08:00
|
|
|
def _generate_nova_conf(self):
|
2012-01-20 19:05:13 -08:00
|
|
|
LOG.debug("Generating dynamic content for nova configuration")
|
2012-01-20 17:00:23 -08:00
|
|
|
dirs = dict()
|
|
|
|
dirs['app'] = self.appdir
|
|
|
|
dirs['cfg'] = self.cfgdir
|
|
|
|
dirs['bin'] = self.bindir
|
2012-01-20 19:05:13 -08:00
|
|
|
conf_gen = nc.NovaConfigurator(self.cfg, self.all_components)
|
2012-01-20 17:00:23 -08:00
|
|
|
nova_conf = conf_gen.configure(dirs)
|
|
|
|
tgtfn = self._get_target_config_name(API_CONF)
|
2012-01-20 19:05:13 -08:00
|
|
|
LOG.info("Created nova configuration:")
|
|
|
|
LOG.info(nova_conf)
|
|
|
|
LOG.debug("Placing it in %s" % (tgtfn))
|
2012-01-20 17:00:23 -08:00
|
|
|
sh.write_file(tgtfn, nova_conf)
|
2012-01-20 17:11:50 -08:00
|
|
|
#we configured one file, return that we did that
|
2012-01-19 17:47:16 -08:00
|
|
|
return 1
|
|
|
|
|
2012-01-20 17:00:23 -08:00
|
|
|
def _configure_files(self):
|
|
|
|
return self._generate_nova_conf()
|
|
|
|
|
2012-01-19 17:47:16 -08:00
|
|
|
|
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)
|