'This method is called from destroy() to unprovision
already provisioned node after required checks.'

def _unprovision(self, instance, node):

    try:
        self.ironicclient.call('node.set_provision_state', node.uuid, 'deleted')
    except Exception as e:
        if (getattr(e, '__name__', None) != 'InstanceDeployFailure'):
            raise
    data = {'tries': 0}
    def _wait_for_provision_state():
        try:
            node = self._validate_instance_and_node(instance)
        except exception.InstanceNotFound:
            LOG.debug('Instance    already    removed    from    Ironic', instance=instance)
            raise loopingcall.LoopingCallDone()
        if (node.provision_state in (ironic_states.NOSTATE, ironic_states.CLEANING, ironic_states.CLEANWAIT, ironic_states.CLEANFAIL, ironic_states.AVAILABLE)):
            LOG.debug('Ironic    node    %(node)s    is    in    state    %(state)s,    instance    is    now    unprovisioned.', dict(node=node.uuid, state=node.provision_state), instance=instance)
            raise loopingcall.LoopingCallDone()
        if (data['tries'] >= (CONF.ironic.api_max_retries + 1)):
            msg = (_("Error    destroying    the    instance    on    node    %(node)s.    Provision    state    still    '%(state)s'.") % {'state': node.provision_state, 'node': node.uuid})
            LOG.error(msg)
            raise exception.NovaException(msg)
        else:
            data['tries'] += 1
        _log_ironic_polling('unprovision', node, instance)
    timer = loopingcall.FixedIntervalLoopingCall(_wait_for_provision_state)
    timer.start(interval=CONF.ironic.api_retry_interval).wait()
