cached image volume not deleted if clone volume fails

Bug #1552734 reported by Matan Sabag
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
High
Vishakha Agarwal

Bug Description

Hi,

When creating a volume from image a new, cinder looks in the cache for a relevant cache-entry.
In case of a "hit", it calls the driver's create_cloned_volume() method.

But, when create_cloned_volume() fails, it just creates a new cache entry, instead of also deleting the old entry with the pertinent volume.

Changed in cinder:
assignee: nobody → Bharath kumar (bharath-kumar3)
Changed in cinder:
importance: Undecided → Low
Xing Yang (xing-yang)
Changed in cinder:
importance: Low → High
status: New → Triaged
Revision history for this message
Bharath kumar (bharath-kumar3) wrote :
Changed in cinder:
status: Triaged → In Progress
Revision history for this message
Sean McGinnis (sean-mcginnis) wrote : Bug Assignee Expired

Unassigning due to no activity for > 6 months.

Changed in cinder:
assignee: Bharath kumar (bharath-kumar3) → nobody
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on cinder (master)

Change abandoned by Eric Harney (<email address hidden>) on branch: master
Review: https://review.openstack.org/291204
Reason: Merge conflict since April

Eric Harney (eharney)
Changed in cinder:
status: In Progress → New
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).

Changed in cinder:
status: New → Incomplete
Changed in cinder:
assignee: nobody → Vishakha Agarwal (vishakha.agarwal)
Revision history for this message
Vishakha Agarwal (vishakha.agarwal) wrote :

Hi zhuangzejian,

VolumeManager._create_image_cache_volume_entry:

It is called only for the first time when a new cache entry is to be done. Otherwise from self._prepare_image_cache_entry in create_volume.py it does not go into its else part if already cache entry exists.

Changed in cinder:
status: Incomplete → In Progress
Revision history for this message
Vishakha Agarwal (vishakha.agarwal) wrote :
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.openstack.org/567473
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=a74f7f0cd00619a775483f66f134ca8952eca7d3
Submitter: Zuul
Branch: master

commit a74f7f0cd00619a775483f66f134ca8952eca7d3
Author: Vishakha Agarwal <email address hidden>
Date: Thu May 10 11:14:40 2018 +0530

    Cloning image fails results duplicate cache entry

    When creating a volume with image whose cache
    entry is already present,results in duplicate
    cache entry when create_clone_image() fails.

    Closes-Bug: #1552734
    Change-Id: I0708c333fa94bb44e66f64b2b7cc3bc0dbe8a409

Changed in cinder:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/cinder 13.0.0.0b3

This issue was fixed in the openstack/cinder 13.0.0.0b3 development milestone.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (stable/queens)

Fix proposed to branch: stable/queens
Review: https://review.openstack.org/592736

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (stable/queens)

Reviewed: https://review.openstack.org/592736
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=93bde2210f64421d0915de107bdc2d53de94a973
Submitter: Zuul
Branch: stable/queens

commit 93bde2210f64421d0915de107bdc2d53de94a973
Author: Vishakha Agarwal <email address hidden>
Date: Thu May 10 11:14:40 2018 +0530

    Cloning image fails results duplicate cache entry

    When creating a volume with image whose cache
    entry is already present,results in duplicate
    cache entry when create_clone_image() fails.

    Closes-Bug: #1552734
    Change-Id: I0708c333fa94bb44e66f64b2b7cc3bc0dbe8a409
    (cherry picked from commit a74f7f0cd00619a775483f66f134ca8952eca7d3)

tags: added: in-stable-queens
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/cinder 12.0.4

This issue was fixed in the openstack/cinder 12.0.4 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.