Ejemplo n.º 1
0
 def test_pxe_get_deploy_patch_fail_no_kr_id(self):
     self.flavor = ironic_utils.get_test_flavor(extra_specs={})
     node = ironic_utils.get_test_node(driver='pxe_fake')
     instance = fake_instance.fake_instance_obj(self.ctx, node=node.uuid)
     self.assertRaises(exception.InvalidParameterValue,
                       patcher.create(node).get_deploy_patch, instance,
                       self.image_meta, self.flavor)
Ejemplo n.º 2
0
 def test_pxe_get_deploy_patch(self):
     node = ironic_utils.get_test_node(driver='pxe_fake')
     instance = fake_instance.fake_instance_obj(self.ctx, node=node.uuid)
     extra_specs = self.flavor['extra_specs']
     expected = [{
         'path': '/driver_info/pxe_deploy_kernel',
         'value': extra_specs['baremetal:deploy_kernel_id'],
         'op': 'add'
     }, {
         'path': '/driver_info/pxe_deploy_ramdisk',
         'value': extra_specs['baremetal:deploy_ramdisk_id'],
         'op': 'add'
     }, {
         'path': '/driver_info/pxe_image_source',
         'value': self.image_meta['id'],
         'op': 'add'
     }, {
         'path': '/driver_info/pxe_root_gb',
         'value': str(instance['root_gb']),
         'op': 'add'
     }, {
         'path': '/driver_info/pxe_swap_mb',
         'value': str(self.flavor['swap']),
         'op': 'add'
     }]
     patch = patcher.create(node).get_deploy_patch(instance,
                                                   self.image_meta,
                                                   self.flavor)
     self.assertEqual(sorted(expected), sorted(patch))
Ejemplo n.º 3
0
 def test_pxe_get_deploy_patch_fail_no_kr_id(self):
     self.flavor = ironic_utils.get_test_flavor(extra_specs={})
     node = ironic_utils.get_test_node(driver='pxe_fake')
     instance = fake_instance.fake_instance_obj(self.ctx, node=node.uuid)
     self.assertRaises(exception.InvalidParameterValue,
                       patcher.create(node).get_deploy_patch,
                       instance, self.image_meta, self.flavor)
Ejemplo n.º 4
0
 def test_pxe_get_cleanup_patch(self):
     driver_info = {'pxe_image_source': 'fake-image-id',
                    'pxe_deploy_kernel': 'fake-kernel-id',
                    'pxe_deploy_ramdisk': 'fake-ramdisk-id',
                    'pxe_root_gb': '1024',
                    'pxe_swap_mb': '512',
                    'pxe_preserve_ephemeral': True,
                    'pxe_ephemeral_format': 'fake-format'}
     node = ironic_utils.get_test_node(driver='pxe_fake',
                                       driver_info=driver_info)
     instance = fake_instance.fake_instance_obj(self.ctx, node=node.uuid)
     patch = patcher.create(node).get_cleanup_patch(instance, None)
     expected = [{'path': '/driver_info/pxe_image_source',
                  'op': 'remove'},
                 {'path': '/driver_info/pxe_deploy_kernel',
                  'op': 'remove'},
                 {'path': '/driver_info/pxe_deploy_ramdisk',
                  'op': 'remove'},
                 {'path': '/driver_info/pxe_root_gb',
                  'op': 'remove'},
                 {'path': '/driver_info/pxe_swap_mb',
                  'op': 'remove'},
                 {'path': '/driver_info/pxe_preserve_ephemeral',
                  'op': 'remove'},
                 {'path': '/driver_info/pxe_ephemeral_format',
                  'op': 'remove'}]
     self.assertEqual(sorted(expected), sorted(patch))
Ejemplo n.º 5
0
 def test_pxe_get_cleanup_patch_no_flavor_kernel_ramdisk_ids(self):
     self.flavor = ironic_utils.get_test_flavor(extra_specs={})
     node = ironic_utils.get_test_node(driver='pxe_fake')
     patch = patcher.create(node).get_cleanup_patch(self.instance, None,
                                                    self.flavor)
     # If there's no extra_specs patch should be exactly like a
     # generic patch
     self.assertEqual(self._expected_cleanup_patch, patch)
Ejemplo n.º 6
0
 def test_pxe_get_deploy_patch_no_flavor_kernel_ramdisk_ids(self):
     flavor = ironic_utils.get_test_flavor(extra_specs={})
     node = ironic_utils.get_test_node(driver='pxe_fake')
     patch = patcher.create(node).get_deploy_patch(
             self.instance, self.image_meta, flavor)
     # If there's no extra_specs patch should be exactly like a
     # generic patch
     self.assertEqual(sorted(self._expected_deploy_patch), sorted(patch))
Ejemplo n.º 7
0
 def test_generic_get_deploy_patch_preserve_ephemeral(self):
     node = ironic_utils.get_test_node(driver='fake')
     for preserve in [True, False]:
         patch = patcher.create(node).get_deploy_patch(
                 self.instance, self.image_meta, self.flavor,
                 preserve_ephemeral=preserve)
         expected = [{'path': '/instance_info/preserve_ephemeral',
                      'value': str(preserve), 'op': 'add', }]
         expected += self._expected_deploy_patch
         self.assertEqual(sorted(expected), sorted(patch))
Ejemplo n.º 8
0
 def test_pxe_get_deploy_patch_no_preserve_ephemeral(self):
     node = ironic_utils.get_test_node(driver='pxe_fake')
     instance = fake_instance.fake_instance_obj(
                     self.ctx, node=node.uuid, ephemeral_gb=10)
     patch = patcher.create(node).get_deploy_patch(
                 instance, self.image_meta, self.flavor)
     for preserve in [True, False]:
         unexpected =  {'path': '/instance_info/preserve_ephemeral',
                        'value': str(preserve), 'op': 'add', }
         self.assertNotIn(unexpected, patch)
Ejemplo n.º 9
0
 def test_pxe_get_cleanup_patch_no_flavor_kernel_ramdisk_ids(self):
     self.flavor = ironic_utils.get_test_flavor(extra_specs={})
     driver_info = {'pxe_deploy_kernel': 'fake-kernel-id',
                    'pxe_deploy_ramdisk': 'fake-ramdisk-id'}
     node = ironic_utils.get_test_node(driver='pxe_fake',
                                       driver_info=driver_info)
     instance = fake_instance.fake_instance_obj(self.ctx, node=node.uuid)
     patch = patcher.create(node).get_cleanup_patch(instance, None,
                                                    self.flavor)
     self.assertEqual([], patch)
Ejemplo n.º 10
0
 def test_pxe_get_cleanup_patch_no_flavor_kernel_ramdisk_ids(self):
     self.flavor = ironic_utils.get_test_flavor(extra_specs={})
     driver_info = {
         'pxe_deploy_kernel': 'fake-kernel-id',
         'pxe_deploy_ramdisk': 'fake-ramdisk-id'
     }
     node = ironic_utils.get_test_node(driver='pxe_fake',
                                       driver_info=driver_info)
     instance = fake_instance.fake_instance_obj(self.ctx, node=node.uuid)
     patch = patcher.create(node).get_cleanup_patch(instance, None,
                                                    self.flavor)
     self.assertEqual([], patch)
Ejemplo n.º 11
0
 def test_pxe_get_cleanup_patch(self):
     driver_info = {'pxe_deploy_kernel': 'fake-kernel-id',
                    'pxe_deploy_ramdisk': 'fake-ramdisk-id'}
     node = ironic_utils.get_test_node(driver='pxe_fake',
                                       driver_info=driver_info)
     patch = patcher.create(node).get_cleanup_patch(self.instance, None,
                                                    self.flavor)
     expected = [{'path': '/driver_info/pxe_deploy_kernel',
                  'op': 'remove'},
                 {'path': '/driver_info/pxe_deploy_ramdisk',
                  'op': 'remove'}]
     self.assertEqual(sorted(expected), sorted(patch))
Ejemplo n.º 12
0
 def test_pxe_get_deploy_patch_with_ephemeral(self):
     node = ironic_utils.get_test_node(driver='pxe_fake')
     instance = fake_instance.fake_instance_obj(
                     self.ctx, node=node.uuid, ephemeral_gb=10)
     CONF.set_override('default_ephemeral_format', 'testfmt')
     patch = patcher.create(node).get_deploy_patch(
             instance, self.image_meta, self.flavor)
     expected1 = {'path': '/driver_info/pxe_ephemeral_gb',
                  'value': '10', 'op': 'add'}
     expected2 = {'path': '/driver_info/pxe_ephemeral_format',
                  'value': 'testfmt', 'op': 'add'}
     self.assertIn(expected1, patch)
     self.assertIn(expected2, patch)
Ejemplo n.º 13
0
 def test_pxe_get_deploy_patch(self):
     node = ironic_utils.get_test_node(driver='pxe_fake')
     extra_specs = self.flavor['extra_specs']
     expected = [{'path': '/driver_info/pxe_deploy_kernel',
                  'value': extra_specs['baremetal:deploy_kernel_id'],
                  'op': 'add'},
                 {'path': '/driver_info/pxe_deploy_ramdisk',
                  'value': extra_specs['baremetal:deploy_ramdisk_id'],
                  'op': 'add'}]
     expected += self._expected_deploy_patch
     patch = patcher.create(node).get_deploy_patch(
             self.instance, self.image_meta, self.flavor)
     self.assertEqual(sorted(expected), sorted(patch))
Ejemplo n.º 14
0
 def test_pxe_get_deploy_patch_with_ephemeral(self):
     node = ironic_utils.get_test_node(driver='pxe_fake')
     instance = fake_instance.fake_instance_obj(
                     self.ctx, node=node.uuid, ephemeral_gb=10)
     CONF.set_override('default_ephemeral_format', 'testfmt')
     patch = patcher.create(node).get_deploy_patch(
             instance, self.image_meta, self.flavor)
     expected1 = {'path': '/instance_info/ephemeral_gb',
                  'value': '10', 'op': 'add'}
     expected2 = {'path': '/instance_info/ephemeral_format',
                  'value': 'testfmt', 'op': 'add'}
     self.assertIn(expected1, patch)
     self.assertIn(expected2, patch)
Ejemplo n.º 15
0
    def _add_driver_fields(self, node, instance, image_meta, flavor, 
                           admin_pass=None, files=None, network_info=None,
                           preserve_ephemeral=None):
        icli = client_wrapper.IronicClientWrapper()
        patch = patcher.create(node).get_deploy_patch(instance,
                                                      image_meta,
                                                      flavor,
                                                      preserve_ephemeral)

        # Associate the node with an instance
        patch.append({'path': '/instance_uuid', 'op': 'add',
                      'value': instance['uuid']})

        if configdrive.required_by(instance):
            LOG.info(_('Using config drive'), instance=instance)
            extra_md = {}
            if admin_pass:
                extra_md['admin_pass'] = admin_pass

            inst_md = instance_metadata.InstanceMetadata(instance,
                content=files, extra_md=extra_md, network_info=network_info)

            fd, configdrive_path = tempfile.mkstemp()
            os.close(fd)

            with configdrive.ConfigDriveBuilder(instance_md=inst_md) as cdb:
                try:
                    cdb.make_drive(configdrive_path)
                except processutils.ProcessExecutionError as e:
                    with excutils.save_and_reraise_exception():
                        LOG.error(_('Creating config drive failed '
                                  'with error: %s'),
                                  e, instance=instance)
            # gzip the configdrive.
            with open(configdrive_path, "rb") as configdrive_fh:
                configdrive_payload = base64.b64encode(zlib.compress(
                                                            configdrive_fh.read()))
            os.remove(configdrive_path)
            patch.append({'path': '/instance_info/config_drive', 'op': 'add',
                      'value': configdrive_payload})

        try:
            icli.call('node.update', node.uuid, patch)
        except ironic_exception.BadRequest:
            msg = (_("Failed to add deploy parameters on node %(node)s "
                     "when provisioning the instance %(instance)s")
                   % {'node': node.uuid, 'instance': instance['uuid']})
            LOG.error(msg)
            raise exception.InstanceDeployFailure(msg)
Ejemplo n.º 16
0
 def test_pxe_get_deploy_patch_no_preserve_ephemeral(self):
     node = ironic_utils.get_test_node(driver='pxe_fake')
     instance = fake_instance.fake_instance_obj(self.ctx,
                                                node=node.uuid,
                                                ephemeral_gb=10)
     patch = patcher.create(node).get_deploy_patch(instance,
                                                   self.image_meta,
                                                   self.flavor)
     for preserve in [True, False]:
         unexpected = {
             'path': '/instance_info/preserve_ephemeral',
             'value': str(preserve),
             'op': 'add',
         }
         self.assertNotIn(unexpected, patch)
Ejemplo n.º 17
0
 def test_generic_get_deploy_patch_ephemeral(self):
     CONF.set_override('default_ephemeral_format', 'testfmt')
     node = ironic_utils.get_test_node(driver='fake')
     instance = fake_instance.fake_instance_obj(self.ctx,
                                                ephemeral_gb=10)
     patch = patcher.create(node).get_deploy_patch(
             instance, self.image_meta, self.flavor)
     expected = [{'path': '/instance_info/ephemeral_gb',
                  'value': str(instance.ephemeral_gb),
                  'op': 'add'},
                 {'path': '/instance_info/ephemeral_format',
                  'value': 'testfmt',
                  'op': 'add'}]
     expected += self._expected_deploy_patch
     self.assertEqual(sorted(expected), sorted(patch))
Ejemplo n.º 18
0
 def test_pxe_get_deploy_patch_no_flavor_kernel_ramdisk_ids(self):
     self.flavor = ironic_utils.get_test_flavor(extra_specs={})
     node = ironic_utils.get_test_node(driver='pxe_fake')
     instance = fake_instance.fake_instance_obj(self.ctx, node=node.uuid)
     expected = [{'path': '/instance_info/image_source',
                  'value': self.image_meta['id'],
                  'op': 'add'},
                 {'path': '/instance_info/root_gb',
                  'value': str(instance['root_gb']),
                  'op': 'add'},
                 {'path': '/instance_info/swap_mb',
                  'value': str(self.flavor['swap']),
                  'op': 'add'}]
     patch = patcher.create(node).get_deploy_patch(
             instance, self.image_meta, self.flavor)
     self.assertEqual(sorted(expected), sorted(patch))
Ejemplo n.º 19
0
    def _add_driver_fields(self, node, instance, image_meta, flavor):
        icli = client_wrapper.IronicClientWrapper()
        patch = patcher.create(node).get_deploy_patch(
                instance, image_meta, flavor)

        # Associate the node with an instance
        patch.append({'path': '/instance_uuid', 'op': 'add',
                      'value': instance['uuid']})
        try:
            icli.call('node.update', node.uuid, patch)
        except ironic_exception.HTTPBadRequest:
            msg = (_("Failed to add deploy parameters on node %(node)s "
                     "when provisioning the instance %(instance)s")
                   % {'node': node.uuid, 'instance': instance['uuid']})
            LOG.error(msg)
            raise exception.InstanceDeployFailure(msg)
Ejemplo n.º 20
0
    def _add_driver_fields(self, node, instance, image_meta, flavor):
        icli = self._get_client()
        patch = patcher.create(node).get_deploy_patch(
                instance, image_meta, flavor)

        # Associate the node with an instance
        patch.append({'path': '/instance_uuid', 'op': 'add',
                      'value': instance['uuid']})
        try:
            self._retry_if_service_is_unavailable(icli.node.update,
                                                  node.uuid, patch)
        except (MaximumRetriesReached, ironic_exception.HTTPBadRequest):
            msg = (_("Failed to add deploy parameters on node %(node)s "
                     "when provisioning the instance %(instance)s")
                   % {'node': node.uuid, 'instance': instance['uuid']})
            LOG.error(msg)
            raise exception.InstanceDeployFailure(msg)
Ejemplo n.º 21
0
 def test_pxe_get_cleanup_patch(self):
     driver_info = {
         'pxe_deploy_kernel': 'fake-kernel-id',
         'pxe_deploy_ramdisk': 'fake-ramdisk-id'
     }
     node = ironic_utils.get_test_node(driver='pxe_fake',
                                       driver_info=driver_info)
     instance = fake_instance.fake_instance_obj(self.ctx, node=node.uuid)
     patch = patcher.create(node).get_cleanup_patch(instance, None,
                                                    self.flavor)
     expected = [{
         'path': '/driver_info/pxe_deploy_kernel',
         'op': 'remove'
     }, {
         'path': '/driver_info/pxe_deploy_ramdisk',
         'op': 'remove'
     }]
     self.assertEqual(sorted(expected), sorted(patch))
Ejemplo n.º 22
0
    def _cleanup_deploy(self, node, instance, network_info):
        icli = client_wrapper.IronicClientWrapper()
        patch = patcher.create(node).get_cleanup_patch(
                instance, network_info)

        # Unassociate the node
        patch.append({'op': 'remove', 'path': '/instance_uuid'})
        try:
            icli.call('node.update', node.uuid, patch)
        except ironic_exception.HTTPBadRequest:
            msg = (_("Failed clean up the parameters on node %(node)s "
                     "when unprovisioning the instance %(instance)s")
                   % {'node': node.uuid, 'instance': instance['uuid']})
            LOG.error(msg)
            reason = _("Fail to clean up node %s parameters") % node.uuid
            raise exception.InstanceTerminationFailure(reason=reason)

        self._unplug_vifs(node, instance, network_info)
        self._stop_firewall(instance, network_info)
Ejemplo n.º 23
0
    def _cleanup_deploy(self, node, instance, network_info):
        icli = client_wrapper.IronicClientWrapper()
        patch = patcher.create(node).get_cleanup_patch(instance, network_info)

        # Unassociate the node
        patch.append({'op': 'remove', 'path': '/instance_uuid'})
        try:
            icli.call('node.update', node.uuid, patch)
        except ironic_exception.BadRequest:
            msg = (_("Failed clean up the parameters on node %(node)s "
                     "when unprovisioning the instance %(instance)s") % {
                         'node': node.uuid,
                         'instance': instance['uuid']
                     })
            LOG.error(msg)
            reason = _("Fail to clean up node %s parameters") % node.uuid
            raise exception.InstanceTerminationFailure(reason=reason)

        self._unplug_vifs(node, instance, network_info)
        self._stop_firewall(instance, network_info)
Ejemplo n.º 24
0
    def _cleanup_deploy(self, node, instance, network_info):
        icli = self._get_client()
        patch = patcher.create(node).get_cleanup_patch(
                instance, network_info)

        # Unassociate the node
        patch.append({'op': 'remove', 'path': '/instance_uuid'})
        try:
            self._retry_if_service_is_unavailable(icli.node.update,
                                                  node.uuid, patch)
        except (MaximumRetriesReached, ironic_exception.HTTPBadRequest):
            msg = (_("Failed clean up the parameters on node %(node)s "
                     "when unprovisioning the instance %(instance)s")
                   % {'node': node.uuid, 'instance': instance['uuid']})
            LOG.error(msg)
            reason = _("Fail to clean up node %s parameters") % node.uuid
            raise exception.InstanceTerminationFailure(reason=reason)

        self._unplug_vifs(node, instance, network_info)
        self._stop_firewall(instance, network_info)
Ejemplo n.º 25
0
    def _add_driver_fields(self, node, instance, image_meta, flavor):
        icli = client_wrapper.IronicClientWrapper()
        patch = patcher.create(node).get_deploy_patch(instance, image_meta,
                                                      flavor)

        # Associate the node with an instance
        patch.append({
            'path': '/instance_uuid',
            'op': 'add',
            'value': instance['uuid']
        })
        try:
            icli.call('node.update', node.uuid, patch)
        except ironic_exception.BadRequest:
            msg = (_("Failed to add deploy parameters on node %(node)s "
                     "when provisioning the instance %(instance)s") % {
                         'node': node.uuid,
                         'instance': instance['uuid']
                     })
            LOG.error(msg)
            raise exception.InstanceDeployFailure(msg)
Ejemplo n.º 26
0
    def _cleanup_deploy(self, node, instance, network_info):
        icli = client_wrapper.IronicClientWrapper()
        context = nova_context.get_admin_context()
        flavor = flavor_obj.Flavor.get_by_id(context,
                                             instance['instance_type_id'])
        patch = patcher.create(node).get_cleanup_patch(instance, network_info,
                                                       flavor)

        # Unassociate the node
        patch.append({'op': 'remove', 'path': '/instance_uuid'})
        try:
            icli.call('node.update', node.uuid, patch)
        except ironic.exc.BadRequest:
            LOG.error(_LE("Failed to clean up the parameters on node %(node)s "
                          "when unprovisioning the instance %(instance)s"),
                         {'node': node.uuid, 'instance': instance['uuid']})
            reason = (_("Fail to clean up node %s parameters") % node.uuid)
            raise exception.InstanceTerminationFailure(reason=reason)

        self._unplug_vifs(node, instance, network_info)
        self._stop_firewall(instance, network_info)
Ejemplo n.º 27
0
 def test_pxe_get_cleanup_patch(self):
     driver_info = {
         'pxe_image_source': 'fake-image-id',
         'pxe_deploy_kernel': 'fake-kernel-id',
         'pxe_deploy_ramdisk': 'fake-ramdisk-id',
         'pxe_root_gb': '1024',
         'pxe_swap_mb': '512',
         'pxe_preserve_ephemeral': True,
         'pxe_ephemeral_format': 'fake-format'
     }
     node = ironic_utils.get_test_node(driver='pxe_fake',
                                       driver_info=driver_info)
     instance = fake_instance.fake_instance_obj(self.ctx, node=node.uuid)
     patch = patcher.create(node).get_cleanup_patch(instance, None)
     expected = [{
         'path': '/driver_info/pxe_image_source',
         'op': 'remove'
     }, {
         'path': '/driver_info/pxe_deploy_kernel',
         'op': 'remove'
     }, {
         'path': '/driver_info/pxe_deploy_ramdisk',
         'op': 'remove'
     }, {
         'path': '/driver_info/pxe_root_gb',
         'op': 'remove'
     }, {
         'path': '/driver_info/pxe_swap_mb',
         'op': 'remove'
     }, {
         'path': '/driver_info/pxe_preserve_ephemeral',
         'op': 'remove'
     }, {
         'path': '/driver_info/pxe_ephemeral_format',
         'op': 'remove'
     }]
     self.assertEqual(sorted(expected), sorted(patch))
Ejemplo n.º 28
0
 def test_create_generic(self):
     node = ironic_utils.get_test_node(driver='fake')
     patcher_obj = patcher.create(node)
     self.assertIsInstance(patcher_obj, patcher.GenericDriverFields)
Ejemplo n.º 29
0
 def test_generic_get_deploy_patch(self):
     node = ironic_utils.get_test_node(driver='fake')
     patch = patcher.create(node).get_deploy_patch(
             self.instance, self.image_meta, self.flavor)
     self.assertEqual(sorted(self._expected_deploy_patch), sorted(patch))
Ejemplo n.º 30
0
 def test_generic_get_cleanup_patch(self):
     node = ironic_utils.get_test_node(driver='fake')
     patch = patcher.create(node).get_cleanup_patch(self.instance, None,
                                                    self.flavor)
     self.assertEqual(self._expected_cleanup_patch, patch)
Ejemplo n.º 31
0
 def test_create_pxe(self):
     node = ironic_utils.get_test_node(driver='pxe_fake')
     patcher_obj = patcher.create(node)
     self.assertIsInstance(patcher_obj, patcher.PXEDriverFields)
Ejemplo n.º 32
0
    def _add_driver_fields(self,
                           node,
                           instance,
                           image_meta,
                           flavor,
                           admin_pass=None,
                           files=None,
                           network_info=None,
                           preserve_ephemeral=None):
        icli = client_wrapper.IronicClientWrapper()
        patch = patcher.create(node).get_deploy_patch(instance, image_meta,
                                                      flavor,
                                                      preserve_ephemeral)

        # Associate the node with an instance
        patch.append({
            'path': '/instance_uuid',
            'op': 'add',
            'value': instance['uuid']
        })

        if configdrive.required_by(instance):
            LOG.info(_('Using config drive'), instance=instance)
            extra_md = {}
            if admin_pass:
                extra_md['admin_pass'] = admin_pass

            inst_md = instance_metadata.InstanceMetadata(
                instance,
                content=files,
                extra_md=extra_md,
                network_info=network_info)

            fd, configdrive_path = tempfile.mkstemp()
            os.close(fd)

            with configdrive.ConfigDriveBuilder(instance_md=inst_md) as cdb:
                try:
                    cdb.make_drive(configdrive_path)
                except processutils.ProcessExecutionError as e:
                    with excutils.save_and_reraise_exception():
                        LOG.error(_('Creating config drive failed '
                                    'with error: %s'),
                                  e,
                                  instance=instance)
            # gzip the configdrive.
            with open(configdrive_path, "rb") as configdrive_fh:
                configdrive_payload = base64.b64encode(
                    zlib.compress(configdrive_fh.read()))
            os.remove(configdrive_path)
            patch.append({
                'path': '/instance_info/config_drive',
                'op': 'add',
                'value': configdrive_payload
            })

        try:
            icli.call('node.update', node.uuid, patch)
        except ironic_exception.BadRequest:
            msg = (_("Failed to add deploy parameters on node %(node)s "
                     "when provisioning the instance %(instance)s") % {
                         'node': node.uuid,
                         'instance': instance['uuid']
                     })
            LOG.error(msg)
            raise exception.InstanceDeployFailure(msg)