self._test_volume_api('accept_transfer',
rpc_method='cast',
volume=self.fake_volume,
- version='1.5')
+ new_user='e5565fd0-06c8-11e3-'
+ '8ffd-0800200c9b77',
+ new_project='e4465fd0-06c8-11e3'
+ '-8ffd-0800200c9a66',
+ version='1.9')
def test_extend_volume(self):
self._test_volume_api('extend_volume',
try:
# Transfer ownership of the volume now, must use an elevated
# context.
- self.volume_api.accept_transfer(context, vol_ref)
+ self.volume_api.accept_transfer(context,
+ vol_ref,
+ context.user_id,
+ context.project_id)
self.db.transfer_accept(context.elevated(),
transfer_id,
context.user_id,
force)
@wrap_check_policy
- def accept_transfer(self, context, volume):
+ def accept_transfer(self, context, volume, new_user, new_project):
return self.volume_rpcapi.accept_transfer(context,
- volume)
+ volume,
+ new_user,
+ new_project)
def _create_snapshot(self, context,
volume, name, description,
data['QoS_support'] = False
self._stats = data
- def accept_transfer(self, volume):
+ def accept_transfer(self, volume, new_user, new_project):
pass
class VolumeManager(manager.SchedulerDependentManager):
"""Manages attachable block storage devices."""
- RPC_API_VERSION = '1.8'
+ RPC_API_VERSION = '1.9'
def __init__(self, volume_driver=None, service_name=None,
*args, **kwargs):
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)
+ def accept_transfer(self, context, volume_id, new_user, new_project):
+ # NOTE(jdg): need elevated context as we haven't "given" the vol
+ # yet
+ volume_ref = self.db.volume_get(context.elevated(), volume_id)
+ self.driver.accept_transfer(volume_ref, new_user, new_project)
def _migrate_volume_generic(self, ctxt, volume, host):
rpcapi = volume_rpcapi.VolumeAPI()
1.7 - Adds host_name parameter to attach_volume()
to allow attaching to host rather than instance.
1.8 - Add migrate_volume, rename_volume.
+ 1.9 - Add new_user and new_project to accept_transfer.
'''
BASE_RPC_API_VERSION = '1.0'
self.fanout_cast(ctxt, self.make_msg('publish_service_capabilities'),
version='1.2')
- def accept_transfer(self, ctxt, volume):
+ def accept_transfer(self, ctxt, volume, new_user, new_project):
self.cast(ctxt,
self.make_msg('accept_transfer',
- volume_id=volume['id']),
+ volume_id=volume['id'],
+ new_user=new_user,
+ new_project=new_project),
topic=rpc.queue_get_for(ctxt, self.topic, volume['host']),
- version='1.5')
+ version='1.9')
def extend_volume(self, ctxt, volume, new_size):
self.cast(ctxt,