Comment 7 for bug 1852168

Revision history for this message
Sofia Enriquez (lsofia-enriquez) wrote :

Hello, I'd like to reopen this because it's still a problem: https://bugs.launchpad.net/cinder/+bug/1922408

The root of this problem is that cinder force to truncate the destination size of the volume.[1]

Usually the source volume would be the same size or smaller than the destination volume and they *must* share the same volume-type.

In particular RBD workflow would be something like this:
A source luks volume would be 1026M, we write some data and create a snap from it. We like to create a new luks volume from a snapshot so the create_volume_from_snapshot() method performs a RBD clone first and then a resize if needed.

In addition the _clone() method creates a clone (copy-on-write child) of the parent snapshot. Object size will be identical to that of the parent image unless specified (we don't in cinder) so size will be the same as the parent snapshot.

If the desired size of the destination luks volume is 1G the create_volume_from_snapshot() won't perform any resize and will be 1026M as the parent. This solves bug #1922408 because we don't force it to resize and because of that we don't truncate the data anymore.

The second case scenario is when we would like to increase the size of the destination volume. As far as I test it this won't face the encryption header problem but we still need to calculate the difference size to provide the size that the user is expecting.

[1]https://opendev.org/openstack/cinder/src/branch/master/cinder/volume/drivers/rbd.py#L1050