From: Patrick East Date: Mon, 4 Jan 2016 20:02:50 +0000 (-0800) Subject: Don’t log warnings for image cache when disabled X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=382b56f2fe86659a26b3cdeb20f804245fb6ba6e;p=openstack-build%2Fcinder-build.git 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 --- diff --git a/cinder/volume/flows/manager/create_volume.py b/cinder/volume/flows/manager/create_volume.py index 6ae0cc436..4322f5f37 100644 --- a/cinder/volume/flows/manager/create_volume.py +++ b/cinder/volume/flows/manager/create_volume.py @@ -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.