Exemple #1
0
 def _get_provider_name(self, context, pool):
     if ('provider' in pool
             and pool['provider'] != attrs.ATTR_NOT_SPECIFIED):
         provider_name = pconf.normalize_provider_name(pool['provider'])
         self.validate_provider(provider_name)
         return provider_name
     else:
         if not self.default_provider:
             raise pconf.DefaultServiceProviderNotFound(
                 service_type=constants.LOADBALANCER)
         return self.default_provider
 def get_default_service_provider(self, context, service_type):
     """Return the default provider for a given service type."""
     filters = {'service_type': [service_type],
                'default': [True]}
     providers = self.get_service_providers(context, filters=filters)
     # By construction we expect at most a single item in provider
     if not providers:
         raise pconf.DefaultServiceProviderNotFound(
             service_type=service_type
         )
     return providers[0]
Exemple #3
0
 def _get_provider_name(self, entity):
     if ('provider' in entity and
             entity['provider'] != attrs.ATTR_NOT_SPECIFIED):
         provider_name = pconf.normalize_provider_name(entity['provider'])
         del entity['provider']
         self.validate_provider(provider_name)
         return provider_name
     else:
         if not self.default_provider:
             raise pconf.DefaultServiceProviderNotFound(
                 service_type=constants.LOADBALANCER)
         del entity['provider']
         return self.default_provider