Rename backend to conductor

The backend is a bad name for a process, so instead call it the conductor.

Change-Id: Iaeb574b9754fe2635a2b082a99216337130a19f9
This commit is contained in:
Steven Dake 2014-12-11 13:01:08 -07:00
parent 54411f6265
commit 9d46b771c5
13 changed files with 25 additions and 105 deletions

View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -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()

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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 =