Example #1
0
def get_disabled_quotas(request):
    # We no longer supports nova network, so we always disable
    # network related nova quota fields.
    disabled_quotas = set()

    # Cinder
    if not cinder.is_volume_service_enabled(request):
        disabled_quotas.update(CINDER_QUOTA_FIELDS)

    # Neutron
    if not base.is_service_enabled(request, 'network'):
        disabled_quotas.update(NEUTRON_QUOTA_FIELDS)
    else:
        if not neutron.is_extension_supported(request, 'security-group'):
            disabled_quotas.update(['security_group', 'security_group_rule'])

        if not neutron.is_router_enabled(request):
            disabled_quotas.update(['router', 'floatingip'])

        try:
            if not neutron.is_quotas_extension_supported(request):
                disabled_quotas.update(NEUTRON_QUOTA_FIELDS)
        except Exception:
            LOG.exception("There was an error checking if the Neutron "
                          "quotas extension is enabled.")

    # Nova
    if not (base.is_service_enabled(request, 'compute')
            and nova.can_set_quotas()):
        disabled_quotas.update(NOVA_QUOTA_FIELDS)

    # There appear to be no glance quota fields currently
    return disabled_quotas
Example #2
0
def get_disabled_quotas(request):
    disabled_quotas = []

    # Cinder
    if not base.is_service_enabled(request, 'volume'):
        disabled_quotas.extend(CINDER_QUOTA_FIELDS)

    # Neutron
    if not base.is_service_enabled(request, 'network'):
        disabled_quotas.extend(NEUTRON_QUOTA_FIELDS)
    else:
        # Remove the nova network quotas
        disabled_quotas.extend(['floating_ips', 'fixed_ips'])

        if neutron.is_extension_supported(request, 'security-group'):
            # If Neutron security group is supported, disable Nova quotas
            disabled_quotas.extend(['security_groups', 'security_group_rules'])
        else:
            # If Nova security group is used, disable Neutron quotas
            disabled_quotas.extend(['security_group', 'security_group_rule'])

        try:
            if not neutron.is_quotas_extension_supported(request):
                disabled_quotas.extend(NEUTRON_QUOTA_FIELDS)
        except Exception:
            LOG.exception("There was an error checking if the Neutron "
                          "quotas extension is enabled.")

    return disabled_quotas
Example #3
0
def get_disabled_quotas(request):
    # We no longer supports nova network, so we always disable
    # network related nova quota fields.
    disabled_quotas = set()

    # Cinder
    if not cinder.is_volume_service_enabled(request):
        disabled_quotas.update(CINDER_QUOTA_FIELDS)

    # Neutron
    if not base.is_service_enabled(request, 'network'):
        disabled_quotas.update(NEUTRON_QUOTA_FIELDS)
    else:
        if not neutron.is_extension_supported(request, 'security-group'):
            disabled_quotas.update(['security_group', 'security_group_rule'])

        if not neutron.is_router_enabled(request):
            disabled_quotas.update(['router', 'floatingip'])

        try:
            if not neutron.is_quotas_extension_supported(request):
                disabled_quotas.update(NEUTRON_QUOTA_FIELDS)
        except Exception:
            LOG.exception("There was an error checking if the Neutron "
                          "quotas extension is enabled.")

    # Nova
    if not (base.is_service_enabled(request, 'compute') and
            nova.can_set_quotas()):
        disabled_quotas.update(NOVA_QUOTA_FIELDS)

    # There appear to be no glance quota fields currently
    return disabled_quotas
Example #4
0
def get_disabled_quotas(request, targets=None):
    if targets:
        if set(targets) - QUOTA_FIELDS:
            raise ValueError('Unknown quota field names are included: %s' %
                             set(targets) - QUOTA_FIELDS)
        candidates = set(targets)
    else:
        candidates = QUOTA_FIELDS

    # We no longer supports nova network, so we always disable
    # network related nova quota fields.
    disabled_quotas = set()

    # Cinder
    if candidates & CINDER_QUOTA_FIELDS:
        if not cinder.is_volume_service_enabled(request):
            disabled_quotas.update(CINDER_QUOTA_FIELDS)

    # Neutron
    if not (candidates & NEUTRON_QUOTA_FIELDS):
        pass
    elif not base.is_service_enabled(request, 'network'):
        disabled_quotas.update(NEUTRON_QUOTA_FIELDS)
    else:
        if ({'security_group', 'security_group_rule'} & candidates and
                not neutron.is_extension_supported(request, 'security-group')):
            disabled_quotas.update(['security_group', 'security_group_rule'])

        if ({'router', 'floatingip'} & candidates
                and not neutron.is_router_enabled(request)):
            disabled_quotas.update(['router', 'floatingip'])

        try:
            if not neutron.is_quotas_extension_supported(request):
                disabled_quotas.update(NEUTRON_QUOTA_FIELDS)
        except Exception:
            LOG.exception("There was an error checking if the Neutron "
                          "quotas extension is enabled.")

    # Nova
    if candidates & NOVA_QUOTA_FIELDS:
        if not (base.is_service_enabled(request, 'compute')
                and nova.can_set_quotas()):
            disabled_quotas.update(NOVA_QUOTA_FIELDS)

    enabled_quotas = candidates - disabled_quotas
    disabled_quotas = set(QUOTA_FIELDS) - enabled_quotas

    # There appear to be no glance quota fields currently
    return disabled_quotas
Example #5
0
def get_disabled_quotas(request):
    disabled_quotas = set([])

    # Cinder
    if not cinder.is_volume_service_enabled(request):
        disabled_quotas.update(CINDER_QUOTA_FIELDS)

    # Neutron
    if not base.is_service_enabled(request, 'network'):
        disabled_quotas.update(NEUTRON_QUOTA_FIELDS)
    else:
        # Remove the nova network quotas
        disabled_quotas.update(['floating_ips', 'fixed_ips'])

        if neutron.is_extension_supported(request, 'security-group'):
            # If Neutron security group is supported, disable Nova quotas
            disabled_quotas.update(['security_groups', 'security_group_rules'])
        else:
            # If Nova security group is used, disable Neutron quotas
            disabled_quotas.update(['security_group', 'security_group_rule'])

        if not neutron.is_router_enabled(request):
            disabled_quotas.update(['router', 'floatingip'])

        try:
            if not neutron.is_quotas_extension_supported(request):
                disabled_quotas.update(NEUTRON_QUOTA_FIELDS)
        except Exception:
            LOG.exception("There was an error checking if the Neutron "
                          "quotas extension is enabled.")

    # Nova
    if not (base.is_service_enabled(request, 'compute') and
            nova.can_set_quotas()):
        disabled_quotas.update(NOVA_QUOTA_FIELDS)
        # The 'missing' quota fields are all nova (this is hardcoded in
        # dashboards.admin.defaults.workflows)
        disabled_quotas.update(MISSING_QUOTA_FIELDS)

    # There appear to be no glance quota fields currently
    return disabled_quotas
Example #6
0
def get_disabled_quotas(request):
    disabled_quotas = []

    # Cinder
    if not base.is_service_enabled(request, "volume"):
        disabled_quotas.extend(CINDER_QUOTA_FIELDS)

    # Neutron
    if not base.is_service_enabled(request, "network"):
        disabled_quotas.extend(NEUTRON_QUOTA_FIELDS)
    else:
        # Remove the nova network quotas
        disabled_quotas.extend(["floating_ips", "fixed_ips"])

        try:
            if not neutron.is_quotas_extension_supported(request):
                disabled_quotas.extend(NEUTRON_QUOTA_FIELDS)
        except Exception:
            LOG.exception("There was an error checking if the Neutron " "quotas extension is enabled.")

    return disabled_quotas