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 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(
|
||||
node.driver_internal_info.get('agent_last_heartbeat'),
|
||||
timeout or CONF.deploy.fast_track_timeout)
|
||||
|
@ -1965,7 +1965,8 @@ class FastTrackTestCase(db_base.DbTestCase):
|
||||
self.context, driver='fake-hardware',
|
||||
uuid=uuidutils.generate_uuid(),
|
||||
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')
|
||||
|
||||
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.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):
|
||||
mock_get_power.return_value = states.POWER_ON
|
||||
self.node.last_error = "bad things happened"
|
||||
|
6
releasenotes/notes/agent-rebooted-fab20d012fe6cbe8.yaml
Normal file
6
releasenotes/notes/agent-rebooted-fab20d012fe6cbe8.yaml
Normal file
@ -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
Block a user