From f6c20ed00b9febaea42ac34d2988c1cf6c883b10 Mon Sep 17 00:00:00 2001 From: Vivek Dhayaal Date: Wed, 2 Mar 2016 22:14:15 +0530 Subject: [PATCH] Removed RPC topic config options Cinder had config options to customize the RPC topics on which the scheduler, volume and backup nodes listen. But this feature has been dysfunctional for quite a long time. This commit removed this feature. For more details: Refer the bug comments. DocImpact Change-Id: Ie76f070fe9a1222c209e8defd0d04fa7a7931b14 Closes-Bug: #1301888 --- cinder/api/contrib/hosts.py | 3 ++- cinder/api/contrib/snapshot_manage.py | 2 -- cinder/backup/api.py | 5 ++-- cinder/backup/manager.py | 2 -- cinder/backup/rpcapi.py | 5 ++-- cinder/cmd/manage.py | 3 ++- cinder/common/config.py | 9 ------- cinder/common/constants.py | 8 ++++++ cinder/consistencygroup/api.py | 3 ++- cinder/group/api.py | 3 ++- cinder/scheduler/host_manager.py | 3 ++- cinder/scheduler/rpcapi.py | 7 ++---- .../unit/api/contrib/test_admin_actions.py | 8 +++--- .../test_allocated_capacity_weigher.py | 6 ++--- .../unit/scheduler/test_capacity_weigher.py | 6 ++--- .../tests/unit/scheduler/test_host_manager.py | 7 ++---- .../scheduler/test_volume_number_weigher.py | 6 ++--- cinder/tests/unit/test_cmd.py | 4 +-- cinder/tests/unit/test_volume_rpcapi.py | 5 ++-- cinder/volume/api.py | 25 +++++++++++-------- cinder/volume/flows/api/create_volume.py | 3 ++- cinder/volume/flows/api/manage_existing.py | 5 ++-- cinder/volume/flows/manager/create_volume.py | 3 ++- cinder/volume/manager.py | 12 ++++----- cinder/volume/rpcapi.py | 5 ++-- ...topic-config-options-21c2b3f0e64f884c.yaml | 6 +++++ 26 files changed, 75 insertions(+), 79 deletions(-) create mode 100644 releasenotes/notes/removed-rpc-topic-config-options-21c2b3f0e64f884c.yaml diff --git a/cinder/api/contrib/hosts.py b/cinder/api/contrib/hosts.py index aac0e39b6..31c2ed479 100644 --- a/cinder/api/contrib/hosts.py +++ b/cinder/api/contrib/hosts.py @@ -22,6 +22,7 @@ import webob.exc from cinder.api import extensions from cinder.api.openstack import wsgi +from cinder.common import constants from cinder import db from cinder import exception from cinder.i18n import _, _LI @@ -149,7 +150,7 @@ class HostController(wsgi.Controller): # Not found exception will be handled at the wsgi level host_ref = objects.Service.get_by_host_and_topic( - context, host, CONF.volume_topic) + context, host, constants.VOLUME_TOPIC) # Getting total available/used resource # TODO(jdg): Add summary info for Snapshots diff --git a/cinder/api/contrib/snapshot_manage.py b/cinder/api/contrib/snapshot_manage.py index 30adf5666..159669fa9 100644 --- a/cinder/api/contrib/snapshot_manage.py +++ b/cinder/api/contrib/snapshot_manage.py @@ -12,7 +12,6 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_config import cfg from oslo_log import log as logging from webob import exc @@ -25,7 +24,6 @@ from cinder.i18n import _ from cinder import volume as cinder_volume LOG = logging.getLogger(__name__) -CONF = cfg.CONF authorize_manage = extensions.extension_authorizer('snapshot', 'snapshot_manage') authorize_list_manageable = extensions.extension_authorizer('snapshot', diff --git a/cinder/backup/api.py b/cinder/backup/api.py index 1b9a40664..69b33cea5 100644 --- a/cinder/backup/api.py +++ b/cinder/backup/api.py @@ -29,6 +29,7 @@ from pytz import timezone import random from cinder.backup import rpcapi as backup_rpcapi +from cinder.common import constants from cinder import context from cinder.db import base from cinder import exception @@ -144,7 +145,7 @@ class API(base.Base): def _is_backup_service_enabled(self, availability_zone, host): """Check if there is a backup service available.""" - topic = CONF.backup_topic + topic = constants.BACKUP_TOPIC ctxt = context.get_admin_context() services = objects.ServiceList.get_all_by_topic( ctxt, topic, disabled=False) @@ -189,7 +190,7 @@ class API(base.Base): :returns: list -- hosts for services that are enabled for backup. """ - topic = CONF.backup_topic + topic = constants.BACKUP_TOPIC ctxt = context.get_admin_context() services = objects.ServiceList.get_all_by_topic( ctxt, topic, disabled=False) diff --git a/cinder/backup/manager.py b/cinder/backup/manager.py index 02917072c..4d3555783 100644 --- a/cinder/backup/manager.py +++ b/cinder/backup/manager.py @@ -25,8 +25,6 @@ Volume backups can be created, restored, deleted and listed. **Related Flags** -:backup_topic: What :mod:`rpc` topic to listen to (default: - `cinder-backup`). :backup_manager: The module name of a class derived from :class:`manager.Manager` (default: :class:`cinder.backup.manager.Manager`). diff --git a/cinder/backup/rpcapi.py b/cinder/backup/rpcapi.py index d17065586..feb7ec80a 100644 --- a/cinder/backup/rpcapi.py +++ b/cinder/backup/rpcapi.py @@ -18,13 +18,12 @@ Client side of the volume backup RPC API. """ -from oslo_config import cfg from oslo_log import log as logging +from cinder.common import constants from cinder import rpc -CONF = cfg.CONF LOG = logging.getLogger(__name__) @@ -49,7 +48,7 @@ class BackupAPI(rpc.RPCAPI): """ RPC_API_VERSION = '2.0' - TOPIC = CONF.backup_topic + TOPIC = constants.BACKUP_TOPIC BINARY = 'cinder-backup' def _compat_ver(self, current, legacy): diff --git a/cinder/cmd/manage.py b/cinder/cmd/manage.py index 2c6cba86b..2d186889c 100644 --- a/cinder/cmd/manage.py +++ b/cinder/cmd/manage.py @@ -72,6 +72,7 @@ i18n.enable_lazy() # Need to register global_opts from cinder.common import config # noqa +from cinder.common import constants from cinder import context from cinder import db from cinder.db import migration as db_migration @@ -266,7 +267,7 @@ class VolumeCommands(object): if self._client is None: if not rpc.initialized(): rpc.init(CONF) - target = messaging.Target(topic=CONF.volume_topic) + target = messaging.Target(topic=constants.VOLUME_TOPIC) serializer = objects.base.CinderObjectSerializer() self._client = rpc.get_client(target, serializer=serializer) diff --git a/cinder/common/config.py b/cinder/common/config.py index f945b30d4..45ee72569 100644 --- a/cinder/common/config.py +++ b/cinder/common/config.py @@ -83,15 +83,6 @@ global_opts = [ help='http/https timeout value for glance operations. If no ' 'value (None) is supplied here, the glanceclient default ' 'value is used.'), - cfg.StrOpt('scheduler_topic', - default='cinder-scheduler', - help='The topic that scheduler nodes listen on'), - cfg.StrOpt('volume_topic', - default='cinder-volume', - help='The topic that volume nodes listen on'), - cfg.StrOpt('backup_topic', - default='cinder-backup', - help='The topic that volume backup nodes listen on'), cfg.BoolOpt('enable_v1_api', default=True, deprecated_for_removal=True, diff --git a/cinder/common/constants.py b/cinder/common/constants.py index fa0858965..f7af0c916 100644 --- a/cinder/common/constants.py +++ b/cinder/common/constants.py @@ -16,3 +16,11 @@ # The maximum value a signed INT type may have DB_MAX_INT = 0x7FFFFFFF + +# The cinder services binaries and topics' names +SCHEDULER_BINARY = "cinder-scheduler" +VOLUME_BINARY = "cinder-volume" +BACKUP_BINARY = "cinder-backup" +SCHEDULER_TOPIC = SCHEDULER_BINARY +VOLUME_TOPIC = VOLUME_BINARY +BACKUP_TOPIC = BACKUP_BINARY diff --git a/cinder/consistencygroup/api.py b/cinder/consistencygroup/api.py index efddb1b58..3502091c6 100644 --- a/cinder/consistencygroup/api.py +++ b/cinder/consistencygroup/api.py @@ -25,6 +25,7 @@ from oslo_log import log as logging from oslo_utils import excutils from oslo_utils import timeutils +from cinder.common import constants from cinder import db from cinder.db import base from cinder import exception @@ -395,7 +396,7 @@ class API(base.Base): # to select the target host for this group. self.scheduler_rpcapi.create_consistencygroup( context, - CONF.volume_topic, + constants.VOLUME_TOPIC, group, request_spec_list=request_spec_list, filter_properties_list=filter_properties_list) diff --git a/cinder/group/api.py b/cinder/group/api.py index 92cd29cea..924f512c3 100644 --- a/cinder/group/api.py +++ b/cinder/group/api.py @@ -25,6 +25,7 @@ from oslo_log import log as logging from oslo_utils import excutils from oslo_utils import timeutils +from cinder.common import constants from cinder.db import base from cinder import exception from cinder.i18n import _, _LE, _LW @@ -243,7 +244,7 @@ class API(base.Base): # to select the target host for this group. self.scheduler_rpcapi.create_group( context, - CONF.volume_topic, + constants.VOLUME_TOPIC, group, group_spec=group_spec, request_spec_list=request_spec_list, diff --git a/cinder/scheduler/host_manager.py b/cinder/scheduler/host_manager.py index 38f6d3f38..c5e7b2da8 100644 --- a/cinder/scheduler/host_manager.py +++ b/cinder/scheduler/host_manager.py @@ -24,6 +24,7 @@ from oslo_log import log as logging from oslo_utils import importutils from oslo_utils import timeutils +from cinder.common import constants from cinder import context as cinder_context from cinder import exception from cinder import objects @@ -456,7 +457,7 @@ class HostManager(object): def _update_host_state_map(self, context): # Get resource usage across the available volume nodes: - topic = CONF.volume_topic + topic = constants.VOLUME_TOPIC volume_services = objects.ServiceList.get_all_by_topic(context, topic, disabled=False) diff --git a/cinder/scheduler/rpcapi.py b/cinder/scheduler/rpcapi.py index a95f374e6..2b128bdc9 100644 --- a/cinder/scheduler/rpcapi.py +++ b/cinder/scheduler/rpcapi.py @@ -16,15 +16,12 @@ Client side of the scheduler manager RPC API. """ -from oslo_config import cfg from oslo_serialization import jsonutils +from cinder.common import constants from cinder import rpc -CONF = cfg.CONF - - class SchedulerAPI(rpc.RPCAPI): """Client side of the scheduler rpc API. @@ -58,7 +55,7 @@ class SchedulerAPI(rpc.RPCAPI): """ RPC_API_VERSION = '2.3' - TOPIC = CONF.scheduler_topic + TOPIC = constants.SCHEDULER_TOPIC BINARY = 'cinder-scheduler' # FIXME(caosf): Remove unused argument 'topic' from functions diff --git a/cinder/tests/unit/api/contrib/test_admin_actions.py b/cinder/tests/unit/api/contrib/test_admin_actions.py index f0e415088..6b05baeb1 100644 --- a/cinder/tests/unit/api/contrib/test_admin_actions.py +++ b/cinder/tests/unit/api/contrib/test_admin_actions.py @@ -13,7 +13,6 @@ import fixtures import mock from oslo_concurrency import lockutils -from oslo_config import cfg from oslo_config import fixture as config_fixture import oslo_messaging as messaging from oslo_serialization import jsonutils @@ -22,6 +21,7 @@ import webob from webob import exc from cinder.api.contrib import admin_actions +from cinder.common import constants from cinder import context from cinder import db from cinder import exception @@ -38,8 +38,6 @@ from cinder.tests.unit import fake_snapshot from cinder.volume import api as volume_api from cinder.volume import rpcapi -CONF = cfg.CONF - def app(): # no auth, just let environ['cinder.context'] pass through @@ -475,11 +473,11 @@ class AdminActionsTest(BaseAdminTest): # create volume's current host and the destination host db.service_create(self.ctx, {'host': 'test', - 'topic': CONF.volume_topic, + 'topic': constants.VOLUME_TOPIC, 'created_at': timeutils.utcnow()}) db.service_create(self.ctx, {'host': 'test2', - 'topic': CONF.volume_topic, + 'topic': constants.VOLUME_TOPIC, 'created_at': timeutils.utcnow()}) # current status is available volume = self._create_volume(self.ctx) diff --git a/cinder/tests/unit/scheduler/test_allocated_capacity_weigher.py b/cinder/tests/unit/scheduler/test_allocated_capacity_weigher.py index 64eac1f10..cf92154ee 100644 --- a/cinder/tests/unit/scheduler/test_allocated_capacity_weigher.py +++ b/cinder/tests/unit/scheduler/test_allocated_capacity_weigher.py @@ -18,16 +18,14 @@ Tests For Allocated Capacity Weigher. """ import mock -from oslo_config import cfg +from cinder.common import constants from cinder import context from cinder.scheduler import weights from cinder import test from cinder.tests.unit.scheduler import fakes from cinder.volume import utils -CONF = cfg.CONF - class AllocatedCapacityWeigherTestCase(test.TestCase): def setUp(self): @@ -52,7 +50,7 @@ class AllocatedCapacityWeigherTestCase(test.TestCase): _mock_service_get_all.assert_called_once_with( ctxt, None, # backend_match_level - topic=CONF.volume_topic, disabled=disabled) + topic=constants.VOLUME_TOPIC, disabled=disabled) return host_states def test_default_of_spreading_first(self): diff --git a/cinder/tests/unit/scheduler/test_capacity_weigher.py b/cinder/tests/unit/scheduler/test_capacity_weigher.py index ac35924bd..f80d96e39 100644 --- a/cinder/tests/unit/scheduler/test_capacity_weigher.py +++ b/cinder/tests/unit/scheduler/test_capacity_weigher.py @@ -17,16 +17,14 @@ Tests For Capacity Weigher. """ import mock -from oslo_config import cfg +from cinder.common import constants from cinder import context from cinder.scheduler import weights from cinder import test from cinder.tests.unit.scheduler import fakes from cinder.volume import utils -CONF = cfg.CONF - class CapacityWeigherTestCase(test.TestCase): def setUp(self): @@ -52,7 +50,7 @@ class CapacityWeigherTestCase(test.TestCase): _mock_service_get_all.assert_called_once_with( ctxt, None, # backend_match_level - topic=CONF.volume_topic, disabled=disabled) + topic=constants.VOLUME_TOPIC, disabled=disabled) return host_states # If thin_provisioning_support = False, use the following formula: diff --git a/cinder/tests/unit/scheduler/test_host_manager.py b/cinder/tests/unit/scheduler/test_host_manager.py index 9c45d7839..ceb0e1e63 100644 --- a/cinder/tests/unit/scheduler/test_host_manager.py +++ b/cinder/tests/unit/scheduler/test_host_manager.py @@ -19,9 +19,9 @@ Tests For HostManager from datetime import datetime import mock -from oslo_config import cfg from oslo_utils import timeutils +from cinder.common import constants from cinder import exception from cinder import objects from cinder.scheduler import filters @@ -30,9 +30,6 @@ from cinder import test from cinder.tests.unit.objects import test_service -CONF = cfg.CONF - - class FakeFilterClass1(filters.BaseHostFilter): def host_passes(self, host_state, filter_properties): pass @@ -211,7 +208,7 @@ class HostManagerTestCase(test.TestCase): def test_get_all_host_states(self, _mock_service_is_up, _mock_service_get_all): context = 'fake_context' - topic = CONF.volume_topic + topic = constants.VOLUME_TOPIC services = [ dict(id=1, host='host1', topic='volume', disabled=False, diff --git a/cinder/tests/unit/scheduler/test_volume_number_weigher.py b/cinder/tests/unit/scheduler/test_volume_number_weigher.py index 431239248..1a0527fbb 100644 --- a/cinder/tests/unit/scheduler/test_volume_number_weigher.py +++ b/cinder/tests/unit/scheduler/test_volume_number_weigher.py @@ -17,8 +17,8 @@ Tests For Volume Number Weigher. """ import mock -from oslo_config import cfg +from cinder.common import constants from cinder import context from cinder.db.sqlalchemy import api from cinder.scheduler import weights @@ -27,8 +27,6 @@ from cinder.tests.unit import fake_constants from cinder.tests.unit.scheduler import fakes from cinder.volume import utils -CONF = cfg.CONF - def fake_volume_data_get_for_host(context, host, count_only=False): host = utils.extract_host(host) @@ -78,7 +76,7 @@ class VolumeNumberWeigherTestCase(test.TestCase): _mock_service_get_all.assert_called_once_with( ctxt, None, # backend_match_level - topic=CONF.volume_topic, + topic=constants.VOLUME_TOPIC, disabled=disabled) return host_states diff --git a/cinder/tests/unit/test_cmd.py b/cinder/tests/unit/test_cmd.py index 47cb982a7..e11a7a562 100644 --- a/cinder/tests/unit/test_cmd.py +++ b/cinder/tests/unit/test_cmd.py @@ -34,6 +34,7 @@ from cinder.cmd import rtstool as cinder_rtstool from cinder.cmd import scheduler as cinder_scheduler from cinder.cmd import volume as cinder_volume from cinder.cmd import volume_usage_audit +from cinder.common import constants from cinder import context from cinder import exception from cinder.objects import fields @@ -514,7 +515,6 @@ class TestCinderManageCmd(test.TestCase): @mock.patch('oslo_messaging.Target') def test_volume_commands_init(self, messaging_target, rpc_initialized, rpc_init, get_client, object_serializer): - CONF.set_override('volume_topic', 'fake-topic') mock_target = messaging_target.return_value mock_rpc_client = get_client.return_value @@ -523,7 +523,7 @@ class TestCinderManageCmd(test.TestCase): rpc_initialized.assert_called_once_with() rpc_init.assert_called_once_with(CONF) - messaging_target.assert_called_once_with(topic='fake-topic') + messaging_target.assert_called_once_with(topic=constants.VOLUME_TOPIC) get_client.assert_called_once_with(mock_target, serializer=object_serializer()) self.assertEqual(mock_rpc_client, rpc_client) diff --git a/cinder/tests/unit/test_volume_rpcapi.py b/cinder/tests/unit/test_volume_rpcapi.py index 31983e586..93e1c3339 100644 --- a/cinder/tests/unit/test_volume_rpcapi.py +++ b/cinder/tests/unit/test_volume_rpcapi.py @@ -22,6 +22,7 @@ import ddt from oslo_config import cfg from oslo_serialization import jsonutils +from cinder.common import constants from cinder import context from cinder import db from cinder import objects @@ -179,7 +180,7 @@ class VolumeRpcAPITestCase(test.TestCase): host = kwargs['cgsnapshot'].consistencygroup.host target['server'] = utils.extract_host(host) - target['topic'] = '%s.%s' % (CONF.volume_topic, host) + target['topic'] = '%s.%s' % (constants.VOLUME_TOPIC, host) self.fake_args = None self.fake_kwargs = None @@ -259,7 +260,7 @@ class VolumeRpcAPITestCase(test.TestCase): host = kwargs['group']['host'] target['server'] = utils.extract_host(host) - target['topic'] = '%s.%s' % (CONF.volume_topic, host) + target['topic'] = '%s.%s' % (constants.VOLUME_TOPIC, host) self.fake_args = None self.fake_kwargs = None diff --git a/cinder/volume/api.py b/cinder/volume/api.py index a9bb8999d..30a9e1beb 100644 --- a/cinder/volume/api.py +++ b/cinder/volume/api.py @@ -30,6 +30,7 @@ from oslo_utils import uuidutils import six from cinder.api import common +from cinder.common import constants from cinder import context from cinder import db from cinder.db import base @@ -149,7 +150,7 @@ class API(base.Base): if cache_age >= CONF.az_cache_duration: refresh_cache = True if refresh_cache or not enable_cache: - topic = CONF.volume_topic + topic = constants.VOLUME_TOPIC ctxt = context.get_admin_context() services = objects.ServiceList.get_all_by_topic(ctxt, topic) az_data = [(s.availability_zone, s.disabled) @@ -177,9 +178,10 @@ class API(base.Base): first_type=None, second_type=None): safe = False elevated = context.elevated() - services = objects.ServiceList.get_all_by_topic(elevated, - 'cinder-volume', - disabled=True) + services = objects.ServiceList.get_all_by_topic( + elevated, + constants.VOLUME_TOPIC, + disabled=True) if len(services.objects) == 1: safe = True else: @@ -1300,7 +1302,7 @@ class API(base.Base): """Migrate the volume to the specified host.""" # Make sure the host is in the list of available hosts elevated = context.elevated() - topic = CONF.volume_topic + topic = constants.VOLUME_TOPIC services = objects.ServiceList.get_all_by_topic( elevated, topic, disabled=False) found = False @@ -1358,7 +1360,7 @@ class API(base.Base): 'volume_type': volume_type, 'volume_id': volume.id} self.scheduler_rpcapi.migrate_volume_to_host(context, - CONF.volume_topic, + constants.VOLUME_TOPIC, volume.id, host, force_host_copy, @@ -1508,7 +1510,8 @@ class API(base.Base): 'quota_reservations': reservations, 'old_reservations': old_reservations} - self.scheduler_rpcapi.retype(context, CONF.volume_topic, volume.id, + self.scheduler_rpcapi.retype(context, constants.VOLUME_TOPIC, + volume.id, request_spec=request_spec, filter_properties={}, volume=volume) LOG.info(_LI("Retype volume request issued successfully."), @@ -1524,7 +1527,7 @@ class API(base.Base): with excutils.save_and_reraise_exception(): LOG.error(_LE('Unable to find service: %(service)s for ' 'given host: %(host)s.'), - {'service': CONF.volume_topic, 'host': host}) + {'service': constants.VOLUME_BINARY, 'host': host}) if service.disabled: LOG.error(_LE('Unable to manage existing %s on a disabled ' @@ -1622,7 +1625,7 @@ class API(base.Base): svc_host = volume_utils.extract_host(host, 'backend') service = objects.Service.get_by_args( - ctxt, svc_host, 'cinder-volume') + ctxt, svc_host, constants.VOLUME_BINARY) expected = {'replication_status': [fields.ReplicationStatus.ENABLED, fields.ReplicationStatus.FAILED_OVER]} result = service.conditional_update( @@ -1644,7 +1647,7 @@ class API(base.Base): svc_host = volume_utils.extract_host(host, 'backend') service = objects.Service.get_by_args( - ctxt, svc_host, 'cinder-volume') + ctxt, svc_host, constants.VOLUME_BINARY) expected = {'frozen': False} result = service.conditional_update( {'frozen': True}, expected) @@ -1665,7 +1668,7 @@ class API(base.Base): svc_host = volume_utils.extract_host(host, 'backend') service = objects.Service.get_by_args( - ctxt, svc_host, 'cinder-volume') + ctxt, svc_host, constants.VOLUME_BINARY) expected = {'frozen': True} result = service.conditional_update( {'frozen': False}, expected) diff --git a/cinder/volume/flows/api/create_volume.py b/cinder/volume/flows/api/create_volume.py index 182f86205..f589fe1d7 100644 --- a/cinder/volume/flows/api/create_volume.py +++ b/cinder/volume/flows/api/create_volume.py @@ -19,6 +19,7 @@ import taskflow.engines from taskflow.patterns import linear_flow from taskflow.types import failure as ft +from cinder.common import constants from cinder import exception from cinder import flow_utils from cinder.i18n import _, _LE, _LW @@ -762,7 +763,7 @@ class VolumeCastTask(flow_utils.CinderTask): # to select the target host for this volume. self.scheduler_rpcapi.create_volume( context, - CONF.volume_topic, + constants.VOLUME_TOPIC, volume_id, snapshot_id=snapshot_id, image_id=image_id, diff --git a/cinder/volume/flows/api/manage_existing.py b/cinder/volume/flows/api/manage_existing.py index ff233ecdd..50c129680 100644 --- a/cinder/volume/flows/api/manage_existing.py +++ b/cinder/volume/flows/api/manage_existing.py @@ -11,12 +11,12 @@ # under the License. -from oslo_config import cfg from oslo_log import log as logging import taskflow.engines from taskflow.patterns import linear_flow from taskflow.types import failure as ft +from cinder.common import constants from cinder import exception from cinder import flow_utils from cinder.i18n import _LE @@ -26,7 +26,6 @@ from cinder.volume.flows import common LOG = logging.getLogger(__name__) ACTION = 'volume:manage_existing' -CONF = cfg.CONF class EntryCreateTask(flow_utils.CinderTask): @@ -109,7 +108,7 @@ class ManageCastTask(flow_utils.CinderTask): # Call the scheduler to ensure that the host exists and that it can # accept the volume - self.scheduler_rpcapi.manage_existing(context, CONF.volume_topic, + self.scheduler_rpcapi.manage_existing(context, constants.VOLUME_TOPIC, volume.id, request_spec=request_spec, volume=volume) diff --git a/cinder/volume/flows/manager/create_volume.py b/cinder/volume/flows/manager/create_volume.py index db20ad35f..0281f870d 100644 --- a/cinder/volume/flows/manager/create_volume.py +++ b/cinder/volume/flows/manager/create_volume.py @@ -20,6 +20,7 @@ import taskflow.engines from taskflow.patterns import linear_flow from taskflow.types import failure as ft +from cinder.common import constants from cinder import context as cinder_context from cinder import exception from cinder import flow_utils @@ -143,7 +144,7 @@ class OnFailureRescheduleTask(flow_utils.CinderTask): # Stringify to avoid circular ref problem in json serialization retry_info['exc'] = traceback.format_exception(*cause.exc_info) - return create_volume(context, CONF.volume_topic, volume.id, + return create_volume(context, constants.VOLUME_TOPIC, volume.id, request_spec=request_spec, filter_properties=filter_properties, volume=volume) diff --git a/cinder/volume/manager.py b/cinder/volume/manager.py index 9eb46f7ce..3fe696697 100644 --- a/cinder/volume/manager.py +++ b/cinder/volume/manager.py @@ -24,7 +24,6 @@ intact. **Related Flags** -:volume_topic: What :mod:`rpc` topic to listen to (default: `cinder-volume`). :volume_manager: The module name of a class derived from :class:`manager.Manager` (default: :class:`cinder.volume.manager.Manager`). @@ -54,6 +53,7 @@ profiler = importutils.try_import('osprofiler.profiler') import six from taskflow import exceptions as tfe +from cinder.common import constants from cinder import compute from cinder import context from cinder import coordination @@ -212,7 +212,7 @@ class VolumeManager(manager.SchedulerDependentManager): service = objects.Service.get_by_args( context.get_admin_context(), svc_host, - 'cinder-volume') + constants.VOLUME_BINARY) except exception.ServiceNotFound: # NOTE(jdg): This is to solve problems with unit tests LOG.info(_LI("Service not found for updating " @@ -522,7 +522,7 @@ class VolumeManager(manager.SchedulerDependentManager): service = objects.Service.get_by_args( context.get_admin_context(), svc_host, - 'cinder-volume') + constants.VOLUME_BINARY) except exception.ServiceNotFound: with excutils.save_and_reraise_exception(): LOG.error(_LE("Service not found for updating " @@ -3632,7 +3632,7 @@ class VolumeManager(manager.SchedulerDependentManager): service = objects.Service.get_by_args( context, svc_host, - 'cinder-volume') + constants.VOLUME_BINARY) volumes = objects.VolumeList.get_all_by_host(context, self.host) exception_encountered = False @@ -3741,7 +3741,7 @@ class VolumeManager(manager.SchedulerDependentManager): service = objects.Service.get_by_args( context, svc_host, - 'cinder-volume') + constants.VOLUME_BINARY) service.disabled = True service.disabled_reason = "frozen" service.save() @@ -3774,7 +3774,7 @@ class VolumeManager(manager.SchedulerDependentManager): service = objects.Service.get_by_args( context, svc_host, - 'cinder-volume') + constants.VOLUME_BINARY) service.disabled = False service.disabled_reason = "" service.save() diff --git a/cinder/volume/rpcapi.py b/cinder/volume/rpcapi.py index 9f47182e9..52f34be8e 100644 --- a/cinder/volume/rpcapi.py +++ b/cinder/volume/rpcapi.py @@ -16,15 +16,14 @@ Client side of the volume RPC API. """ -from oslo_config import cfg from oslo_serialization import jsonutils +from cinder.common import constants from cinder import quota from cinder import rpc from cinder.volume import utils -CONF = cfg.CONF QUOTAS = quota.QUOTAS @@ -108,7 +107,7 @@ class VolumeAPI(rpc.RPCAPI): """ RPC_API_VERSION = '2.5' - TOPIC = CONF.volume_topic + TOPIC = constants.VOLUME_TOPIC BINARY = 'cinder-volume' def _compat_ver(self, current, *legacy): diff --git a/releasenotes/notes/removed-rpc-topic-config-options-21c2b3f0e64f884c.yaml b/releasenotes/notes/removed-rpc-topic-config-options-21c2b3f0e64f884c.yaml new file mode 100644 index 000000000..b2469b694 --- /dev/null +++ b/releasenotes/notes/removed-rpc-topic-config-options-21c2b3f0e64f884c.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - The config options 'scheduler_topic', 'volume_topic' + and 'backup_topic' have been removed without a + deprecation period as these had never worked + correctly.