Raise TemporaryFailure if no conductors are online
Return 503 Service Unavailable error in case no conductors are online. This indicate to the caller that it can retry the operation. (Previously a 400 error was returned, which is confusing because it is not a user error.) Story: 2002600 Task: 22214 Change-Id: I2c21baaec2e35c0a63f3f4a95990b12c6a836065
This commit is contained in:
parent
fbc74b7924
commit
82fe2cb853
@ -128,6 +128,10 @@ class ConductorAPI(object):
|
|||||||
"""
|
"""
|
||||||
self.ring_manager.reset()
|
self.ring_manager.reset()
|
||||||
|
|
||||||
|
# There are no conductors, temporary failure - 503 Service Unavailable
|
||||||
|
if not self.ring_manager.ring:
|
||||||
|
raise exception.TemporaryFailure()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
ring = self.ring_manager[node.driver]
|
ring = self.ring_manager[node.driver]
|
||||||
dest = ring.get_nodes(node.uuid.encode('utf-8'),
|
dest = ring.get_nodes(node.uuid.encode('utf-8'),
|
||||||
|
@ -98,7 +98,7 @@ class RPCAPITestCase(db_base.DbTestCase):
|
|||||||
CONF.set_override('host', 'fake-host')
|
CONF.set_override('host', 'fake-host')
|
||||||
|
|
||||||
rpcapi = conductor_rpcapi.ConductorAPI(topic='fake-topic')
|
rpcapi = conductor_rpcapi.ConductorAPI(topic='fake-topic')
|
||||||
self.assertRaises(exception.NoValidHost,
|
self.assertRaises(exception.TemporaryFailure,
|
||||||
rpcapi.get_topic_for,
|
rpcapi.get_topic_for,
|
||||||
self.fake_node_obj)
|
self.fake_node_obj)
|
||||||
|
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
Ironic API now returns ``503 Service Unavailable`` for action requiring a
|
||||||
|
conductor when no conductors are online.
|
||||||
|
`Bug: 2002600 <https://storyboard.openstack.org/#!/story/2002600>`_.
|
Loading…
Reference in New Issue
Block a user