'Terminate volume attachment.'

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

    context = req.environ['cinder.context']
    volume = self.volume_api.get(context, id)
    try:
        connector = body['os-terminate_connection']['connector']
    except KeyError:
        raise webob.exc.HTTPBadRequest(explanation=_("Must    specify    'connector'"))
    try:
        self.volume_api.terminate_connection(context, volume, connector)
    except exception.VolumeBackendAPIException:
        msg = _('Unable    to    terminate    volume    connection    from    backend.')
        raise webob.exc.HTTPInternalServerError(explanation=msg)
    return webob.Response(status_int=http_client.ACCEPTED)
