'Call master to perform phase 1 of the rebalancing operation.'

def HandleRebalancePhase1(self):

    if (not self.MASTER):
        self._EmptyResponse(constants.RESPONSE_NOT_MASTER_SERVER)
        return
    if self.MASTER.IsRebalancing():
        self._EmptyResponse(constants.RESPONSE_MASTER_IS_REBALANCING)
        return
    new_mapping = rdf_data_server.DataServerMapping.FromSerializedString(self.post_data)
    rebalance_id = str(uuid.uuid4())
    reb = rdf_data_server.DataServerRebalance(id=rebalance_id, mapping=new_mapping)
    if (not self.MASTER.SetRebalancing(reb)):
        logging.warning('Could    not    contact    servers    for    rebalancing')
        self._EmptyResponse(constants.RESPONSE_DATA_SERVERS_UNREACHABLE)
        return
    if (not self.MASTER.FetchRebalanceInformation()):
        logging.warning('Could    not    contact    servers    for    rebalancing    statistics')
        self._EmptyResponse(constants.RESPONSE_DATA_SERVERS_UNREACHABLE)
        return
    self.rebalance_id = rebalance_id
    body = reb.SerializeToString()
    self._Response(constants.RESPONSE_OK, body)
