Activity log for bug #1813138

Date Who What changed Old value New value Message
2019-01-24 09:45:34 Silvan Kaiser bug added bug
2019-01-24 10:40:14 OpenStack Infra cinder: status New In Progress
2019-01-24 10:40:14 OpenStack Infra cinder: assignee Silvan Kaiser (2-silvan)
2019-01-28 11:08:10 Silvan Kaiser 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
2019-01-28 12:39:19 Silvan Kaiser 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 provider_location attribute can become outdated and thus point to 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 provider_location attribute 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.provider_location 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.provider_location points to the original file name while the last active file name from the info file points to the new file name 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#L441 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