From f629e703d129e986a84edc86328e95212c3e62f7 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Sat, 4 Feb 2012 20:41:27 -0800 Subject: [PATCH] Starting to add melange + client. --- conf/stack.ini | 8 +++ devstack/components/melange.py | 71 +++++++++++++++++++++++++++ devstack/components/melange_client.py | 71 +++++++++++++++++++++++++++ devstack/components/swift.py | 7 +-- devstack/progs/common.py | 57 ++++++++++----------- devstack/settings.py | 5 ++ utils/describe.py | 4 ++ 7 files changed, 189 insertions(+), 34 deletions(-) create mode 100644 devstack/components/melange.py create mode 100644 devstack/components/melange_client.py diff --git a/conf/stack.ini b/conf/stack.ini index 90bf80d6..96130b44 100644 --- a/conf/stack.ini +++ b/conf/stack.ini @@ -239,6 +239,14 @@ quantum_branch = master quantum_client_repo = https://github.com/openstack/python-quantumclient.git quantum_client_branch = master +# Melange service +melange_repo = https://github.com/openstack/melange.git +melange_branch = master + +# Python melange client library +melangeclient_repo = https://github.com/openstack/python-melangeclient.git +melangeclient_branch = master + [quantum] # Where your quantum host is at diff --git a/devstack/components/melange.py b/devstack/components/melange.py new file mode 100644 index 00000000..05ee1c5a --- /dev/null +++ b/devstack/components/melange.py @@ -0,0 +1,71 @@ +# vim: tabstop=4 shiftwidth=4 softtabstop=4 + +# Copyright (C) 2012 Yahoo! Inc. All Rights Reserved. +# +# 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. + +from devstack import component as comp +from devstack import log as logging +from devstack import settings +from devstack import shell as sh +from devstack import utils + +LOG = logging.getLogger("devstack.components.melange") + +#id +TYPE = settings.MELANGE + +#the pkg json files melange requires for installation +REQ_PKGS = ['general.json'] + + +class MelangeUninstaller(comp.PythonUninstallComponent): + def __init__(self, *args, **kargs): + comp.PythonUninstallComponent.__init__(self, TYPE, *args, **kargs) + + +class MelangeInstaller(comp.PythonInstallComponent): + def __init__(self, *args, **kargs): + comp.PythonInstallComponent.__init__(self, TYPE, *args, **kargs) + + def _get_download_locations(self): + places = list() + places.append({ + 'uri': ("git", "melange_repo"), + 'branch': ("git", "melange_branch"), + }) + return places + + def _get_pkgs(self): + return list(REQ_PKGS) + + +class MelangeRuntime(comp.EmptyRuntime): + def __init__(self, *args, **kargs): + comp.EmptyRuntime.__init__(self, TYPE, *args, **kargs) + + +def describe(opts=None): + description = """ + Module: {module_name} + Description: + {description} + Component options: + {component_opts} +""" + params = dict() + params['component_opts'] = "TBD" + params['module_name'] = __name__ + params['description'] = __doc__ or "Handles actions for the melange component." + out = description.format(**params) + return out.strip("\n") diff --git a/devstack/components/melange_client.py b/devstack/components/melange_client.py new file mode 100644 index 00000000..2e6e4320 --- /dev/null +++ b/devstack/components/melange_client.py @@ -0,0 +1,71 @@ +# vim: tabstop=4 shiftwidth=4 softtabstop=4 + +# Copyright (C) 2012 Yahoo! Inc. All Rights Reserved. +# +# 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. + +from devstack import component as comp +from devstack import log as logging +from devstack import settings +from devstack import shell as sh +from devstack import utils + +LOG = logging.getLogger("devstack.components.melange_client") + +#id +TYPE = settings.MELANGE_CLIENT + +#the pkg json files melange client requires for installation +REQ_PKGS = ['general.json'] + + +class MelangeClientUninstaller(comp.PythonUninstallComponent): + def __init__(self, *args, **kargs): + comp.PythonUninstallComponent.__init__(self, TYPE, *args, **kargs) + + +class MelangeClientInstaller(comp.PythonInstallComponent): + def __init__(self, *args, **kargs): + comp.PythonInstallComponent.__init__(self, TYPE, *args, **kargs) + + def _get_download_locations(self): + places = list() + places.append({ + 'uri': ("git", "melangeclient_repo"), + 'branch': ("git", "melangeclient_branch"), + }) + return places + + def _get_pkgs(self): + return list(REQ_PKGS) + + +class MelangeClientRuntime(comp.EmptyRuntime): + def __init__(self, *args, **kargs): + comp.EmptyRuntime.__init__(self, TYPE, *args, **kargs) + + +def describe(opts=None): + description = """ + Module: {module_name} + Description: + {description} + Component options: + {component_opts} +""" + params = dict() + params['component_opts'] = "TBD" + params['module_name'] = __name__ + params['description'] = __doc__ or "Handles actions for the melange client component." + out = description.format(**params) + return out.strip("\n") diff --git a/devstack/components/swift.py b/devstack/components/swift.py index 7712b3d1..1867e405 100644 --- a/devstack/components/swift.py +++ b/devstack/components/swift.py @@ -70,11 +70,12 @@ class SwiftInstaller(comp.PythonInstallComponent): self.auth_server = 'keystone' def _get_download_locations(self): - return comp.PythonInstallComponent._get_download_locations(self) + [ - { + places = list() + places.append({ 'uri': ('git', 'swift_repo'), 'branch': ('git', 'swift_branch') - }] + }) + return places def _get_config_files(self): return list(CONFIGS) diff --git a/devstack/progs/common.py b/devstack/progs/common.py index 73646b39..b6ecb395 100644 --- a/devstack/progs/common.py +++ b/devstack/progs/common.py @@ -25,6 +25,8 @@ from devstack.components import glance from devstack.components import horizon from devstack.components import keystone from devstack.components import keystone_client +from devstack.components import melange +from devstack.components import melange_client from devstack.components import nova from devstack.components import nova_client from devstack.components import novnc @@ -37,67 +39,60 @@ from devstack.components import swift_keystone # This determines what classes to use to install/uninstall/... ACTION_CLASSES = { settings.INSTALL: { - settings.NOVA: nova.NovaInstaller, + settings.DB: db.DBInstaller, settings.GLANCE: glance.GlanceInstaller, - settings.QUANTUM: quantum.QuantumInstaller, - settings.SWIFT: swift.SwiftInstaller, - settings.SWIFT_KEYSTONE: swift_keystone.SwiftKeystoneInstaller, settings.HORIZON: horizon.HorizonInstaller, settings.KEYSTONE: keystone.KeystoneInstaller, - settings.DB: db.DBInstaller, - settings.RABBIT: rabbit.RabbitInstaller, settings.KEYSTONE_CLIENT: keystone_client.KeyStoneClientInstaller, + settings.MELANGE: melange.MelangeInstaller, + settings.MELANGE_CLIENT: melange_client.MelangeClientInstaller, + settings.NOVA: nova.NovaInstaller, settings.NOVA_CLIENT: nova_client.NovaClientInstaller, settings.NOVNC: novnc.NoVNCInstaller, + settings.QUANTUM: quantum.QuantumInstaller, settings.QUANTUM_CLIENT: quantum_client.QuantumClientInstaller, + settings.RABBIT: rabbit.RabbitInstaller, + settings.SWIFT: swift.SwiftInstaller, + settings.SWIFT_KEYSTONE: swift_keystone.SwiftKeystoneInstaller, }, settings.UNINSTALL: { - settings.NOVA: nova.NovaUninstaller, + settings.DB: db.DBUninstaller, settings.GLANCE: glance.GlanceUninstaller, - settings.QUANTUM: quantum.QuantumUninstaller, - settings.SWIFT: swift.SwiftUninstaller, - settings.SWIFT_KEYSTONE: swift_keystone.SwiftKeystoneUninstaller, settings.HORIZON: horizon.HorizonUninstaller, settings.KEYSTONE: keystone.KeystoneUninstaller, - settings.DB: db.DBUninstaller, - settings.RABBIT: rabbit.RabbitUninstaller, settings.KEYSTONE_CLIENT: keystone_client.KeyStoneClientUninstaller, + settings.MELANGE: melange.MelangeUninstaller, + settings.MELANGE_CLIENT: melange_client.MelangeClientUninstaller, + settings.NOVA: nova.NovaUninstaller, settings.NOVA_CLIENT: nova_client.NovaClientUninstaller, settings.NOVNC: novnc.NoVNCUninstaller, + settings.QUANTUM: quantum.QuantumUninstaller, settings.QUANTUM_CLIENT: quantum_client.QuantumClientUninstaller, + settings.RABBIT: rabbit.RabbitUninstaller, + settings.SWIFT: swift.SwiftUninstaller, + settings.SWIFT_KEYSTONE: swift_keystone.SwiftKeystoneUninstaller, }, settings.START: { - settings.NOVA: nova.NovaRuntime, + settings.DB: db.DBRuntime, settings.GLANCE: glance.GlanceRuntime, - settings.QUANTUM: quantum.QuantumRuntime, - settings.SWIFT: swift.SwiftRuntime, - settings.SWIFT_KEYSTONE: swift_keystone.SwiftKeystoneRuntime, settings.HORIZON: horizon.HorizonRuntime, settings.KEYSTONE: keystone.KeystoneRuntime, - settings.DB: db.DBRuntime, - settings.RABBIT: rabbit.RabbitRuntime, settings.KEYSTONE_CLIENT: keystone_client.KeyStoneClientRuntime, + settings.MELANGE: melange.MelangeRuntime, + settings.MELANGE_CLIENT: melange_client.MelangeClientRuntime, + settings.NOVA: nova.NovaRuntime, settings.NOVA_CLIENT: nova_client.NovaClientRuntime, settings.NOVNC: novnc.NoVNCRuntime, - settings.QUANTUM_CLIENT: quantum_client.QuantumClientRuntime, - }, - settings.STOP: { - settings.NOVA: nova.NovaRuntime, - settings.GLANCE: glance.GlanceRuntime, settings.QUANTUM: quantum.QuantumRuntime, + settings.QUANTUM_CLIENT: quantum_client.QuantumClientRuntime, + settings.RABBIT: rabbit.RabbitRuntime, settings.SWIFT: swift.SwiftRuntime, settings.SWIFT_KEYSTONE: swift_keystone.SwiftKeystoneRuntime, - settings.HORIZON: horizon.HorizonRuntime, - settings.KEYSTONE: keystone.KeystoneRuntime, - settings.DB: db.DBRuntime, - settings.RABBIT: rabbit.RabbitRuntime, - settings.KEYSTONE_CLIENT: keystone_client.KeyStoneClientRuntime, - settings.NOVA_CLIENT: nova_client.NovaClientRuntime, - settings.NOVNC: novnc.NoVNCRuntime, - settings.QUANTUM_CLIENT: quantum_client.QuantumClientRuntime, }, } +ACTION_CLASSES[settings.STOP] = ACTION_CLASSES[settings.START] + _FAKE_ROOT_DIR = tempfile.gettempdir() diff --git a/devstack/settings.py b/devstack/settings.py index 52b118b5..573e45c3 100644 --- a/devstack/settings.py +++ b/devstack/settings.py @@ -48,6 +48,8 @@ DB = "db" RABBIT = "rabbit" NOVNC = 'novnc' XVNC = 'xvnc' +MELANGE = 'melange' +MELANGE_CLIENT = 'melange-client' COMPONENT_NAMES = [ NOVA, NOVA_CLIENT, GLANCE, @@ -58,6 +60,7 @@ COMPONENT_NAMES = [ DB, RABBIT, NOVNC, + MELANGE, MELANGE_CLIENT, ] # When a component is asked for it may @@ -80,6 +83,8 @@ COMPONENT_DEPENDENCIES = { QUANTUM: [DB, QUANTUM_CLIENT], NOVNC: [NOVA], QUANTUM_CLIENT: [], + MELANGE: [], + MELANGE_CLIENT: [], } # Default subdirs of a components root directory diff --git a/utils/describe.py b/utils/describe.py index 7aaddb77..8d1bea69 100644 --- a/utils/describe.py +++ b/utils/describe.py @@ -32,6 +32,8 @@ from devstack.components import glance from devstack.components import horizon from devstack.components import keystone from devstack.components import keystone_client +from devstack.components import melange +from devstack.components import melange_client from devstack.components import nova from devstack.components import nova_client from devstack.components import novnc @@ -58,6 +60,8 @@ _DESCR_MAP = { settings.SWIFT_KEYSTONE: swift_keystone.describe, settings.NOVNC: novnc.describe, settings.QUANTUM_CLIENT: quantum_client.describe, + settings.MELANGE: melange.describe, + settings.MELANGE_CLIENT: melange_client.describe, }