def give_away_ring(ring_name, cluster_name, taskid=None): rm = RingManager(cluster_name) try: content = rm.give_away_ring(cluster_name=cluster_name, ring_file=ring_name) message = content except Exception, error: message = str(error) assert False
def give_away_ring(cluster_name, datajson): """ 平衡环 :param datajson: :return: """ status = '' message = '' resp = {"status": status, "message": message} ring_name = datajson.get('ring_name') ring_name = ring_name if ring_name.endswith( '.ring.gz') else ring_name + '.ring.gz' sfo_clu_nodes = SfoClusterNodesMethod.query_host_list_by_cluster_name( cluster_name) if not sfo_clu_nodes: raise ValueError('Not Master Node in %s' % cluster_name) rm = RingManager(cluster_name) try: content = rm.give_away_ring(cluster_name=cluster_name, ring_file=ring_name) except Exception, error: message = str(error) status = 501