Merge "Add call to vol driver when accepting a transfer"
This commit is contained in:
@@ -170,3 +170,9 @@ class VolumeRpcAPITestCase(test.TestCase):
|
||||
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')
|
||||
|
||||
@@ -178,6 +178,7 @@ class API(base.Base):
|
||||
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,
|
||||
|
||||
@@ -518,6 +518,10 @@ class API(base.Base):
|
||||
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):
|
||||
|
||||
@@ -480,6 +480,9 @@ class ISCSIDriver(VolumeDriver):
|
||||
data['QoS_support'] = False
|
||||
self._stats = data
|
||||
|
||||
def accept_transfer(self, volume):
|
||||
pass
|
||||
|
||||
|
||||
class FakeISCSIDriver(ISCSIDriver):
|
||||
"""Logs calls instead of executing."""
|
||||
|
||||
@@ -701,6 +701,10 @@ class VolumeManager(manager.SchedulerDependentManager):
|
||||
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"))
|
||||
|
||||
@@ -38,6 +38,7 @@ class VolumeAPI(cinder.openstack.common.rpc.proxy.RpcProxy):
|
||||
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'
|
||||
@@ -128,3 +129,10 @@ class VolumeAPI(cinder.openstack.common.rpc.proxy.RpcProxy):
|
||||
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')
|
||||
|
||||
Reference in New Issue
Block a user