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.
That's why the fix proposed calculate the new_size based on :
size difference = desired size - size of source volume
new size = current size + size difference
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: volume_ from_snapshot( ) method performs a RBD clone first and then a resize if needed.
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_
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.
That's why the fix proposed calculate the new_size based on :
size difference = desired size - size of source volume
new size = current size + size difference