From 893a4b6379e897e353d38969a4cece440a121dbd Mon Sep 17 00:00:00 2001 From: joey5678 Date: Fri, 5 Dec 2014 11:50:43 +0800 Subject: [PATCH] Modify glance's sync strategy option Add a 'nova' option of sync_strategy in glance-sync.conf, which means sync the image when firsh time the instance is lanuched. Change-Id: I136a9a04a6c21a6637e66468f9f07558b5dabf00 --- glancesync/glance/sync/base.py | 2 +- glancesync/glance/sync/utils.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/glancesync/glance/sync/base.py b/glancesync/glance/sync/base.py index 21d3016..63f5f6d 100644 --- a/glancesync/glance/sync/base.py +++ b/glancesync/glance/sync/base.py @@ -438,7 +438,7 @@ class SyncManagerV2(): @choose_a_location def sync_image_data(self, image_id, auth_token, eps=None, **kwargs): - if CONF.sync.sync_strategy == 'None': + if CONF.sync.sync_strategy in ['None', 'nova']: return kwargs['image_id'] = image_id diff --git a/glancesync/glance/sync/utils.py b/glancesync/glance/sync/utils.py index 1cdf38a..80176d2 100644 --- a/glancesync/glance/sync/utils.py +++ b/glancesync/glance/sync/utils.py @@ -153,7 +153,7 @@ 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']: + if strategy not in ['All', 'User', 'nova']: return None openstack_clients = clients(auth_token, tenant_id) @@ -164,7 +164,7 @@ def get_endpoints(auth_token=None, tenant_id=None, **kwargs): cascaded glacne endpoints are 'internal' ''' regions = kwargs.pop('region_names', []) - if strategy == 'All' and not regions: + if strategy in ['All', 'nova'] and not regions: urls = ksclient.service_catalog.get_urls(service_type='image', endpoint_type='publicURL') if urls: