Don’t log warnings for image cache when disabled

Right now we do a check for the internal tenant and log a warning before
we check to see if the cache is even turned on for that backend. We
should be only checking for the internal tenant if the image cache has
been configured for the backend.

In addition we shouldn’t log a warning for this since there is already
a warning for the internal context when we try and create it if it is
not configured correctly… to reduce the warning spam this change
switches the log message to an info level.

Change-Id: Iddc4648543d268a4b3b8d557c94c4d2876654e22
Closes-Bug: #1530964
This commit is contained in:
Patrick East 2016-01-04 12:02:50 -08:00
parent 7df01a599a
commit 382b56f2fe
1 changed files with 15 additions and 16 deletions

View File

@ -714,24 +714,23 @@ class CreateVolumeFromSpecTask(flow_utils.CinderTask):
volume_ref,
image_location,
image_meta)
# Try and use the image cache.
should_create_cache_entry = False
internal_context = cinder_context.get_internal_tenant_context()
if not internal_context:
LOG.warning(_LW('Unable to get Cinder internal context, will '
'not use image-volume cache.'))
if not cloned and internal_context and self.image_volume_cache:
model_update, cloned = self._create_from_image_cache(
context,
internal_context,
volume_ref,
image_id,
image_meta
)
if not cloned:
should_create_cache_entry = True
if self.image_volume_cache and not cloned:
internal_context = cinder_context.get_internal_tenant_context()
if not internal_context:
LOG.info(_LI('Unable to get Cinder internal context, will '
'not use image-volume cache.'))
else:
model_update, cloned = self._create_from_image_cache(
context,
internal_context,
volume_ref,
image_id,
image_meta
)
if not cloned:
should_create_cache_entry = True
# Fall back to default behavior of creating volume,
# download the image data and copy it into the volume.