Beispiel #1
0
    def host_devices_by_init_node_id(self, context, init_node_id):
        init_node = db.init_node_get_by_id(context, init_node_id)
        #LOG.info("host_devices:init_node:%s", init_node)
        zone = db.zone_get_by_id(context, init_node['zone_id'])
        devices = db.device_get_all_by_service_id(context,
                                                  init_node['service_id'])
        file_system = init_node.cluster.file_system

        lst = []
        for device in devices:
            d = {}
            d['host'] = init_node['host']
            d['cluster_id'] = init_node['cluster_id']
            d['file_system'] = file_system
            d['primary_public_ip'] = init_node['primary_public_ip']
            d['secondary_public_ip'] = init_node['secondary_public_ip']
            d['cluster_ip'] = init_node['cluster_ip']
            d['data_drives_number'] = init_node['data_drives_number']
            d['dev_name'] = device['name']
            d['dev_journal'] = device['journal']
            d['dev_id'] = device['id']
            d['service_id'] = device['service_id']
            d['storage_class'] = device['device_type']
            d['zone_id'] = init_node['zone_id']
            d['zone'] = zone['name']
            lst.append(d)

        return lst
    def host_devices_by_init_node_id(self,
                                     context,
                                     init_node_id):
        init_node = db.init_node_get_by_id(context, init_node_id)
        #LOG.info("host_devices:init_node:%s", init_node)
        zone = db.zone_get_by_id(context, init_node['zone_id'])
        devices = db.device_get_all_by_service_id(context,
                                                  init_node['service_id'])
        file_system = init_node.cluster.file_system
        #osd_heartbeat_interval=init_node.cluster.osd_heartbeat_interval
        #osd_heartbeat_grace=init_node.cluster.osd_heartbeat_grace

        lst = []
        for device in devices:
            d = {}
            d['host'] = init_node['host']
            d['cluster_id'] = init_node['cluster_id']
            d['file_system'] = file_system
            d['primary_public_ip'] = init_node['primary_public_ip']
            d['secondary_public_ip'] = init_node['secondary_public_ip']
            d['cluster_ip'] = init_node['cluster_ip']
            d['data_drives_number'] = init_node['data_drives_number']
            d['dev_name'] = device['name']
            d['dev_journal'] = device['journal']
            d['dev_id'] = device['id']
            d['service_id'] = device['service_id']
            d['storage_class'] = device['device_type']
            d['zone_id'] = init_node['zone_id']
            d['zone'] = zone['name']
            lst.append(d)

        return lst
Beispiel #3
0
 def ceph_node_info(self, context, init_node_id):
     init_node = db.init_node_get_by_id(context, init_node_id)
     zone = db.zone_get_by_id(context, init_node['zone_id'])
     storage_class_list = db.\
                          device_get_distinct_storage_class_by_service_id(\
                          context, init_node['service_id'])
     #LOG.info('storage_class_list:%s', storage_class_list)
     storage_group_list = db.storage_group_get_all(context)
     #LOG.info('storage_group_list:%s', storage_group_list)
     list = []
     for storage_class in storage_class_list:
         dict = {}
         for storage_group in storage_group_list:
             if storage_class == storage_group['storage_class']:
                 dict['storage_group_id'] = storage_group['id']
                 dict['storage_group_name'] = storage_group['name']
                 break
         list.append(dict)
     #LOG.info('list:%s', list)
     final_list = []
     for item in list:
         osd_state_list = db.\
                          osd_state_get_by_service_id_and_storage_group_id(  \
                          context, init_node['service_id'], \
                          item['storage_group_id'])
         if not osd_state_list:
             continue
         #LOG.info('osd_state_list:%s', osd_state_list)
         for osd_state in osd_state_list:
             final_dict = {}
             final_dict['osd_state_id'] = osd_state['id']
             final_dict['osd_state_name'] = osd_state['osd_name']
             final_dict['storage_group_name'] = item['storage_group_name']
             final_dict['host'] = init_node['host']
             final_dict['zone'] = zone['name']
             final_list.append(final_dict)
     return final_list
 def ceph_node_info(self, context, init_node_id):
     init_node = db.init_node_get_by_id(context, init_node_id)
     zone = db.zone_get_by_id(context, init_node['zone_id'])
     storage_class_list = db.\
                          device_get_distinct_storage_class_by_service_id(\
                          context, init_node['service_id'])
     #LOG.info('storage_class_list:%s', storage_class_list)
     storage_group_list = db.storage_group_get_all(context)
     #LOG.info('storage_group_list:%s', storage_group_list)
     list = []
     for storage_class in storage_class_list:
         dict = {}
         for storage_group in storage_group_list:
             if storage_class == storage_group['storage_class']:
                 dict['storage_group_id'] = storage_group['id']
                 dict['storage_group_name'] = storage_group['name']
                 break
         list.append(dict)
     #LOG.info('list:%s', list)
     final_list = []
     for item in list:
         osd_state_list = db.\
                          osd_state_get_by_service_id_and_storage_group_id(  \
                          context, init_node['service_id'], \
                          item['storage_group_id'])
         if not osd_state_list:
             continue
         #LOG.info('osd_state_list:%s', osd_state_list)
         for osd_state in osd_state_list:
             final_dict = {}
             final_dict['osd_state_id'] = osd_state['id']
             final_dict['osd_state_name'] = osd_state['osd_name']
             final_dict['storage_group_name'] = item['storage_group_name']
             final_dict['host'] = init_node['host']
             final_dict['zone'] = zone['name']
             final_list.append(final_dict)
     return final_list
Beispiel #5
0
 def zone_get_by_id(self, context, id):
     return db.zone_get_by_id(context, id)
 def zone_get_by_id(self, context, id):
     return db.zone_get_by_id(context, id)