Merge "Don't mark an agent as alive if rebooted"
This commit is contained in:
commit
af29f398cc
|
@ -1055,6 +1055,11 @@ def agent_is_alive(node, timeout=None):
|
||||||
:param node: A node object.
|
:param node: A node object.
|
||||||
:param timeout: Heartbeat timeout, defaults to `fast_track_timeout`.
|
:param timeout: Heartbeat timeout, defaults to `fast_track_timeout`.
|
||||||
"""
|
"""
|
||||||
|
# If no agent_url is present then we have powered down since the
|
||||||
|
# last agent heartbeat
|
||||||
|
if not node.driver_internal_info.get('agent_url'):
|
||||||
|
return False
|
||||||
|
|
||||||
return value_within_timeout(
|
return value_within_timeout(
|
||||||
node.driver_internal_info.get('agent_last_heartbeat'),
|
node.driver_internal_info.get('agent_last_heartbeat'),
|
||||||
timeout or CONF.deploy.fast_track_timeout)
|
timeout or CONF.deploy.fast_track_timeout)
|
||||||
|
|
|
@ -1965,7 +1965,8 @@ class FastTrackTestCase(db_base.DbTestCase):
|
||||||
self.context, driver='fake-hardware',
|
self.context, driver='fake-hardware',
|
||||||
uuid=uuidutils.generate_uuid(),
|
uuid=uuidutils.generate_uuid(),
|
||||||
driver_internal_info={
|
driver_internal_info={
|
||||||
'agent_last_heartbeat': str(timeutils.utcnow().isoformat())})
|
'agent_last_heartbeat': str(timeutils.utcnow().isoformat()),
|
||||||
|
'agent_url': 'a_url'})
|
||||||
self.config(fast_track=True, group='deploy')
|
self.config(fast_track=True, group='deploy')
|
||||||
|
|
||||||
def test_is_fast_track(self, mock_get_power):
|
def test_is_fast_track(self, mock_get_power):
|
||||||
|
@ -1997,6 +1998,14 @@ class FastTrackTestCase(db_base.DbTestCase):
|
||||||
self.context, self.node.uuid, shared=False) as task:
|
self.context, self.node.uuid, shared=False) as task:
|
||||||
self.assertFalse(conductor_utils.is_fast_track(task))
|
self.assertFalse(conductor_utils.is_fast_track(task))
|
||||||
|
|
||||||
|
def test_is_fast_track_powered_after_heartbeat(self, mock_get_power):
|
||||||
|
mock_get_power.return_value = states.POWER_ON
|
||||||
|
with task_manager.acquire(
|
||||||
|
self.context, self.node.uuid, shared=False) as task:
|
||||||
|
conductor_utils.node_power_action(task, states.POWER_OFF)
|
||||||
|
conductor_utils.node_power_action(task, states.POWER_ON)
|
||||||
|
self.assertFalse(conductor_utils.is_fast_track(task))
|
||||||
|
|
||||||
def test_is_fast_track_error_blocks(self, mock_get_power):
|
def test_is_fast_track_error_blocks(self, mock_get_power):
|
||||||
mock_get_power.return_value = states.POWER_ON
|
mock_get_power.return_value = states.POWER_ON
|
||||||
self.node.last_error = "bad things happened"
|
self.node.last_error = "bad things happened"
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
Fixes fast-track to prevent marking the agent as alive if
|
||||||
|
trying to rebuild a node before the fast-track timeout has
|
||||||
|
expired.
|
Loading…
Reference in New Issue