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_security_group_extension_supported(request): # 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
def __init__(self, request): neutron_enabled = base.is_service_enabled(request, 'network') if neutron_enabled: self.floating_ips = neutron.FloatingIpManager(request) else: self.floating_ips = nova.FloatingIpManager(request) if (neutron_enabled and neutron.is_security_group_extension_supported(request)): self.secgroups = neutron.SecurityGroupManager(request) else: self.secgroups = nova.SecurityGroupManager(request)
def get_default_quota_data(request, disabled_quotas=None, tenant_id=None): qs = _get_quota_data(request, "default_quota_get", disabled_quotas=disabled_quotas, tenant_id=tenant_id) # Remove quotas information for resources provided by Neutron. # TODO(amotoki): There is no API to get the default system quotas # in Neutron (cf. LP#1204956), so we need to remove such quotas # information from quotas set. # This should be handled in _get_quota_data() eventually. if base.is_service_enabled(request, 'network'): if neutron.is_security_group_extension_supported(request): sg_fields = ['security_groups', 'security_group_rules'] qs = [quota for quota in qs if quota.name not in sg_fields] return qs