From 8eb63c2078369d872737679cf8ab5425b7c83e19 Mon Sep 17 00:00:00 2001 From: Devananda van der Veen Date: Sat, 22 Jun 2013 12:10:21 -0700 Subject: [PATCH] Rename "manager" to "conductor" This rename to "conductor" more clearly communicates that this service has a many-to-many relationship. One or more service instances coordinate between each other to conduct actions on a set of nodes, using guarded locks to prevent conflicting simultaneous actions on any given node. The old name "manager" suggested a more one-to-many relationship, which is not the design pattern which we use here. Rename ironic/manager to ironic/conductor Rename ironic.manager.manager.ManagerService to ironic.conductor.manager.ConductorManager Rename ironic-manager to ironic-conductor Update docs too Change-Id: I3191be72a44bdaf14c763ce7519a7ae9066b2bc5 --- doc/source/dev/architecture.rst | 16 ++++----- doc/source/dev/cmd.rst | 2 +- doc/source/dev/conductor.rst | 10 ++++++ doc/source/dev/manager.rst | 10 ------ doc/source/index.rst | 7 ++-- ironic/api/hooks.py | 4 +-- ironic/cmd/{manager.py => conductor.py} | 4 +-- ironic/{manager => conductor}/__init__.py | 0 ironic/{manager => conductor}/manager.py | 34 +++++++++---------- .../resource_manager.py | 4 +-- ironic/{manager => conductor}/rpcapi.py | 10 +++--- ironic/{manager => conductor}/task_manager.py | 8 ++--- ironic/drivers/modules/ipmi.py | 2 +- ironic/drivers/modules/ssh.py | 2 +- .../tests/{manager => conductor}/__init__.py | 0 .../{manager => conductor}/test_manager.py | 6 ++-- .../{manager => conductor}/test_rpcapi.py | 10 +++--- .../test_task_manager.py | 6 ++-- .../{manager => conductor}/test_utils.py | 4 +-- ironic/tests/{manager => conductor}/utils.py | 2 +- ironic/tests/drivers/test_ipmi.py | 4 +-- ironic/tests/drivers/test_ssh.py | 4 +-- setup.cfg | 2 +- 23 files changed, 76 insertions(+), 75 deletions(-) create mode 100644 doc/source/dev/conductor.rst delete mode 100644 doc/source/dev/manager.rst rename ironic/cmd/{manager.py => conductor.py} (91%) rename ironic/{manager => conductor}/__init__.py (100%) rename ironic/{manager => conductor}/manager.py (64%) rename ironic/{manager => conductor}/resource_manager.py (95%) rename ironic/{manager => conductor}/rpcapi.py (85%) rename ironic/{manager => conductor}/task_manager.py (95%) rename ironic/tests/{manager => conductor}/__init__.py (100%) rename ironic/tests/{manager => conductor}/test_manager.py (93%) rename ironic/tests/{manager => conductor}/test_rpcapi.py (90%) rename ironic/tests/{manager => conductor}/test_task_manager.py (97%) rename ironic/tests/{manager => conductor}/test_utils.py (96%) rename ironic/tests/{manager => conductor}/utils.py (98%) diff --git a/doc/source/dev/architecture.rst b/doc/source/dev/architecture.rst index 8c690f6c8a..d8f8c2cfa6 100644 --- a/doc/source/dev/architecture.rst +++ b/doc/source/dev/architecture.rst @@ -11,12 +11,12 @@ An Ironic deployment will be composed of the following components: - A RESTful `API service`_, by which operators and other services may interact with the managed bare metal servers. -- A `Manager service`_, which does the bulk of the work. Functionality is - exposed via the `API service`_. The Manager and API services communicate via +- A `Conductor service`_, which does the bulk of the work. Functionality is + exposed via the `API service`_. The Conductor and API services communicate via RPC. -- A Database and `DB API`_ for storing the state of the Manager and Drivers. +- A Database and `DB API`_ for storing the state of the Conductor and Drivers. - One or more Deployment Agents, which provide local control over the - hardware which is not available remotely to the Manager. A ramdisk should be + hardware which is not available remotely to the Conductor. A ramdisk should be built which contains one of these agents, eg. with `diskimage-builder`_. This ramdisk can be booted on-demand. @@ -26,18 +26,18 @@ Drivers ======= The internal driver API provides a consistent interface between the -Manager service and the driver implementations. There are two types of drivers: +Conductor service and the driver implementations. There are two types of drivers: - `ControlDrivers`_ manage the hardware, performing functions such as power on/off, toggle boot device, etc. - `DeployDrivers`_ handle the task of booting a temporary ramdisk, formatting drives, and putting a persistent image onto the hardware. - Driver implementations are loaded and instantiated via entrypoints when the - `Manager service`_ starts. Each Node record stored in the database indicates + `Conductor service`_ starts. Each Node record stored in the database indicates which drivers should manage it. When a task is started on that node, information about the node and task is passed to the corresponding driver. In this way, heterogeneous hardware deployments can be managed by a single - Manager service. + Conductor service. In addition to the two types of drivers, there are three categories of driver functionality: core, standardized, and vendor: @@ -76,7 +76,7 @@ deployment using virtual machines), an `SSHPowerDriver`_ is also supplied. .. _API service: /api/ironic.api.controllers.v1.html -.. _Manager service: /api/ironic.manager.manager.html +.. _Conductor service: /api/ironic.conductor.manager.html .. _DB API: /api/ironic.db.api.html .. _ControlDrivers: /api/ironic.drivers.base.html#ironic.drivers.base.ControlDriver .. _DeployDrivers: /api/ironic.drivers.base.html#ironic.drivers.base.DeployDriver diff --git a/doc/source/dev/cmd.rst b/doc/source/dev/cmd.rst index e8180e58f2..bfe316a554 100644 --- a/doc/source/dev/cmd.rst +++ b/doc/source/dev/cmd.rst @@ -7,4 +7,4 @@ List of Installed Commands .. toctree:: ../api/ironic.cmd.api ../api/ironic.cmd.dbsync - ../api/ironic.cmd.manager + ../api/ironic.cmd.conductor diff --git a/doc/source/dev/conductor.rst b/doc/source/dev/conductor.rst new file mode 100644 index 0000000000..07dede8231 --- /dev/null +++ b/doc/source/dev/conductor.rst @@ -0,0 +1,10 @@ +.. _conductor: + +========================== +Ironic's Conductor Service +========================== + +.. toctree:: + ../api/ironic.conductor.manager + ../api/ironic.conductor.resource_manager + ../api/ironic.conductor.task_manager diff --git a/doc/source/dev/manager.rst b/doc/source/dev/manager.rst deleted file mode 100644 index d27047a04b..0000000000 --- a/doc/source/dev/manager.rst +++ /dev/null @@ -1,10 +0,0 @@ -.. _manager: - -========================== -Ironic's Management Server -========================== - -.. toctree:: - ../api/ironic.manager.manager - ../api/ironic.manager.resource_manager - ../api/ironic.manager.task_manager diff --git a/doc/source/index.rst b/doc/source/index.rst index b80cc633a2..41caefbdce 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -30,9 +30,10 @@ today, that is where you want to look. .. TODO .. - installation .. - configuration +.. - DB and AMQP +.. - API and Conductor services .. - integration with other OS services -.. - single or multiple managers -.. - different drivers +.. - any driver-specific configuration .. - hardware enrollment .. - manual vs automatic .. - hw plugins @@ -70,7 +71,7 @@ Python API Quick Reference dev/common dev/db dev/drivers - dev/manager + dev/conductor Indices and tables ================== diff --git a/ironic/api/hooks.py b/ironic/api/hooks.py index 2a2bcb9f88..dacaf92f27 100644 --- a/ironic/api/hooks.py +++ b/ironic/api/hooks.py @@ -19,8 +19,8 @@ from oslo.config import cfg from pecan import hooks +from ironic.conductor import rpcapi from ironic.db import api as dbapi -from ironic.manager import rpcapi from ironic.openstack.common import context @@ -50,4 +50,4 @@ class ContextHook(hooks.PecanHook): class RPCHook(hooks.PecanHook): def before(self, state): - state.request.rpcapi = rpcapi.ManagerAPI() + state.request.rpcapi = rpcapi.ConductorAPI() diff --git a/ironic/cmd/manager.py b/ironic/cmd/conductor.py similarity index 91% rename from ironic/cmd/manager.py rename to ironic/cmd/conductor.py index d6fa38222d..ba0bf38b67 100644 --- a/ironic/cmd/manager.py +++ b/ironic/cmd/conductor.py @@ -29,7 +29,7 @@ from oslo.config import cfg from ironic.openstack.common import service from ironic.common import service as ironic_service -from ironic.manager import manager +from ironic.conductor import manager CONF = cfg.CONF @@ -38,6 +38,6 @@ def main(): # Pase config file and command line options, then start logging ironic_service.prepare_service(sys.argv) - mgr = manager.ManagerService(CONF.host, manager.MANAGER_TOPIC) + mgr = manager.ConductorManager(CONF.host, manager.MANAGER_TOPIC) launcher = service.launch(mgr) launcher.wait() diff --git a/ironic/manager/__init__.py b/ironic/conductor/__init__.py similarity index 100% rename from ironic/manager/__init__.py rename to ironic/conductor/__init__.py diff --git a/ironic/manager/manager.py b/ironic/conductor/manager.py similarity index 64% rename from ironic/manager/manager.py rename to ironic/conductor/manager.py index 03d5d2b06a..819ecd8038 100644 --- a/ironic/manager/manager.py +++ b/ironic/conductor/manager.py @@ -15,47 +15,47 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -"""Handles all activity related to bare-metal deployments. +"""Conduct all activity related to bare-metal deployments. -A single instance of :py:class:`ironic.manager.manager.ManagerService` is -created within the *ironic-manager* process, and is responsible for performing -all actions on bare metal resources (Chassis, Nodes, and Ports). Commands are -received via RPC calls. The manager service also performs periodic tasks, eg. -to monitor the status of active deployments. +A single instance of :py:class:`ironic.conductor.manager.ConductorManager` is +created within the *ironic-conductor* process, and is responsible for +performing all actions on bare metal resources (Chassis, Nodes, and Ports). +Commands are received via RPC calls. The conductor service also performs +periodic tasks, eg. to monitor the status of active deployments. Drivers are loaded via entrypoints, by the -:py:class:`ironic.manager.resource_manager.NodeManager` class. Each driver is +:py:class:`ironic.conductor.resource_manager.NodeManager` class. Each driver is instantiated once and a ref to that singleton is included in each resource manager, depending on the node's configuration. In this way, a single -ManagerService may use multiple drivers, and manage heterogeneous hardware. +ConductorManager may use multiple drivers, and manage heterogeneous hardware. -When multiple :py:class:`ManagerService` are run on different hosts, they are +When multiple :py:class:`ConductorManager` are run on different hosts, they are all active and cooperatively manage all nodes in the deplyment. Nodes are -locked by each manager when performing actions which change the state of that +locked by each conductor when performing actions which change the state of that node; these locks are represented by the -:py:class:`ironic.manager.task_manager.TaskManager` class. +:py:class:`ironic.conductor.task_manager.TaskManager` class. """ from ironic.common import service +from ironic.conductor import task_manager from ironic.db import api as dbapi -from ironic.manager import task_manager from ironic.openstack.common import log -MANAGER_TOPIC = 'ironic.manager' +MANAGER_TOPIC = 'ironic.conductor_manager' LOG = log.getLogger(__name__) -class ManagerService(service.PeriodicService): - """Ironic Manager service main class.""" +class ConductorManager(service.PeriodicService): + """Ironic Conductor service main class.""" RPC_API_VERSION = '1.0' def __init__(self, host, topic): - super(ManagerService, self).__init__(host, topic) + super(ConductorManager, self).__init__(host, topic) def start(self): - super(ManagerService, self).start() + super(ConductorManager, self).start() self.dbapi = dbapi.get_instance() def initialize_service_hook(self, service): diff --git a/ironic/manager/resource_manager.py b/ironic/conductor/resource_manager.py similarity index 95% rename from ironic/manager/resource_manager.py rename to ironic/conductor/resource_manager.py index dc766472fb..65472d58b7 100644 --- a/ironic/manager/resource_manager.py +++ b/ironic/conductor/resource_manager.py @@ -19,9 +19,9 @@ """ Hold the data and drivers for a distinct node within a given context. -Each :py:class:`ironic.manager.resource_manager.NodeManager` instance is a +Each :py:class:`ironic.conductor.resource_manager.NodeManager` instance is a semi-singleton, keyed by the node id. It contains references to all -:py:class:`ironic.manager.task_manager.TaskManager` which called it. When no +:py:class:`ironic.conductor.task_manager.TaskManager` which called it. When no more TaskManagers reference a given NodeManager, it is automatically destroyed. Do not request a NodeManager directly; instead, you should use a TaskManager to diff --git a/ironic/manager/rpcapi.py b/ironic/conductor/rpcapi.py similarity index 85% rename from ironic/manager/rpcapi.py rename to ironic/conductor/rpcapi.py index 2a55f00de3..8beaf8d51f 100644 --- a/ironic/manager/rpcapi.py +++ b/ironic/conductor/rpcapi.py @@ -16,16 +16,16 @@ # License for the specific language governing permissions and limitations # under the License. """ -Client side of the manager RPC API. +Client side of the conductor RPC API. """ import ironic.openstack.common.rpc.proxy -MANAGER_TOPIC = 'ironic.manager' +MANAGER_TOPIC = 'ironic.conductor_manager' -class ManagerAPI(ironic.openstack.common.rpc.proxy.RpcProxy): - """Client side of the manager RPC API. +class ConductorAPI(ironic.openstack.common.rpc.proxy.RpcProxy): + """Client side of the conductor RPC API. API version history: @@ -38,7 +38,7 @@ class ManagerAPI(ironic.openstack.common.rpc.proxy.RpcProxy): if topic is None: topic = MANAGER_TOPIC - super(ManagerAPI, self).__init__( + super(ConductorAPI, self).__init__( topic=topic, default_version=self.RPC_API_VERSION) diff --git a/ironic/manager/task_manager.py b/ironic/conductor/task_manager.py similarity index 95% rename from ironic/manager/task_manager.py rename to ironic/conductor/task_manager.py index fefc8aa467..2407305b4d 100644 --- a/ironic/manager/task_manager.py +++ b/ironic/conductor/task_manager.py @@ -21,7 +21,7 @@ A context manager to peform a series of tasks on a set of resources. :class:`TaskManager` is a context manager, created on-demand to synchronize locking and simplify operations across a set of -:class:`ironic.manager.resource_manager.NodeManager` instances. Each +:class:`ironic.conductor.resource_manager.NodeManager` instances. Each NodeManager holds the data model for a node, as well as references to the driver singleton appropriate for that node. @@ -30,13 +30,13 @@ indicated. Multiple shared locks for the same resource may coexist with an exclusive lock, but only one exclusive lock will be granted across a deployment; attempting to allocate another will raise an exception. An exclusive lock is represented in the database to coordinate between -:class:`ironic.manager.manager` instances, even when deployed on +:class:`ironic.conductor.manager` instances, even when deployed on different hosts. :class:`TaskManager` methods, as well as driver methods, may be decorated to determine whether their invocation requires an exclusive lock. For example:: - from ironic.manager import task_manager + from ironic.conductor import task_manager node_ids = [1, 2, 3] try: @@ -66,8 +66,8 @@ import contextlib from oslo.config import cfg from ironic.common import exception +from ironic.conductor import resource_manager from ironic.db import api as dbapi -from ironic.manager import resource_manager CONF = cfg.CONF diff --git a/ironic/drivers/modules/ipmi.py b/ironic/drivers/modules/ipmi.py index ac5baf2d9c..ed75cd5d1f 100644 --- a/ironic/drivers/modules/ipmi.py +++ b/ironic/drivers/modules/ipmi.py @@ -32,8 +32,8 @@ from ironic.common import exception from ironic.common import paths from ironic.common import states from ironic.common import utils +from ironic.conductor import task_manager from ironic.drivers import base -from ironic.manager import task_manager from ironic.openstack.common import excutils from ironic.openstack.common import jsonutils as json from ironic.openstack.common import log as logging diff --git a/ironic/drivers/modules/ssh.py b/ironic/drivers/modules/ssh.py index 08349e59aa..a819dc63d6 100644 --- a/ironic/drivers/modules/ssh.py +++ b/ironic/drivers/modules/ssh.py @@ -34,8 +34,8 @@ from oslo.config import cfg from ironic.common import exception from ironic.common import states from ironic.common import utils +from ironic.conductor import task_manager from ironic.drivers import base -from ironic.manager import task_manager from ironic.openstack.common import jsonutils as json from ironic.openstack.common import log as logging diff --git a/ironic/tests/manager/__init__.py b/ironic/tests/conductor/__init__.py similarity index 100% rename from ironic/tests/manager/__init__.py rename to ironic/tests/conductor/__init__.py diff --git a/ironic/tests/manager/test_manager.py b/ironic/tests/conductor/test_manager.py similarity index 93% rename from ironic/tests/manager/test_manager.py rename to ironic/tests/conductor/test_manager.py index efa427f8e6..4cb5f189ba 100644 --- a/ironic/tests/manager/test_manager.py +++ b/ironic/tests/conductor/test_manager.py @@ -21,19 +21,19 @@ import mox from ironic.common import states +from ironic.conductor import manager from ironic.db import api as dbapi -from ironic.manager import manager from ironic.openstack.common import context +from ironic.tests.conductor import utils as mgr_utils from ironic.tests.db import base from ironic.tests.db import utils -from ironic.tests.manager import utils as mgr_utils class ManagerTestCase(base.DbTestCase): def setUp(self): super(ManagerTestCase, self).setUp() - self.service = manager.ManagerService('test-host', 'test-topic') + self.service = manager.ConductorManager('test-host', 'test-topic') self.context = context.get_admin_context() self.dbapi = dbapi.get_instance() self.driver = mgr_utils.get_mocked_node_manager() diff --git a/ironic/tests/manager/test_rpcapi.py b/ironic/tests/conductor/test_rpcapi.py similarity index 90% rename from ironic/tests/manager/test_rpcapi.py rename to ironic/tests/conductor/test_rpcapi.py index 891d917e44..17643066eb 100644 --- a/ironic/tests/manager/test_rpcapi.py +++ b/ironic/tests/conductor/test_rpcapi.py @@ -16,13 +16,13 @@ # License for the specific language governing permissions and limitations # under the License. """ -Unit Tests for :py:class:`ironic.manager.rpcapi.ManagerAPI`. +Unit Tests for :py:class:`ironic.conductor.rpcapi.ConductorAPI`. """ from oslo.config import cfg +from ironic.conductor import rpcapi as conductor_rpcapi from ironic.db import api as dbapi -from ironic.manager import rpcapi as manager_rpcapi from ironic.openstack.common import context from ironic.openstack.common import jsonutils as json from ironic.openstack.common import rpc @@ -32,10 +32,10 @@ from ironic.tests.db import utils as dbutils CONF = cfg.CONF -class ManagerRpcAPITestCase(base.DbTestCase): +class RPCAPITestCase(base.DbTestCase): def setUp(self): - super(ManagerRpcAPITestCase, self).setUp() + super(RPCAPITestCase, self).setUp() self.context = context.get_admin_context() self.dbapi = dbapi.get_instance() self.fake_node = json.to_primitive(dbutils.get_test_node( @@ -47,7 +47,7 @@ class ManagerRpcAPITestCase(base.DbTestCase): def _test_rpcapi(self, method, rpc_method, **kwargs): ctxt = context.get_admin_context() - rpcapi = manager_rpcapi.ManagerAPI(topic='fake-topic') + rpcapi = conductor_rpcapi.ConductorAPI(topic='fake-topic') expected_retval = 'hello world' if method == 'call' else None expected_version = kwargs.pop('version', rpcapi.RPC_API_VERSION) diff --git a/ironic/tests/manager/test_task_manager.py b/ironic/tests/conductor/test_task_manager.py similarity index 97% rename from ironic/tests/manager/test_task_manager.py rename to ironic/tests/conductor/test_task_manager.py index ce651299b8..f1bf69cf8c 100644 --- a/ironic/tests/manager/test_task_manager.py +++ b/ironic/tests/conductor/test_task_manager.py @@ -16,17 +16,17 @@ # License for the specific language governing permissions and limitations # under the License. -"""Tests for :class:`ironic.manager.task_manager`.""" +"""Tests for :class:`ironic.conductor.task_manager`.""" from testtools import matchers from ironic.common import exception +from ironic.conductor import task_manager from ironic.db import api as dbapi -from ironic.manager import task_manager from ironic.openstack.common import uuidutils +from ironic.tests.conductor import utils as mgr_utils from ironic.tests.db import base from ironic.tests.db import utils -from ironic.tests.manager import utils as mgr_utils def create_fake_node(i): diff --git a/ironic/tests/manager/test_utils.py b/ironic/tests/conductor/test_utils.py similarity index 96% rename from ironic/tests/manager/test_utils.py rename to ironic/tests/conductor/test_utils.py index be36ec9308..047ab010f7 100644 --- a/ironic/tests/manager/test_utils.py +++ b/ironic/tests/conductor/test_utils.py @@ -18,9 +18,9 @@ """Tests for Ironic Manager test utils.""" -from ironic.manager import resource_manager +from ironic.conductor import resource_manager from ironic.tests import base -from ironic.tests.manager import utils +from ironic.tests.conductor import utils class UtilsTestCase(base.TestCase): diff --git a/ironic/tests/manager/utils.py b/ironic/tests/conductor/utils.py similarity index 98% rename from ironic/tests/manager/utils.py rename to ironic/tests/conductor/utils.py index ffd64f1a6f..6ecfe8db3e 100644 --- a/ironic/tests/manager/utils.py +++ b/ironic/tests/conductor/utils.py @@ -21,7 +21,7 @@ import pkg_resources from stevedore import dispatch -from ironic.manager import resource_manager +from ironic.conductor import resource_manager def get_mockable_extension_manager(driver, namespace): diff --git a/ironic/tests/drivers/test_ipmi.py b/ironic/tests/drivers/test_ipmi.py index b6b78ebaff..8a0d3d0435 100644 --- a/ironic/tests/drivers/test_ipmi.py +++ b/ironic/tests/drivers/test_ipmi.py @@ -29,13 +29,13 @@ from ironic.openstack.common import jsonutils as json from ironic.common import exception from ironic.common import states from ironic.common import utils +from ironic.conductor import task_manager from ironic.db import api as db_api from ironic.drivers.modules import ipmi -from ironic.manager import task_manager from ironic.tests import base +from ironic.tests.conductor import utils as mgr_utils from ironic.tests.db import base as db_base from ironic.tests.db import utils as db_utils -from ironic.tests.manager import utils as mgr_utils CONF = cfg.CONF diff --git a/ironic/tests/drivers/test_ssh.py b/ironic/tests/drivers/test_ssh.py index e443a12105..d3dbd3a9bb 100644 --- a/ironic/tests/drivers/test_ssh.py +++ b/ironic/tests/drivers/test_ssh.py @@ -22,13 +22,13 @@ from ironic.openstack.common import jsonutils as json from ironic.common import exception from ironic.common import states +from ironic.conductor import task_manager from ironic.db import api as dbapi from ironic.drivers.modules import ssh -from ironic.manager import task_manager from ironic.tests import base +from ironic.tests.conductor import utils as mgr_utils from ironic.tests.db import base as db_base from ironic.tests.db import utils as db_utils -from ironic.tests.manager import utils as mgr_utils INFO_DICT = json.loads(db_utils.ssh_info).get('ssh') diff --git a/setup.cfg b/setup.cfg index 3aff1a8d7f..0f9256c4af 100644 --- a/setup.cfg +++ b/setup.cfg @@ -30,7 +30,7 @@ packages = console_scripts = ironic-api = ironic.cmd.api:main ironic-dbsync = ironic.cmd.dbsync:main - ironic-manager = ironic.cmd.manager:main + ironic-conductor = ironic.cmd.conductor:main ironic-rootwrap = ironic.openstack.common.rootwrap.cmd:main ironic.drivers =