Fix topics so that the do not collide with nova.
* Without this, there are issues running cinder if you have previously run n-vol * Fix pep8 Change-Id: Id56dbfd6c4f62a74cc57edcc7859753dd7e36229
This commit is contained in:
parent
50792c2ff4
commit
2263cf7db7
@ -297,7 +297,7 @@ def _service_get_all_topic_subquery(context, session, topic, subq, label):
|
||||
def service_get_all_volume_sorted(context):
|
||||
session = get_session()
|
||||
with session.begin():
|
||||
topic = 'volume'
|
||||
topic = FLAGS.volume_topic
|
||||
label = 'volume_gigabytes'
|
||||
subq = model_query(context, models.Volume.host,
|
||||
func.sum(models.Volume.size).label(label),
|
||||
|
@ -155,10 +155,10 @@ global_opts = [
|
||||
help='A list of the glance api servers available to cinder '
|
||||
'([hostname|ip]:port)'),
|
||||
cfg.StrOpt('scheduler_topic',
|
||||
default='scheduler',
|
||||
default='cinder-scheduler',
|
||||
help='the topic scheduler nodes listen on'),
|
||||
cfg.StrOpt('volume_topic',
|
||||
default='volume',
|
||||
default='cinder-volume',
|
||||
help='the topic volume nodes listen on'),
|
||||
cfg.StrOpt('rabbit_host',
|
||||
default='localhost',
|
||||
|
@ -53,9 +53,9 @@ def cast_to_volume_host(context, host, method, update_db=True, **kwargs):
|
||||
db.volume_update(context, volume_id,
|
||||
{'host': host, 'scheduled_at': now})
|
||||
rpc.cast(context,
|
||||
db.queue_get_for(context, 'volume', host),
|
||||
db.queue_get_for(context, FLAGS.volume_topic, host),
|
||||
{"method": method, "args": kwargs})
|
||||
LOG.debug(_("Casted '%(method)s' to volume '%(host)s'") % locals())
|
||||
LOG.debug(_("Casted '%(method)s' to host '%(host)s'") % locals())
|
||||
|
||||
|
||||
def cast_to_host(context, topic, host, method, update_db=True, **kwargs):
|
||||
|
@ -238,9 +238,10 @@ class Service(object):
|
||||
if not binary:
|
||||
binary = os.path.basename(inspect.stack()[-1][1])
|
||||
if not topic:
|
||||
topic = binary.rpartition('cinder-')[2]
|
||||
topic = binary
|
||||
if not manager:
|
||||
manager = FLAGS.get('%s_manager' % topic, None)
|
||||
subtopic = topic.rpartition('cinder-')[2]
|
||||
manager = FLAGS.get('%s_manager' % subtopic, None)
|
||||
if report_interval is None:
|
||||
report_interval = FLAGS.report_interval
|
||||
if periodic_interval is None:
|
||||
|
@ -244,7 +244,8 @@ class SchedulerDriverModuleTestCase(test.TestCase):
|
||||
utils.utcnow().AndReturn('fake-now')
|
||||
db.volume_update(self.context, 31337,
|
||||
{'host': host, 'scheduled_at': 'fake-now'})
|
||||
db.queue_get_for(self.context, 'volume', host).AndReturn(queue)
|
||||
db.queue_get_for(self.context,
|
||||
FLAGS.volume_topic, host).AndReturn(queue)
|
||||
rpc.cast(self.context, queue,
|
||||
{'method': method,
|
||||
'args': fake_kwargs})
|
||||
@ -262,7 +263,8 @@ class SchedulerDriverModuleTestCase(test.TestCase):
|
||||
self.mox.StubOutWithMock(db, 'queue_get_for')
|
||||
self.mox.StubOutWithMock(rpc, 'cast')
|
||||
|
||||
db.queue_get_for(self.context, 'volume', host).AndReturn(queue)
|
||||
db.queue_get_for(self.context,
|
||||
FLAGS.volume_topic, host).AndReturn(queue)
|
||||
rpc.cast(self.context, queue,
|
||||
{'method': method,
|
||||
'args': fake_kwargs})
|
||||
@ -280,7 +282,8 @@ class SchedulerDriverModuleTestCase(test.TestCase):
|
||||
self.mox.StubOutWithMock(db, 'queue_get_for')
|
||||
self.mox.StubOutWithMock(rpc, 'cast')
|
||||
|
||||
db.queue_get_for(self.context, 'volume', host).AndReturn(queue)
|
||||
db.queue_get_for(self.context,
|
||||
FLAGS.volume_topic, host).AndReturn(queue)
|
||||
rpc.cast(self.context, queue,
|
||||
{'method': method,
|
||||
'args': fake_kwargs})
|
||||
|
@ -25,7 +25,7 @@ intact.
|
||||
|
||||
**Related Flags**
|
||||
|
||||
:volume_topic: What :mod:`rpc` topic to listen to (default: `volume`).
|
||||
: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`).
|
||||
|
Loading…
Reference in New Issue
Block a user