_snapshot_exists method in remotefs is wrong if the last snapshot was deleted by Nova

Bug #1813138 reported by Silvan Kaiser
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
In Progress
Undecided
Silvan Kaiser

Bug Description

tl;dnr:
The _snapshot_exists method should return false if all snapshots have been deleted, even if the last snapshot was deleted via the Nova API.

Detailed:
Using the RemoteFSSnapDriverBase [1] implementation a volumes file name can change and thus cause _snapshot_exists to look for the wrong file, for example in the following scenario:
1) Create a volume and attach it to a VM
2) Create a snapshot file for this volume
3) Delete the snapshot file
4) Compare the volumes expected path to the path stored in the volumes .info file, they differ (which they should not).

The reason for this is that, when deleting the last snapshot of a volume via Nova API, the resulting file is not the original volume file but the file created during snapshotting, as Nova uses a pull operation (see [2]). This behaviour differs from the deletion of a snapshot of a detached volume [3], where the volumes file name stays the original file name.

This issue arises when the _snapshot_exists method [4] compares the active image path to the volumes path (which is based on the volume.name attribute, [5]). In case the last snapshot was deleted via Nova while the volume was attached this method reports remaining snapshots while there are none, as the volume.name attribute points to the original file name while the last active file name from the info file points to the new file name which was created during snapshotting.

[1] https://github.com/openstack/cinder/blob/master/cinder/volume/drivers/remotefs.py#L687
[2] https://github.com/openstack/cinder/blob/master/cinder/volume/drivers/remotefs.py#L1386
[3] https://github.com/openstack/cinder/blob/master/cinder/volume/drivers/remotefs.py#L1414
[4] https://github.com/openstack/cinder/blob/master/cinder/volume/drivers/remotefs.py#L1016
[5] https://github.com/openstack/cinder/blob/master/cinder/volume/drivers/remotefs.py#L442

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

Fix proposed to branch: master
Review: https://review.openstack.org/632982

Changed in cinder:
assignee: nobody → Silvan Kaiser (2-silvan)
status: New → In Progress
Silvan Kaiser (2-silvan)
summary: - incorrect volume provider_location after snapshot deletion with attached
- volume in remotefs driver
+ _snapshot_exists method in remotefs is wrong if the last snapshot was
+ deleted by Nova
Revision history for this message
Silvan Kaiser (2-silvan) wrote :

Note: I updated the bug title and description. Initially i made a connection to the provider_location attribute which was wrong.

description: updated
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.