def is_ready(self, quota): neutron = clients.get_neutron_client() port_quota = quota['port'] port_func = neutron.list_ports if utils.has_limit(port_quota): return utils.is_available('ports', port_quota, port_func) return True
def _check_quota(self, quota): neutron = clients.get_neutron_client() sg_quota = quota['security_group'] sg_func = neutron.list_security_groups if utils.has_limit(sg_quota): return utils.is_available('security_groups', sg_quota, sg_func) return True
def _check_quota(self, quota): resources = ('subnets', 'networks', 'security_groups') for resource in resources: resource_quota = quota[resource] if utils.has_limit(resource_quota): if not utils.is_available(resource, resource_quota): return False return True
def _check_quota(self, quota): neutron = clients.get_neutron_client() resources = {'subnet': neutron.list_subnets, 'network': neutron.list_networks, 'security_group': neutron.list_security_groups} for resource, neutron_func in resources.items(): resource_quota = quota[resource] resource_name = resource + 's' if utils.has_limit(resource_quota): if not utils.is_available(resource_name, resource_quota, neutron_func): return False return True
def _check_quota(self, quota): os_net = clients.get_network_client() resources = { 'subnets': os_net.subnets, 'networks': os_net.networks, 'security_groups': os_net.security_groups } for resource, network_func in resources.items(): resource_quota = quota[resource] if utils.has_limit(resource_quota): if not utils.is_available(resource, resource_quota, network_func): return False return True
def is_ready(self, quota): os_net = clients.get_network_client() if utils.has_limit(quota.ports): return utils.is_available('ports', quota.ports, os_net.ports) return True
def _check_quota(self, quota): os_net = clients.get_network_client() if utils.has_limit(quota.security_groups): return utils.is_available('security_groups', quota.security_groups, os_net.security_groups) return True
def is_ready(self, quota): if (utils.has_limit(quota.ports) and not utils.is_available('ports', quota.ports)): LOG.error('Marking VIFHandler as not ready.') return False return True
def _check_quota(self, quota): if utils.has_limit(quota.security_groups): return utils.is_available('security_groups', quota.security_groups) return True
def is_ready(self, quota): if utils.has_limit(quota.ports): return utils.is_available('ports', quota.ports) return True