예제 #1
0
    def summary(self, req, body=None):
        LOG.info('CEPH_LOG placement_group-summary body %s ' % body)
        context = req.environ['vsm.context']
        sum = db.summary_get_by_cluster_id_and_type(context, 1, 'pg')

        vb = summary_view.ViewBuilder()
        return vb.basic(sum, 'placement_group')
예제 #2
0
 def summary(self, req, cluster_id=None):
     LOG.info('mon-summary.')
     context = req.environ['vsm.context']
     if cluster_id:
         sum = db.summary_get_by_cluster_id_and_type(context, cluster_id, 'mon')
     else:
         sum = db.summary_get_by_type_first(context, 'mon')
     #sum = db.summary_get_by_cluster_id_and_type(context, 1, 'mon')
     return sum_views.ViewBuilder().basic(sum, 'monitor')
예제 #3
0
    def summary(self, req):
        LOG.info('mon-summary.')
        context = req.environ['vsm.context']

        #TODO: as we have only one cluster for now, the cluster_id
        #has been hardcoded. In furture, client should pass
        # the cluster id by url.
        sum = db.summary_get_by_cluster_id_and_type(context, 1, 'mon')
        return sum_views.ViewBuilder().basic(sum, 'monitor')
예제 #4
0
 def summary(self, req):
     #LOG.info('osd-summary body %s ' % body)
     context = req.environ['vsm.context']
     #TODO: as we have only one cluster for now, the cluster_id
     #has been hardcoded. In furture, client should pass
     # the cluster id by url.
     sum = db.summary_get_by_cluster_id_and_type(context, 1, 'cluster')
     vb = summary_view.ViewBuilder()
     return vb.basic(sum, 'cluster')
예제 #5
0
 def summary(self, req, body=None,cluster_id=None):
     LOG.info('CEPH_LOG mds-summary body %s ' % body)
     context = req.environ['vsm.context']
     if cluster_id:
         mds = db.summary_get_by_cluster_id_and_type(context, cluster_id, 'mds')
     else:
         mds = db.summary_get_by_type_first(context, 'mds')
     vb = summary_view.ViewBuilder()
     return vb.basic(mds, 'mds')
예제 #6
0
파일: vsms.py 프로젝트: hl10502/vsm
    def summary(self, req, cluster_id=None):
        LOG.info('vsm-summary.')
        context = req.environ['vsm.context']

        #TODO: as we have only one cluster for now, the cluster_id
        #has been hardcoded. In furture, client should pass
        # the cluster id by url.
        try:
            if cluster_id:
                vsm_sum = db.summary_get_by_cluster_id_and_type(
                    context, cluster_id, 'vsm')
            else:
                vsm_sum = db.summary_get_by_type_first(context, 'vsm')
            #vsm_sum = db.summary_get_by_cluster_id_and_type(context, 1, 'vsm')
        except exception.SummaryNotFound:
            vsm_sum = None
        try:
            if cluster_id:
                ceph_sum = db.summary_get_by_cluster_id_and_type(
                    context, cluster_id, 'ceph')
            else:
                ceph_sum = db.summary_get_by_type_first(context, 'ceph')
            #ceph_sum = db.summary_get_by_cluster_id_and_type(context, 1, 'ceph')
        except exception.SummaryNotFound:
            ceph_sum = None

        get_data = lambda x: x['summary_data'] if x else None

        sum = None
        vsm_data = get_data(vsm_sum)
        ceph_data = get_data(ceph_sum)

        if vsm_data:
            sum = json.loads(vsm_data)
            if ceph_data:
                sum.update(json.loads(ceph_data))
            else:
                sum['is_ceph_active'] = True
        elif ceph_data:
            sum = json.loads(ceph_data)
            if not vsm_data:
                sum['uptime'] = None

        if sum:
            try:
                sum['created_at'] = vsm_sum['created_at'].strftime(
                    "%Y-%m-%d %H:%M:%S")
                sum_data = {'summary_data': json.dumps(sum)}
            except:
                pass
        else:
            sum_data = None

        LOG.info('vsm sum: %s' % sum_data)
        return sum_views.ViewBuilder().basic(sum_data, 'vsm')
예제 #7
0
    def summary(self, req, cluster_id = None):
        #LOG.info('osd-summary body %s ' % body)
        context = req.environ['vsm.context']
        if cluster_id:
            sum = db.summary_get_by_cluster_id_and_type(context, cluster_id, 'osd')
        else:
            sum = db.summary_get_by_type_first(context, 'osd')
        #sum = db.summary_get_by_cluster_id_and_type(context, 1, 'osd')

        vb = summary_view.ViewBuilder()
        return vb.basic(sum, 'osd')