]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Localize rpc options to rpc code.
authorRussell Bryant <rbryant@redhat.com>
Fri, 25 May 2012 18:13:34 +0000 (14:13 -0400)
committerMark McLoughlin <markmc@redhat.com>
Thu, 19 Jul 2012 16:20:18 +0000 (17:20 +0100)
Part of blueprint common-rpc.

Move rpc options from cinder.flags into cinder.rpc code.  This is necessary
before the rpc code can be moved to openstack-common.

Change-Id: I474c3660e1cbd3ab663571b1e088c84deb905e0b

cinder/flags.py
cinder/rpc/__init__.py
cinder/rpc/impl_kombu.py
cinder/scheduler/rpcapi.py
cinder/tests/scheduler/test_rpcapi.py

index 766f2559428b4bdd2cda5ff238153311d9163005..6c542d60575f3f5329450474bf48742ae6b4dc26 100644 (file)
@@ -114,9 +114,6 @@ core_opts = [
     ]
 
 debug_opts = [
-    cfg.BoolOpt('fake_rabbit',
-                default=False,
-                help='If passed, use a fake RabbitMQ provider'),
 ]
 
 FLAGS.register_cli_opts(log_opts)
@@ -152,41 +149,6 @@ global_opts = [
     cfg.StrOpt('volume_topic',
                default='cinder-volume',
                help='the topic volume nodes listen on'),
-    cfg.StrOpt('rabbit_host',
-               default='localhost',
-               help='the RabbitMQ host'),
-    cfg.IntOpt('rabbit_port',
-               default=5672,
-               help='the RabbitMQ port'),
-    cfg.BoolOpt('rabbit_use_ssl',
-                default=False,
-                help='connect over SSL for RabbitMQ'),
-    cfg.StrOpt('rabbit_userid',
-               default='guest',
-               help='the RabbitMQ userid'),
-    cfg.StrOpt('rabbit_password',
-               default='guest',
-               help='the RabbitMQ password'),
-    cfg.StrOpt('rabbit_virtual_host',
-               default='/',
-               help='the RabbitMQ virtual host'),
-    cfg.IntOpt('rabbit_retry_interval',
-               default=1,
-               help='how frequently to retry connecting with RabbitMQ'),
-    cfg.IntOpt('rabbit_retry_backoff',
-               default=2,
-               help='how long to backoff for between retries when connecting '
-                    'to RabbitMQ'),
-    cfg.IntOpt('rabbit_max_retries',
-               default=0,
-               help='maximum retries with trying to connect to RabbitMQ '
-                    '(the default of 0 implies an infinite retry count)'),
-    cfg.StrOpt('control_exchange',
-               default='cinder',
-               help='the main RabbitMQ exchange to connect to'),
-    cfg.BoolOpt('rabbit_durable_queues',
-                default=False,
-                help='use durable queues in RabbitMQ'),
     cfg.BoolOpt('api_rate_limit',
                 default=True,
                 help='whether to rate limit the api'),
index 4512e5ec162b8dc716b85a58e854f8030d4581e6..266e89b4fbc3ef99b8c8cec9061c4c1e0ebfb555 100644 (file)
@@ -46,6 +46,12 @@ rpc_opts = [
                default=['cinder.exception'],
                help='Modules of exceptions that are permitted to be recreated'
                     'upon receiving exception data from an rpc call.'),
+    cfg.StrOpt('control_exchange',
+               default='cinder',
+               help='AMQP exchange to connect to if using RabbitMQ or Qpid'),
+    cfg.BoolOpt('fake_rabbit',
+                default=False,
+                help='If passed, use a fake RabbitMQ provider'),
     ]
 
 _CONF = None
index c64356cf860ab6bb7d5c348daf21cb829e980b8b..ca24cde50464e6be315dc47c224a0f2f4a05c010 100644 (file)
@@ -46,6 +46,39 @@ kombu_opts = [
                default='',
                help=('SSL certification authority file '
                     '(valid only if SSL enabled)')),
+    cfg.StrOpt('rabbit_host',
+               default='localhost',
+               help='the RabbitMQ host'),
+    cfg.IntOpt('rabbit_port',
+               default=5672,
+               help='the RabbitMQ port'),
+    cfg.BoolOpt('rabbit_use_ssl',
+                default=False,
+                help='connect over SSL for RabbitMQ'),
+    cfg.StrOpt('rabbit_userid',
+               default='guest',
+               help='the RabbitMQ userid'),
+    cfg.StrOpt('rabbit_password',
+               default='guest',
+               help='the RabbitMQ password'),
+    cfg.StrOpt('rabbit_virtual_host',
+               default='/',
+               help='the RabbitMQ virtual host'),
+    cfg.IntOpt('rabbit_retry_interval',
+               default=1,
+               help='how frequently to retry connecting with RabbitMQ'),
+    cfg.IntOpt('rabbit_retry_backoff',
+               default=2,
+               help='how long to backoff for between retries when connecting '
+                    'to RabbitMQ'),
+    cfg.IntOpt('rabbit_max_retries',
+               default=0,
+               help='maximum retries with trying to connect to RabbitMQ '
+                    '(the default of 0 implies an infinite retry count)'),
+    cfg.BoolOpt('rabbit_durable_queues',
+                default=False,
+                help='use durable queues in RabbitMQ'),
+
     ]
 
 LOG = rpc_common.LOG
index f899b22796137a7f6a7d7ebdffeee9888278e44c..32fae184a8da140cbfbc77f4d2e2b17141709014 100644 (file)
@@ -39,41 +39,8 @@ class SchedulerAPI(cinder.rpc.proxy.RpcProxy):
         super(SchedulerAPI, self).__init__(topic=FLAGS.scheduler_topic,
                 default_version=self.RPC_API_VERSION)
 
-    def run_instance(self, ctxt, topic, request_spec, admin_password,
-            injected_files, requested_networks, is_first_time,
-            filter_properties, call=True):
-        rpc_method = self.call if call else self.cast
-        return rpc_method(ctxt, self.make_msg('run_instance', topic=topic,
-                request_spec=request_spec, admin_password=admin_password,
-                injected_files=injected_files,
-                requested_networks=requested_networks,
-                is_first_time=is_first_time,
-                filter_properties=filter_properties))
-
-    def prep_resize(self, ctxt, topic, instance_uuid, instance_type_id, image,
-            update_db, request_spec, filter_properties):
-        self.cast(ctxt, self.make_msg('prep_resize', topic=topic,
-                instance_uuid=instance_uuid, instance_type_id=instance_type_id,
-                image=image, update_db=update_db, request_spec=request_spec,
-                filter_properties=filter_properties))
-
-    def show_host_resources(self, ctxt, host):
-        return self.call(ctxt, self.make_msg('show_host_resources', host=host))
-
-    def live_migration(self, ctxt, block_migration, disk_over_commit,
-            instance_id, dest, topic):
-        # NOTE(comstud): Call vs cast so we can get exceptions back, otherwise
-        # this call in the scheduler driver doesn't return anything.
-        return self.call(ctxt, self.make_msg('live_migration',
-                block_migration=block_migration,
-                disk_over_commit=disk_over_commit, instance_id=instance_id,
-                dest=dest, topic=topic))
-
     def update_service_capabilities(self, ctxt, service_name, host,
             capabilities):
         self.fanout_cast(ctxt, self.make_msg('update_service_capabilities',
                 service_name=service_name, host=host,
                 capabilities=capabilities))
-
-    def get_host_list(self, ctxt):
-        return self.call(ctxt, self.make_msg('get_host_list'))
index 972060f1604131c7d3a7f4973be2bde39863289f..d1a030bf03f84afd7eda60264020ccf8919aec9d 100644 (file)
@@ -63,41 +63,7 @@ class SchedulerRpcAPITestCase(test.TestCase):
         for arg, expected_arg in zip(self.fake_args, expected_args):
             self.assertEqual(arg, expected_arg)
 
-    def test_run_instance_call(self):
-        self._test_scheduler_api('run_instance', rpc_method='call',
-                topic='fake_topic', request_spec='fake_request_spec',
-                admin_password='pw', injected_files='fake_injected_files',
-                requested_networks='fake_requested_networks',
-                is_first_time=True, filter_properties='fake_filter_properties')
-
-    def test_run_instance_cast(self):
-        self._test_scheduler_api('run_instance', rpc_method='cast',
-                topic='fake_topic', request_spec='fake_request_spec',
-                admin_password='pw', injected_files='fake_injected_files',
-                requested_networks='fake_requested_networks',
-                is_first_time=True, filter_properties='fake_filter_properties')
-
-    def test_prep_resize(self):
-        self._test_scheduler_api('prep_resize', rpc_method='cast',
-                topic='fake_topic', instance_uuid='fake_uuid',
-                instance_type_id='fake_type_id', image='fake_image',
-                update_db='fake_update_db', request_spec='fake_request_spec',
-                filter_properties='fake_props')
-
-    def test_show_host_resources(self):
-        self._test_scheduler_api('show_host_resources', rpc_method='call',
-                host='fake_host')
-
-    def test_live_migration(self):
-        self._test_scheduler_api('live_migration', rpc_method='call',
-                block_migration='fake_block_migration',
-                disk_over_commit='fake_disk_over_commit',
-                instance_id='fake_id', dest='fake_dest', topic='fake_topic')
-
     def test_update_service_capabilities(self):
         self._test_scheduler_api('update_service_capabilities',
                 rpc_method='fanout_cast', service_name='fake_name',
                 host='fake_host', capabilities='fake_capabilities')
-
-    def test_get_host_list(self):
-        self._test_scheduler_api('get_host_list', rpc_method='call')