Browse Source

Merge "Fixes to skip validation of in-band deploy steps before agent boot" into stable/ussuri

changes/87/743587/1
Zuul 2 weeks ago
committed by Gerrit Code Review
parent
commit
a53bba694b
2 changed files with 35 additions and 1 deletions
  1. +1
    -1
      ironic/conductor/deployments.py
  2. +34
    -0
      ironic/tests/unit/conductor/test_deployments.py

+ 1
- 1
ironic/conductor/deployments.py View File

@@ -98,7 +98,7 @@ def start_deploy(task, manager, configdrive=None, event='deploy'):
task.driver.power.validate(task)
task.driver.deploy.validate(task)
utils.validate_instance_info_traits(task.node)
conductor_steps.validate_deploy_templates(task)
conductor_steps.validate_deploy_templates(task, skip_missing=True)
except exception.InvalidParameterValue as e:
raise exception.InstanceDeployFailure(
_("Failed to validate deploy or power info for node "


+ 34
- 0
ironic/tests/unit/conductor/test_deployments.py View File

@@ -19,6 +19,7 @@ from oslo_db import exception as db_exception
from oslo_utils import uuidutils

from ironic.common import exception
from ironic.common import images
from ironic.common import states
from ironic.common import swift
from ironic.conductor import deployments
@@ -372,6 +373,39 @@ class DoNodeDeployTestCase(mgr_utils.ServiceSetUpMixin, db_base.DbTestCase):
self.assertIsNotNone(node.last_error)
self.assertFalse(mock_deploy.called)

@mock.patch.object(task_manager.TaskManager, 'process_event',
autospec=True)
@mock.patch('ironic.drivers.modules.fake.FakePower.validate')
@mock.patch('ironic.drivers.modules.fake.FakeDeploy.validate')
@mock.patch.object(conductor_steps, 'validate_deploy_templates',
autospec=True)
@mock.patch.object(conductor_utils, 'validate_instance_info_traits',
autospec=True)
@mock.patch.object(images, 'is_whole_disk_image', autospec=True)
def test_start_deploy(self, mock_iwdi, mock_validate_traits,
mock_validate_templates, mock_deploy_validate,
mock_power_validate, mock_process_event):
self._start_service()
mock_iwdi.return_value = False
node = obj_utils.create_test_node(self.context, driver='fake-hardware',
provision_state=states.AVAILABLE,
target_provision_state=states.ACTIVE)
task = task_manager.TaskManager(self.context, node.uuid)

deployments.start_deploy(task, self.service, configdrive=None,
event='deploy')
node.refresh()
self.assertTrue(mock_iwdi.called)
mock_power_validate.assert_called_once_with(task)
mock_deploy_validate.assert_called_once_with(task)
mock_validate_traits.assert_called_once_with(task.node)
mock_validate_templates.assert_called_once_with(
task, skip_missing=True)
mock_process_event.assert_called_with(
mock.ANY, 'deploy', call_args=(
deployments.do_node_deploy, task, 1, None),
callback=mock.ANY, err_handler=mock.ANY)


@mgr_utils.mock_record_keepalive
class DoNextDeployStepTestCase(mgr_utils.ServiceSetUpMixin,


Loading…
Cancel
Save