'Reset status on the resource.'

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

    def _clean_volume_attachment(context, id):
        attachments = db.volume_attachment_get_all_by_volume_id(context, id)
        for attachment in attachments:
            db.volume_detached(context, id, attachment.id)
        db.volume_admin_metadata_delete(context, id, 'attached_mode')
    context = req.environ['cinder.context']
    self.authorize(context, 'reset_status')
    update = self.validate_update(body['os-reset_status'])
    msg = "Updating    %(resource)s    '%(id)s'    with    '%(update)r'"
    LOG.debug(msg, {'resource': self.resource_name, 'id': id, 'update': update})
    notifier_info = dict(id=id, update=update)
    notifier = rpc.get_notifier('volumeStatusUpdate')
    notifier.info(context, (self.collection + '.reset_status.start'), notifier_info)
    self._update(context, id, update)
    self._remove_worker(context, id)
    if (update.get('attach_status') == 'detached'):
        _clean_volume_attachment(context, id)
    notifier.info(context, (self.collection + '.reset_status.end'), notifier_info)
    return webob.Response(status_int=http_client.ACCEPTED)
