Comment 4 for bug 1552734

Revision history for this message
zhuangzejian (zhuangzejian) wrote :

Hi guys,
       How does this bug reproduce?
       In cinder.volume.manager.py, when we are creating the image_volume cache, we will call create volume which would call the _create_from_source_volume method where the driver's create_cloned_volume method is.
       What reference above is a par of code in cinder.volume.manager.py:

       VolumeManager._create_image_cache_volume_entry:
       try:
       ...
            image_volume = self._clone_image_volume(ctx,
                                                    volume_ref,
                                                    image_meta)
            if not image_volume:
                LOG.warning('Unable to clone image_volume for image '
                            '%(image_id)s will not create cache entry.',
                            {'image_id': image_id})
                return

            self.image_volume_cache.create_cache_entry(
                ctx,
                image_volume,
                image_id,
                image_meta
            )
        except exception.CinderException as e:
            LOG.warning('Failed to create new image-volume cache entry.'
                        ' Error: %(exception)s', {'exception': e})
            if image_volume:
                self.delete_volume(ctx, image_volume)

       If the driver's clone method failed, the image_volume would be deleted and return none. So it won't call create_cache_entry method anyway.
       I don't think the new entry(entry for image volume as a image_volume_cache) would be created if the image volume is useless(also like the driver's create_cloned_volume method failed).