Exemplo n.º 1
0
def computeStats(node_name, dic, zone, i, client, r_outs=None, opt=None):
    

    
    startTime = time.time()

    print "Getting data from zone %s" % node_name
    
    #node_info = returnNodes(client, zone, i)
    node_info = hypervisor_count(client, i)
    nodes_count = len(node_info)
    #nodes_rc = stats_count(get_Resources(node_info,
                                          #client))
    nodes_rc = stats_count(hypervisor_usage(node_info))
    type_ = totalVMType(dic, returnServers(client, node_info))
    if 'others' in list(type_.elements()):
        others = type_['others']
    else:
        others = 0

    print "%s done , took %0.2f secs" % (node_name, (time.time() - startTime))

    stats_q = {'node_name': node_name, 'node_count': nodes_count,
                'nac': nodes_rc.get('nac'), 'nam': nodes_rc.get('nam'),
                'nuc': nodes_rc.get('nuc'), 'num': nodes_rc.get('num'),
                'nfc': nodes_rc.get('nfc'), 'nfm': nodes_rc.get('nfm'),
                't_s': type_['m1.small'], 't_m': type_['m1.medium'],
                't_l': type_['m1.large'], 't_xl': type_['m1.xlarge'],
                't_xxl': type_['m1.xxlarge'], 'oth': others
                }

    if opt == True:
        r_outs.put(stats_q)
    else:
        return stats_q
Exemplo n.º 2
0
def flavor_stats(node_name, _az2, dic, client):
    type_ = totalVMType(dic, returnServers(client, _az2))
    if 'others' in list(type_.elements()):
        others = type_['others']
    else:
        others = 0

    stats = {'node_name': node_name,
             'total_s': type_['m1.small'],
             'total_m': type_['m1.medium'],
             'total_l': type_['m1.large'],
             'total_xl': type_['m1.xlarge'],
             'total_xxl': type_['m1.xxlarge'],
             'oth': others}
    return stats
Exemplo n.º 3
0
def computeStats(node_name, dic, zone, i, client, r_outs=None, opt=None):

    startTime = time.time()

    print "Getting data from zone %s" % node_name

    #node_info = returnNodes(client, zone, i)
    node_info = hypervisor_count(client, i)
    nodes_count = len(node_info)
    #nodes_rc = stats_count(get_Resources(node_info,
    #client))
    nodes_rc = stats_count(hypervisor_usage(node_info))
    type_ = totalVMType(dic, returnServers(client, node_info))
    if 'others' in list(type_.elements()):
        others = type_['others']
    else:
        others = 0

    print "%s done , took %0.2f secs" % (node_name, (time.time() - startTime))

    stats_q = {
        'node_name': node_name,
        'node_count': nodes_count,
        'nac': nodes_rc.get('nac'),
        'nam': nodes_rc.get('nam'),
        'nuc': nodes_rc.get('nuc'),
        'num': nodes_rc.get('num'),
        'nfc': nodes_rc.get('nfc'),
        'nfm': nodes_rc.get('nfm'),
        't_s': type_['m1.small'],
        't_m': type_['m1.medium'],
        't_l': type_['m1.large'],
        't_xl': type_['m1.xlarge'],
        't_xxl': type_['m1.xxlarge'],
        'oth': others
    }

    if opt == True:
        r_outs.put(stats_q)
    else:
        return stats_q