]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Fix topics so that the do not collide with nova.
authorAnthony Young <sleepsonthefloor@gmail.com>
Wed, 30 May 2012 22:24:41 +0000 (15:24 -0700)
committerAnthony Young <sleepsonthefloor@gmail.com>
Wed, 30 May 2012 23:00:53 +0000 (16:00 -0700)
 * Without this, there are issues running cinder if
   you have previously run n-vol
 * Fix pep8

Change-Id: Id56dbfd6c4f62a74cc57edcc7859753dd7e36229

cinder/db/sqlalchemy/api.py
cinder/flags.py
cinder/scheduler/driver.py
cinder/service.py
cinder/tests/scheduler/test_scheduler.py
cinder/volume/manager.py

index 435ace8546db861e78a8b169a4bcba807d5b1c9e..05dd90fcfdcac8e2dbf7e2fc83281f1c0c026d5f 100644 (file)
@@ -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),
index 3f1d9f5d8895bb03a5c07c70e79b4caed83e68f7..60e86999b79f6cf09bce8987b2f78bec6156e1ca 100644 (file)
@@ -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',
index d84893ee6f281cef030aaa7bdf9350ad86e2268f..1696cbd28999e88d82305b3f77b8d1f627a36f5d 100644 (file)
@@ -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):
index 363b3d967a2831178fdcfa8bf0cfa045b47ed538..0db2bf5982b54421d20f2a4ae35bc1090bb9d282 100644 (file)
@@ -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:
index 346132a7d48ecaf335afae76c696fcb81b2901c1..cb1adce901b188dce2cc44ef236658d7c629292f 100644 (file)
@@ -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})
index 8266a64701e1c2cf334ed88dda253bda6870610a..b53eb5b14e82d38a69af8bc6170bb061cce7aa33 100644 (file)
@@ -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`).