def _delete_image(self, context, image_id, image_service):
    'Deletes an image stuck in queued or saving state.'
    try:
        image_meta = image_service.show(context, image_id)
        image_status = image_meta.get('status')
        if ((image_status == 'queued') or (image_status == 'saving')):
            LOG.warning(_LW('Deleting image in unexpected status: %(image_status)s.'), {'image_status': image_status}, resource={'type': 'image', 'id': image_id})
            image_service.delete(context, image_id)
    except Exception:
        LOG.warning(_LW('Image delete encountered an error.'), exc_info=True, resource={'type': 'image', 'id': image_id})
Deletes an image stuck in queued or saving state.
def _delete_image(self, context, image_id, image_service):
    
    try:
        image_meta = image_service.show(context, image_id)
        image_status = image_meta.get('status')
        if ((image_status == 'queued') or (image_status == 'saving')):
            LOG.warning(_LW('Deleting image in unexpected status: %(image_status)s.'), {'image_status': image_status}, resource={'type': 'image', 'id': image_id})
            image_service.delete(context, image_id)
    except Exception:
        LOG.warning(_LW('Image delete encountered an error.'), exc_info=True, resource={'type': 'image', 'id': image_id})