Ejemplo n.º 1
0
def get_active_allocations():
    auth_session = get_auth_session()
    aclient = allocation_client.Client('1', session=auth_session)

    active_allocations = {}

    # All approved allocations
    allocations = aclient.allocations.list(parent_request__isnull=True)

    for allocation in allocations:
        if (allocation.status == states.DELETED
                or allocation.status == states.SUBMITTED):
            continue
        elif allocation.status != states.APPROVED:
            try:
                allocation = aclient.allocations.get_last_approved(
                    parent_request=allocation.id)
            except exceptions.AllocationDoesNotExist:
                continue

        if not allocation.project_id:
            continue

        active_allocations[allocation.project_id] = allocation

    return active_allocations
Ejemplo n.º 2
0
def get_active_allocations():
    auth_session = get_auth_session()
    aclient = allocation_client.Client('1', session=auth_session)

    active_allocations = {}

    # All approved allocations
    allocations = aclient.allocations.list(parent_request__isnull=True)

    for allocation in allocations:
        if (allocation.status == states.DELETED
                or allocation.status == states.SUBMITTED):
            continue
        elif allocation.status != states.APPROVED:
            try:
                allocation = aclient.allocations.get_last_approved(
                    parent_request=allocation.id)
            except exceptions.AllocationDoesNotExist:
                continue

        if not allocation.project_id:
            continue

        active_allocations[allocation.project_id] = allocation.allocation_home

    return active_allocations
Ejemplo n.º 3
0
def report_metrics(sender, from_time, to_time):
    session = keystone.get_auth_session()
    client = manuka_client.Client('1', session=session)
    while from_time < to_time:
        now = int(from_time.strftime("%s"))
        users = list(list_users(client, from_time))
        count(sender, users, now)
        by_idp(sender, users, now)
        from_time = from_time + timedelta(hours=1)
    sender.flush()
Ejemplo n.º 4
0
def client():
    auth_session = get_auth_session()
    return nova_client.Client(NOVA_VERSION, session=auth_session)
Ejemplo n.º 5
0
def get_client():
    auth = keystone.get_auth_session()
    return client.Client(GNOCCHI_API_VERSION, auth)
Ejemplo n.º 6
0
def client():
    auth_session = get_auth_session()
    return nova_client.Client(NOVA_VERSION,
                              session=auth_session)
Ejemplo n.º 7
0
def client():
    auth_session = keystone.get_auth_session()
    return cinder_client.Client('2', session=auth_session)
Ejemplo n.º 8
0
 def _get_client():
     auth = keystone.get_auth_session()
     return client.Client(GNOCCHI_API_VERSION, auth)
Ejemplo n.º 9
0
def client():
    auth_session = keystone.get_auth_session()
    return cinder_client.Client('3', session=auth_session)