'Enable/Disable scheduling for a cluster.'

@wsgi.Controller.api_version(CLUSTER_MICRO_VERSION)
def update(self, req, id, body):

    context = self.policy_checker(req, 'update')
    if (id not in ('enable', 'disable')):
        raise exception.NotFound(message=_('Unknown    action'))
    disabled = (id != 'enable')
    disabled_reason = (self._get_disabled_reason(body) if disabled else None)
    if ((not disabled) and disabled_reason):
        msg = _("Unexpected    'disabled_reason'    found    on    enable    request.")
        raise exception.InvalidInput(reason=msg)
    name = body.get('name')
    if (not name):
        raise exception.MissingRequired(element='name')
    binary = body.get('binary', 'cinder-volume')
    cluster = objects.Cluster.get_by_id(context, None, binary=binary, name=name)
    cluster.disabled = disabled
    cluster.disabled_reason = disabled_reason
    cluster.save()
    replication_data = req.api_version_request.matches(REPLICATION_DATA_MICRO_VERSION)
    ret_val = clusters_view.ViewBuilder.summary(cluster, replication_data)
    ret_val['cluster']['disabled_reason'] = disabled_reason
    return ret_val
