'Retry any pending instance file deletes.'

@periodic_task.periodic_task(spacing=CONF.instance_delete_interval)
def _run_pending_deletes(self, context):

    LOG.debug('Cleaning    up    deleted    instances')
    filters = {'deleted': True, 'soft_deleted': False, 'host': CONF.host, 'cleaned': False}
    attrs = ['system_metadata']
    with utils.temporary_mutation(context, read_deleted='yes'):
        instances = objects.InstanceList.get_by_filters(context, filters, expected_attrs=attrs, use_slave=True)
    LOG.debug('There    are    %d    instances    to    clean', len(instances))
    if (CONF.maximum_instance_delete_attempts < 1):
        LOG.warning('Future    versions    of    Nova    will    restrict    the    "maximum_instance_delete_attempts"    config    option    to    values    >=1.    Update    your    configuration    file    to    mitigate    future    upgrade    issues.')
    for instance in instances:
        attempts = int(instance.system_metadata.get('clean_attempts', '0'))
        LOG.debug('Instance    has    had    %(attempts)s    of    %(max)s    cleanup    attempts', {'attempts': attempts, 'max': CONF.maximum_instance_delete_attempts}, instance=instance)
        if (attempts < CONF.maximum_instance_delete_attempts):
            success = self.driver.delete_instance_files(instance)
            instance.system_metadata['clean_attempts'] = str((attempts + 1))
            if success:
                instance.cleaned = True
            with utils.temporary_mutation(context, read_deleted='yes'):
                instance.save()
