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
This commit is contained in:
joey5678 2014-12-05 11:50:43 +08:00
parent 5e552bc270
commit 893a4b6379
2 changed files with 3 additions and 3 deletions

View File

@ -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

View File

@ -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: