fix ec2-api-metadata memcached overlap with nova-api

When ec2-api-metadata and nova-api are using the same
memcached server as a cache backend, the cached values
get intermixed due to the fact that the cache keys are
the same. The result is that either nova-api or
ec2-api-metadata will report cache value errors.

This commit fixes this potential problem by using
a different cache key prefix for the ec2-api metadata
entries.

Change-Id: Ibd26b33b3370d5c9c6cca0bb6e0d9c9eb03c0d50
Closes-Bug: #1717494
This commit is contained in:
Stefan Nica 2017-09-15 13:39:37 +02:00
parent 32eedd8a5c
commit 1dad720ef5
1 changed files with 1 additions and 1 deletions

View File

@ -100,7 +100,7 @@ def get_metadata_item(context, path_tokens, os_instance_id, remote_ip,
elif version not in VERSIONS:
raise exception.EC2MetadataNotFound()
cache_key = 'metadata-%s' % os_instance_id
cache_key = 'ec2api-metadata-%s' % os_instance_id
cache = cache_region.get(
cache_key, expiration_time=CONF.metadata.cache_expiration)
if cache and cache != cache_core.NO_VALUE: