diff --git a/doc/source/dev/dev-quickstart.rst b/doc/source/dev/dev-quickstart.rst index a8547ade15..74212d80ef 100644 --- a/doc/source/dev/dev-quickstart.rst +++ b/doc/source/dev/dev-quickstart.rst @@ -210,7 +210,7 @@ Next start the API service:: Next start the ackend service in a new window:: - magnum-backend + magnum-conductor Create a new shell, and source the devstack openrc script:: @@ -230,7 +230,7 @@ The existing bays can be listed as follows:: magnum bay-list If you make some code changes and want to test their effects, -just restart either magnum-api or magnum-backend. the -e option to +just restart either magnum-api or magnum-conductor. the -e option to pip install will link to the location from where the source code was installed. diff --git a/magnum/api/controllers/v1/bay.py b/magnum/api/controllers/v1/bay.py index bf66ee14c5..23fd4fb67c 100644 --- a/magnum/api/controllers/v1/bay.py +++ b/magnum/api/controllers/v1/bay.py @@ -26,9 +26,9 @@ from magnum.api.controllers import link from magnum.api.controllers.v1 import collection from magnum.api.controllers.v1 import types from magnum.api.controllers.v1 import utils as api_utils -from magnum.backend import api from magnum.common import context from magnum.common import exception +from magnum.conductor import api from magnum import objects diff --git a/magnum/backend/__init__.py b/magnum/backend/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/magnum/backend/handlers/__init__.py b/magnum/backend/handlers/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/magnum/backend/manager.py b/magnum/backend/manager.py deleted file mode 100644 index ffc3a462fd..0000000000 --- a/magnum/backend/manager.py +++ /dev/null @@ -1,80 +0,0 @@ -# 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 eventlet import greenpool -from oslo.config import cfg -from oslo import messaging - -from magnum.common import exception -from magnum.openstack.common import periodic_task - -MANAGER_TOPIC = 'magnum_backend' - - -class BackendManager(periodic_task.PeriodicTasks): - """Magnum Backend manager main class.""" - - RPC_API_VERSION = '1.0' - - target = messaging.Target(version=RPC_API_VERSION) - - def __init__(self, host, topic): - super(BackendManager, self).__init__() - if not host: - host = cfg.CONF.host - self.host = host - self.topic = topic - - def _conductor_service_record_keepalive(self): - while not self._keepalive_evt.is_set(): - self._keepalive_evt.wait(1) - - def _spawn_worker(self, func, *args, **kwargs): - - """Create a greenthread to run func(*args, **kwargs). - - Spawns a greenthread if there are free slots in pool, otherwise raises - exception. Execution control returns immediately to the caller. - - :returns: GreenThread object. - :raises: NoFreeConductorWorker if worker pool is currently full. - - """ - if self._worker_pool.free(): - return self._worker_pool.spawn(func, *args, **kwargs) - else: - raise exception.NoFreeConductorWorker() - - def create_bay(self, context, bay): - bay.create() - return bay - - def init_host(self): - self._worker_pool = greenpool.GreenPool(8) - - # Spawn a dedicated greenthread for the keepalive -# self._keepalive_evt = threading.Event() -# self._spawn_worker(self._conductor_service_record_keepalive) - - def del_host(self): - pass - - def periodic_tasks(self, context, raise_on_error=False): - """Periodic tasks are run at pre-specified interval.""" - res = self.run_periodic_tasks(context, raise_on_error=raise_on_error) - return res - - @periodic_task.periodic_task - def trigger(self, context): - pass diff --git a/magnum/cmd/backend.py b/magnum/cmd/conductor.py similarity index 66% rename from magnum/cmd/backend.py rename to magnum/cmd/conductor.py index d8bae288fb..712f01c412 100644 --- a/magnum/cmd/backend.py +++ b/magnum/cmd/conductor.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""Starter script for the Magnum backend service.""" +"""Starter script for the Magnum conductor service.""" import logging as std_logging import os @@ -20,10 +20,10 @@ import sys from oslo.config import cfg -from magnum.backend.handlers import bay_ironic as bay_ironic -from magnum.backend.handlers import docker as docker_backend -from magnum.backend.handlers import k8s as k8s_backend from magnum.common import rpc_service as service +from magnum.conductor.handlers import bay_ironic as bay_ironic +from magnum.conductor.handlers import docker as docker_conductor +from magnum.conductor.handlers import k8s as k8s_conductor from magnum.openstack.common._i18n import _ from magnum.openstack.common import log as logging @@ -38,13 +38,13 @@ def main(): LOG.debug("Configuration:") cfg.CONF.log_opt_values(LOG, std_logging.DEBUG) - cfg.CONF.import_opt('topic', 'magnum.backend.config', group='backend') - cfg.CONF.import_opt('host', 'magnum.backend.config', group='backend') + cfg.CONF.import_opt('topic', 'magnum.conductor.config', group='conductor') + cfg.CONF.import_opt('host', 'magnum.conductor.config', group='conductor') endpoints = [ - docker_backend.Handler(), - k8s_backend.Handler(), + docker_conductor.Handler(), + k8s_conductor.Handler(), bay_ironic.Handler() ] - server = service.Service(cfg.CONF.backend.topic, - cfg.CONF.backend.host, endpoints) + server = service.Service(cfg.CONF.conductor.topic, + cfg.CONF.conductor.host, endpoints) server.serve() diff --git a/magnum/backend/api.py b/magnum/conductor/api.py similarity index 91% rename from magnum/backend/api.py rename to magnum/conductor/api.py index 2cf3190a90..fede067da8 100644 --- a/magnum/backend/api.py +++ b/magnum/conductor/api.py @@ -19,15 +19,15 @@ from magnum import objects # The Backend API class serves as a AMQP client for communicating -# on a topic exchange specific to the backends. This allows the ReST -# API to trigger operations on the backends +# on a topic exchange specific to the conductors. This allows the ReST +# API to trigger operations on the conductors class API(service.API): def __init__(self, transport=None, context=None): - cfg.CONF.import_opt('topic', 'magnum.backend.config', - group='backend') + cfg.CONF.import_opt('topic', 'magnum.conductor.config', + group='conductor') super(API, self).__init__(transport, context, - topic=cfg.CONF.backend.topic) + topic=cfg.CONF.conductor.topic) # Bay Operations diff --git a/magnum/backend/config.py b/magnum/conductor/config.py similarity index 78% rename from magnum/backend/config.py rename to magnum/conductor/config.py index 0792c4db77..205521b42a 100644 --- a/magnum/backend/config.py +++ b/magnum/conductor/config.py @@ -19,15 +19,15 @@ from oslo.config import cfg SERVICE_OPTS = [ cfg.StrOpt('topic', - default='magnum-backend', - help='The queue to add backend tasks to'), + default='magnum-conductor', + help='The queue to add conductor tasks to'), cfg.StrOpt('host', default='localhost', - help='The location of the backend rpc queue'), + help='The location of the conductor rpc queue'), ] opt_group = cfg.OptGroup( - name='backend', - title='Options for the magnum-backend service') + 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/backend/handlers/bay_ironic.py b/magnum/conductor/handlers/bay_ironic.py similarity index 100% rename from magnum/backend/handlers/bay_ironic.py rename to magnum/conductor/handlers/bay_ironic.py diff --git a/magnum/backend/handlers/docker.py b/magnum/conductor/handlers/docker.py similarity index 100% rename from magnum/backend/handlers/docker.py rename to magnum/conductor/handlers/docker.py diff --git a/magnum/backend/handlers/k8s.py b/magnum/conductor/handlers/k8s.py similarity index 100% rename from magnum/backend/handlers/k8s.py rename to magnum/conductor/handlers/k8s.py diff --git a/magnum/tests/api/controllers/v1/test_all_objects.py b/magnum/tests/api/controllers/v1/test_all_objects.py index 11ef2b8293..5d0b30bd7b 100644 --- a/magnum/tests/api/controllers/v1/test_all_objects.py +++ b/magnum/tests/api/controllers/v1/test_all_objects.py @@ -10,7 +10,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from magnum.backend import api +from magnum.conductor import api from magnum import tests from magnum.tests.db import base as db_base diff --git a/setup.cfg b/setup.cfg index e459516a85..7456522f86 100644 --- a/setup.cfg +++ b/setup.cfg @@ -46,7 +46,7 @@ output_file = magnum/locale/magnum.pot [entry_points] console_scripts = magnum-api = magnum.cmd.api:main - magnum-backend = magnum.cmd.backend:main + magnum-conductor = magnum.cmd.conductor:main magnum-db-manage = magnum.cmd.db_manage:main oslo.config.opts =