volume=self.fake_volume,
connector='fake_connector',
force=False)
+
+ def test_accept_transfer(self):
+ self._test_volume_api('accept_transfer',
+ rpc_method='cast',
+ volume=self.fake_volume,
+ version='1.5')
help='The number of characters in the salt.'),
cfg.IntOpt('volume_transfer_key_length', default=16,
help='The number of characters in the '
- 'autogenerated auth key.'), ]
+ 'autogenerated auth key.'), ]
FLAGS = flags.FLAGS
FLAGS.register_opts(volume_transfer_opts)
try:
# Transfer ownership of the volume now, must use an elevated
# context.
+ self.volume_api.accept_transfer(context, vol_ref)
self.db.transfer_accept(context.elevated(),
transfer_id,
context.user_id,
connector,
force)
+ def accept_transfer(self, context, volume):
+ return self.volume_rpcapi.accept_transfer(context,
+ volume)
+
def _create_snapshot(self, context,
volume, name, description,
force=False, metadata=None):
data['QoS_support'] = False
self._stats = data
+ def accept_transfer(self, volume):
+ pass
+
class FakeISCSIDriver(ISCSIDriver):
"""Logs calls instead of executing."""
volume_ref = self.db.volume_get(context, volume_id)
self.driver.terminate_connection(volume_ref, connector, force=force)
+ def accept_transfer(self, context, volume_id):
+ volume_ref = self.db.volume_get(context, volume_id)
+ self.driver.accept_transfer(volume_ref)
+
@manager.periodic_task
def _report_driver_status(self, context):
LOG.info(_("Updating volume status"))
1.3 - Pass all image metadata (not just ID) in copy_volume_to_image
1.4 - Add request_spec, filter_properties and
allow_reschedule arguments to create_volume().
+ 1.5 - Add accept_transfer
'''
BASE_RPC_API_VERSION = '1.0'
def publish_service_capabilities(self, ctxt):
self.fanout_cast(ctxt, self.make_msg('publish_service_capabilities'),
version='1.2')
+
+ def accept_transfer(self, ctxt, volume):
+ self.cast(ctxt,
+ self.make_msg('accept_transfer',
+ volume_id=volume['id']),
+ topic=rpc.queue_get_for(ctxt, self.topic, volume['host']),
+ version='1.5')