From 54411f6265d5ab27ebb14087ccd00464763dca2a Mon Sep 17 00:00:00 2001 From: Steven Dake Date: Thu, 11 Dec 2014 12:55:01 -0700 Subject: [PATCH] Remove conductor Remove conductor. The backend will replace the conductor as the process name to be more consistent with other OpenStack projects. Change-Id: If69557b7ca02e48c65372cbb200d2f648613778e --- magnum/cmd/conductor.py | 46 --------------- magnum/conductor/api.py | 88 ---------------------------- magnum/conductor/config.py | 33 ----------- magnum/conductor/handlers/default.py | 82 -------------------------- setup.cfg | 1 - 5 files changed, 250 deletions(-) delete mode 100644 magnum/cmd/conductor.py delete mode 100644 magnum/conductor/api.py delete mode 100644 magnum/conductor/config.py delete mode 100644 magnum/conductor/handlers/default.py diff --git a/magnum/cmd/conductor.py b/magnum/cmd/conductor.py deleted file mode 100644 index ae17aec041..0000000000 --- a/magnum/cmd/conductor.py +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright 2014 - Rackspace Hosting -# -# 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. - -"""Starter script for the Magnum Conductor service.""" - -import logging as std_logging -import os -import sys - -from oslo.config import cfg - -from magnum.common.rpc import service -from magnum.conductor.handlers import default as default_handler -from magnum.openstack.common._i18n import _ -from magnum.openstack.common import log as logging - -LOG = logging.getLogger(__name__) - - -def main(): - cfg.CONF(sys.argv[1:], project='magnum') - logging.setup('magnum') - - LOG.info(_('Starting server in PID %s') % os.getpid()) - LOG.debug("Configuration:") - cfg.CONF.log_opt_values(LOG, std_logging.DEBUG) - - cfg.CONF.import_opt('topic', 'magnum.conductor.config', group='conductor') - cfg.CONF.import_opt('host', 'magnum.conductor.config', group='conductor') - endpoints = [ - default_handler.Handler(), - ] - server = service.Service(cfg.CONF.conductor.topic, - cfg.CONF.conductor.host, endpoints) - server.serve() diff --git a/magnum/conductor/api.py b/magnum/conductor/api.py deleted file mode 100644 index 96a4409554..0000000000 --- a/magnum/conductor/api.py +++ /dev/null @@ -1,88 +0,0 @@ -# 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. - -"""API for interfacing with Magnum Conductor.""" - -from oslo.config import cfg - -from magnum.common.rpc import service - - -# The Conductor API class serves as a AMQP client for communicating -# on a topic exchange specific to the conductor. This allows all database -# access to execute. - -class API(service.API): - def __init__(self, transport=None, context=None): - cfg.CONF.import_opt('topic', 'magnum.conductor.config', - group='conductor') - super(API, self).__init__(transport, context, - topic=cfg.CONF.conductor.topic) - - # Get objects from database - - def bay_get(self, uuid): - return self._call('bay_get', uuid=uuid) - - def service_get(self, uuid): - return self._call('service_get', uuid=uuid) - - def pod_get(self, uuid): - return self._call('pod_get', uuid=uuid) - - def container_get(self, uuid): - return self._call('container_get', uuid=uuid) - - # Put objects into database - - def bay_put(self, uuid=None, contents=None): - self._cast('bay_get', uuid=uuid, contents=contents) - - def service_put(self, uuid=None, contents=None): - self._cast('service_get', uuid=uuid, contents=contents) - - def pod_put(self, uuid=None, contents=None): - self._cast('pod_get', uuid=uuid, contents=contents) - - def container_put(self, uuid=None, contents=None): - self._cast('container_get', uuid=uuid, contents=contents) - - # Delete objects from database - - def bay_delete(self, uuid): - self._cast('bay_delete', uuid=uuid) - - def service_delete(self, uuid): - self._cast('service_delete', uuid=uuid) - - def pod_delete(self, uuid): - self._cast('pod_delete', uuid=uuid) - - def container_delete(self, uuid): - self._cast('container_delete', uuid=uuid) - - # List objects from database - # - # TODO(sdake) - this could probably use some filters and - # pagination for scalability - - def bay_list(self): - return self._call('bay_list') - - def service_list(self): - return self._call('service_list') - - def pod_list(self): - return self._call('pod_list') - - def container_list(self): - return self._call('container_list') diff --git a/magnum/conductor/config.py b/magnum/conductor/config.py deleted file mode 100644 index 01177f3ef4..0000000000 --- a/magnum/conductor/config.py +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright 2014 - Rackspace Hosting -# -# 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. - -"""Config options for Magnum Conductor service.""" - - -from oslo.config import cfg - -SERVICE_OPTS = [ - cfg.StrOpt('topic', - default='magnum-conductor', - help='The queue to add conductor tasks to'), - cfg.StrOpt('host', - default='localhost', - help='The location of the conductor rpc queue'), -] - -opt_group = cfg.OptGroup( - name='conductor', - title='Options for the magnum-conductor service') -cfg.CONF.register_group(opt_group) -cfg.CONF.register_opts(SERVICE_OPTS, opt_group) diff --git a/magnum/conductor/handlers/default.py b/magnum/conductor/handlers/default.py deleted file mode 100644 index 4b0ba783f2..0000000000 --- a/magnum/conductor/handlers/default.py +++ /dev/null @@ -1,82 +0,0 @@ -# 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. - -"""Magnum Conductor default handler.""" - -from magnum.openstack.common import log as logging - -LOG = logging.getLogger(__name__) - - -# These are the database operations - They are executed by the conductor -# service. API calls via AMQP trigger the handlers to be called. - -class Handler(object): - def __init__(self): - super(Handler, self).__init__() - # Open DB here I suspect - - def bay_get(uuid): - LOG.debug("bay_get %s" % uuid) - # return bay information dict - - def service_get(uuid): - LOG.debug("service_get %s" % uuid) - # return service information dict - - def pod_get(uuid): - LOG.debug("pod_get %s" % uuid) - # return pod information dict - - def container_get(uuid): - LOG.debug("container_get %s" % uuid) - # return container information dict - - def bay_put(uuid, contents): - LOG.debug("bay_put %s contents=%s" % (uuid, contents)) - - def service_put(uuid, contents): - LOG.debug("service_put %s contents=%s" % (uuid, contents)) - - def pod_put(uuid, contents): - LOG.debug("pod_put %s contents=%s" % (uuid, contents)) - - def container_put(uuid, contents): - LOG.debug("container_put %s contents=%s" % (uuid, contents)) - - def bay_delete(uuid): - LOG.debug("bay_delete %s" % uuid) - - def service_delete(uuid): - LOG.debug("bay_delete %s" % uuid) - - def pod_delete(uuid): - LOG.debug("pod_delete %s" % uuid) - - def container_delete(uuid): - LOG.debug("cotainer_delete %s" % uuid) - - def bay_list(): - LOG.debug("bay_list") - # return bay list dict - - def service_list(): - LOG.debug("service_list") - # return service list dict - - def pod_list(): - LOG.debug("pod_list") - # return pod list dict - - def container_list(): - LOG.debug("container_list") - # return container list dict diff --git a/setup.cfg b/setup.cfg index 925bf732bf..e459516a85 100644 --- a/setup.cfg +++ b/setup.cfg @@ -46,7 +46,6 @@ output_file = magnum/locale/magnum.pot [entry_points] console_scripts = magnum-api = magnum.cmd.api:main - magnum-conductor = magnum.cmd.conductor:main magnum-backend = magnum.cmd.backend:main magnum-db-manage = magnum.cmd.db_manage:main