def get_endpoints(auth_token=None, tenant_id=None, **kwargs): """ find which glance should be sync by strategy config """ strategy = CONF.sync.sync_strategy if strategy not in ['All', 'User', 'nova']: return None openstack_clients = clients(auth_token, tenant_id) ksclient = openstack_clients.keystone() ''' suppose that the cascading glance is 'public' endpoint type, and the cascaded glacne endpoints are 'internal' ''' regions = kwargs.pop('region_names', []) if strategy in ['All', 'nova'] and not regions: urls = ksclient.service_catalog.get_urls(service_type='image', endpoint_type='publicURL') if urls: result = [u for u in urls if u != get_cascading_endpoint_url()] else: result = [] return result else: user_urls = [] for region_name in regions: urls = ksclient.service_catalog.get_urls(service_type='image', endpoint_type='publicURL', region_name=region_name) if urls: user_urls.extend(urls) result = [u for u in set(user_urls) if u != get_cascading_endpoint_url()] return result
def get_endpoints(auth_token=None, tenant_id=None, **kwargs): """ find which glance should be sync by strategy config """ strategy = CONF.sync.sync_strategy if strategy not in ['All', 'User']: return None openstack_clients = clients(auth_token, tenant_id) ksclient = openstack_clients.keystone() ''' suppose that the cascading glance is 'public' endpoint type, and the cascaded glacne endpoints are 'internal' ''' regions = kwargs.pop('region_names', []) if strategy == 'All' and not regions: urls = ksclient.service_catalog.get_urls(service_type='image', endpoint_type='publicURL') if urls: result = [u for u in urls if u != get_cascading_endpoint_url()] else: result = [] return result else: user_urls = [] for region_name in regions: urls = ksclient.service_catalog.get_urls(service_type='image', endpoint_type='publicURL', region_name=region_name) if urls: user_urls.extend(urls) result = [u for u in set(user_urls) if u != get_cascading_endpoint_url()] return result
def __init__(self): global _task_queue self.mete_helper = MetadataHelper() self.location_factory = l_factory() self.store_factory = s_factory() self.task_queue = _task_queue self.task_handler = None self.unhandle_task_list = [] self.periodic_add_id_list = [] self.periodic_add_done = True self._load_glance_store_cfg() self.ks_client = clients().keystone() self.create_new_periodic_task = False
def create_glance_client(auth_token, url): return clients(auth_token).glance(url=url)
def create_glance_client(auth_token, url): """ create glance clients """ return clients(auth_token).glance(url=url)