Switch failover-host from rpc call to cast

There is some concern that with large numbers of volumes it will be
difficult for drivers to failover the host before the rpc timeout hits.

To avoid asking admins to bump the timeout just for these cases we can
switch it to do a non-blocking cast instead of call. The difference now
being that the active_backend_id is not returned from the API call to
failover-host. An admin will have to look at the service-list output
to see when it has changed states from ‘failing-over’ and then check
what its active_backend_id is at that time.

Change-Id: I69b4908fe783cf785d3e1612422fca15fea01c6f
Closes-Bug: #1555342
This commit is contained in:
Patrick East 2016-03-09 11:08:27 -08:00
parent d58c50474c
commit fddb9c7bc0
5 changed files with 11 additions and 14 deletions

View File

@ -182,10 +182,12 @@ class ServiceController(wsgi.Controller):
elif id == "thaw":
return self._thaw(context, body['host'])
elif id == "failover_host":
return self._failover(context,
body['host'],
body.get('backend_id',
None))
self._failover(
context,
body['host'],
body.get('backend_id', None)
)
return webob.Response(status_int=202)
else:
raise webob.exc.HTTPNotFound(explanation=_("Unknown action"))

View File

@ -593,7 +593,7 @@ class VolumeRpcAPITestCase(test.TestCase):
version='1.39')
def test_failover_host(self):
self._test_volume_api('failover_host', rpc_method='call',
self._test_volume_api('failover_host', rpc_method='cast',
host='fake_host',
secondary_backend_id='fake_backend',
version='1.39')

View File

@ -1619,10 +1619,7 @@ class API(base.Base):
% expected_status)
LOG.error(msg)
raise exception.InvalidInput(reason=msg)
active_backend_id = self.volume_rpcapi.failover_host(
ctxt, host,
secondary_id)
return active_backend_id
self.volume_rpcapi.failover_host(ctxt, host, secondary_id)
def freeze_host(self, ctxt, host):

View File

@ -3274,7 +3274,6 @@ class VolumeManager(manager.SchedulerDependentManager):
:param context: security context
:param secondary_backend_id: Specifies backend_id to fail over to
:returns : ID of the backend that was failed-over to
"""
svc_host = vol_utils.extract_host(self.host, 'backend')
@ -3320,7 +3319,7 @@ class VolumeManager(manager.SchedulerDependentManager):
"%(host)s invalid target ID %(backend_id)"),
{'host': self.host, 'backend_id':
secondary_backend_id})
return None
return
if secondary_backend_id == "default":
service.replication_status = fields.ReplicationStatus.ENABLED
@ -3351,7 +3350,6 @@ class VolumeManager(manager.SchedulerDependentManager):
vobj.save()
LOG.info(_LI("Failed over to replication target successfully."))
return active_backend_id
def freeze_host(self, context):
"""Freeze management plane on this backend.

View File

@ -328,8 +328,8 @@ class VolumeAPI(rpc.RPCAPI):
secondary_backend_id=None):
"""Failover host to the specified backend_id (secondary). """
cctxt = self._get_cctxt(host, '1.39')
return cctxt.call(ctxt, 'failover_host',
secondary_backend_id=secondary_backend_id)
cctxt.cast(ctxt, 'failover_host',
secondary_backend_id=secondary_backend_id)
def manage_existing_snapshot(self, ctxt, snapshot, ref, host):
cctxt = self._get_cctxt(host, '1.28')