[openstack-dev] [cinder] "Snapshot-manage imports snapshots with wrong size"

Mykhailo Dovgal mdovgal at mirantis.com
Thu Jan 19 15:03:59 UTC 2017


Hi, folks.

Having worked on this bug [0] I could reproduce it with lvm as a backend.
And during it further investigation, I found the real problem that triggers
it. Here [1] after getting the real snapshot size, we are trying to update
'size' column. But actually snapshot's size is stored in cinder.snapshots
table in column that actually is called 'volume_size'.

So after operations that are described in bug description part of [0] we
will always get snapshot with the wrong size.
This problem has some side-effects. As an example, using lvm as a backend
we can't delete the snapshot with the bigger size than real and without
'volume_clear = none', because it will try to clear the bigger space that
it real can

There are at least two ways how to solve this problem:

1. Just change here [1] ['size'] -> ['volume_size'] to assure that
necessary database column will be updated and it will not trigger this
problem in future. And add some tests for it.

2. As the name of the column in snapshot table 'volume_size' is incorrect,
because it doesn't connected with the volume size, but with snapshot size,
we need to change db schema (add column that will be called 'size' instead
of 'volume_size' and in future remove 'volume_size' column) and add some
possibility for data migration. And of course a lot of tests for it.

The first variant is much easier, but I think, that the second variant is
much better, because we will get rid of code that is ambiguous and make our
database scheme clear.

I've started working on the second variant but I want to hear your opinion
about it. Maybe somebody knows that solution that is better that mine.
Looking forward to your answers.

[0] - *https://bugs.launchpad.net/cinder/+bug/1623596
<https://bugs.launchpad.net/cinder/+bug/1623596>*
[1] - https://github.com/openstack/cinder/blob/02389a1d2ac4822d3
7b1f7fbd29391097bfcb56f/cinder/volume/flows/manager/
manage_existing_snapshot.py#L241-L246
[2] - https://github.com/openstack/cinder/blob/
02389a1d2ac4822d37b1f7fbd29391097bfcb56f/cinder/volume/
flows/manager/manage_existing_snapshot.py#L241


Best regards.
Michael Dovgal,
mdovgal on chat.freenode.net
Mirantis Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20170119/82719843/attachment.html>


More information about the OpenStack-dev mailing list