Ejemplo n.º 1
0
def _sync_floating_ips(context, project_id, session):
    if FLAGS.use_private_floating_ip:
        return dict(floating_ips=db.floating_ip_count_by_project_type(
            context, project_id, False, FLAGS.private_floating_pools,
            session=session))
    return dict(floating_ips=db.floating_ip_count_by_project(
            context, project_id, session=session))
Ejemplo n.º 2
0
Archivo: quota.py Proyecto: kurlez/nova
def allowed_floating_ips(context, requested_floating_ips):
    """Check quota and return min(requested, allowed) floating ips."""
    project_id = context.project_id
    context = context.elevated()
    used_floating_ips = db.floating_ip_count_by_project(context, project_id)
    quota = get_project_quotas(context, project_id)
    allowed_floating_ips = _get_request_allotment(requested_floating_ips, used_floating_ips, quota["floating_ips"])
    return min(requested_floating_ips, allowed_floating_ips)
Ejemplo n.º 3
0
def allowed_floating_ips(context, num_floating_ips):
    """Check quota and return min(num_floating_ips, allowed_floating_ips)."""
    project_id = context.project_id
    context = context.elevated()
    used_floating_ips = db.floating_ip_count_by_project(context, project_id)
    quota = get_quota(context, project_id)
    allowed_floating_ips = quota['floating_ips'] - used_floating_ips
    return min(num_floating_ips, allowed_floating_ips)
Ejemplo n.º 4
0
def _sync_floating_ips(context, project_id, session):
    return dict(floating_ips=db.floating_ip_count_by_project(
            context, project_id, session=session))