'Update an existing dataset in the cluster configuration.
:param unicode dataset_id: The unique identifier of the dataset.  This
is a string giving a UUID (per RFC 4122).
:param primary: The UUID of the node to which the dataset will be
moved, or ``None`` indicating no change.
:return: A ``dict`` describing the dataset which has been added to the
cluster configuration or giving error information if this is not
possible.'

@app.route('/configuration/datasets/<dataset_id>', methods=['POST'])
@user_documentation(u"\n                                This    can    be    used    to:\n\n                                *    Move    a    dataset    from    one    node    to    another    by    changing    the\n                                        ``primary``    attribute.\n                                *    In    the    future    this    may    be    used    to    update    metadata,    but    that    is    not\n                                        currently    supported.\n\n                                Supports    ``X-If-Configuration-Matches``    header    in    the    request    to\n                                ensure    the    update    only    happens    if    the    configuration    hasn't\n                                changed.\n                                ", header=u'Update    an    existing    dataset', examples=[u'update    dataset    with    primary', u'update    dataset    with    unknown    dataset    id'], section=u'dataset')
@_if_configuration_matches
@structured(inputSchema={'$ref': '/v1/endpoints.json#/definitions/configuration_datasets_update'}, outputSchema={'$ref': '/v1/endpoints.json#/definitions/configuration_datasets'}, schema_store=SCHEMAS)
def update_dataset(self, dataset_id, primary=None):

    deployment = self.persistence_service.get()
    (primary_manifestation, current_node) = _find_manifestation_and_node(deployment, dataset_id)
    if primary_manifestation.dataset.deleted:
        raise DATASET_DELETED
    if (primary is not None):
        deployment = _update_dataset_primary(deployment, dataset_id, UUID(hex=primary))
    saving = self.persistence_service.save(deployment)
    (primary_manifestation, current_node) = _find_manifestation_and_node(deployment, dataset_id)
    def saved(ignored):
        result = api_dataset_from_dataset_and_node(primary_manifestation.dataset, current_node.uuid)
        return EndpointResponse(OK, result)
    saving.addCallback(saved)
    return saving
