Fixes to skip validation of in-band deploy steps before agent boot

Validation should not fail even if any deploy step requested in the deployment
template is not available, unless inband deploy steps are retrieved.

Change-Id: I173e6b1a8037698d41f355c7ef55f7389594be1e
This commit is contained in:
Shivanand Tendulker 2020-07-15 14:02:43 -04:00
parent 3d778db0c4
commit 8c191ceb5a
2 changed files with 35 additions and 1 deletions

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 "

View File

@ -20,6 +20,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
@ -373,6 +374,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,