def get_MDS():
    mds_summary = vsmapi.mds_summary(None)
    ecpoch = mds_summary.epoch
    Up = mds_summary.num_up_mdses
    In = mds_summary.num_in_mdses
    Failed = mds_summary.num_failed_mdses
    Stopped = mds_summary.num_stopped_mdses
    PoolData = mds_summary.data_pools
    MetaData = mds_summary.metadata_pool

    mds_status = vsmapi.mds_status(None)
    update = ""
    for mds in mds_status:
        update = get_time_delta(mds.updated_at)

    MDS_dict = {"epoch":ecpoch
              ,"update":update
              ,"Up":Up
              ,"In":In
              ,"Failed":Failed
              ,"Stopped":Stopped
              ,"PoolData":PoolData
              ,"MetaData":MetaData}
    MDSdata = json.dumps(MDS_dict)
    return MDSdata
示例#2
0
    def get_data(self):
        _servers = []
        #_servers= vsmapi.get_server_list(self.request,)
        try:
            _mds_summary = vsmapi.mds_summary(self.request)
            _mds_status = vsmapi.mds_status(self.request)
        except:
            exceptions.handle(self.request,
                              _('Unable to retrieve sever list. '))

        mds_status = []
        for _mds in _mds_status:
            mds = {"gid": _mds.gid,
                   "id": _mds.id,
                        "name": _mds.name,
                        "state": _mds.state,
                        "address": _mds.address,
                        "updated_at": get_time_delta(_mds.updated_at),
                        }
            mds_status.append(mds)
        return mds_status