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
]
debug_opts = [
- cfg.BoolOpt('fake_rabbit',
- default=False,
- help='If passed, use a fake RabbitMQ provider'),
]
FLAGS.register_cli_opts(log_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'),
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
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
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'))
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')