]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Don’t log warnings for image cache when disabled
authorPatrick East <patrick.east@purestorage.com>
Mon, 4 Jan 2016 20:02:50 +0000 (12:02 -0800)
committerPatrick East <patrick.east@purestorage.com>
Tue, 5 Jan 2016 01:31:53 +0000 (17:31 -0800)
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

cinder/volume/flows/manager/create_volume.py

index 6ae0cc43621eedb8571e8a9a6a42ed0c430a3b90..4322f5f37a299e661b0fdeabf25dce3398ba10d4 100644 (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.