'Roll back a bad detach after the volume been disconnected.'

@wsgi.action('os-force_detach')
def _force_detach(self, req, id, body):

    context = req.environ['cinder.context']
    self.authorize(context, 'force_detach')
    volume = self._get(context, id)
    try:
        connector = body['os-force_detach'].get('connector', None)
    except AttributeError:
        msg = (_("Invalid    value    '%s'    for    os-force_detach.") % body['os-force_detach'])
        raise webob.exc.HTTPBadRequest(explanation=msg)
    try:
        self.volume_api.terminate_connection(context, volume, connector)
    except exception.VolumeBackendAPIException as error:
        msg = _('Unable    to    terminate    volume    connection    from    backend.')
        raise webob.exc.HTTPInternalServerError(explanation=msg)
    attachment_id = body['os-force_detach'].get('attachment_id', None)
    try:
        self.volume_api.detach(context, volume, attachment_id)
    except messaging.RemoteError as error:
        if (error.exc_type in ['VolumeAttachmentNotFound', 'InvalidVolume']):
            msg = ('Error    force    detaching    volume    -    %(err_type)s:    %(err_msg)s' % {'err_type': error.exc_type, 'err_msg': error.value})
            raise webob.exc.HTTPBadRequest(explanation=msg)
        else:
            raise
    return webob.Response(status_int=http_client.ACCEPTED)
