<div dir="ltr"><div>Hi, folks.</div><div><br></div><div>Having worked on this bug [0] I could reproduce it with lvm as a backend.</div><div>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'.</div><div><br></div><div>So after operations that are described in bug description part of [0] we will always get snapshot with the wrong size.<br></div><div>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</div><div><br></div><div>There are at least two ways how to solve this problem:</div><div><br></div><div>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.</div><div><br></div><div>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. </div><div><br></div><div>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.</div><div><br>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.</div><div>Looking forward to your answers.</div><div><br></div><div>[0] - <font color="#1155cc"><u><a href="https://bugs.launchpad.net/cinder/+bug/1623596">https://bugs.launchpad.net/cinder/+bug/1623596</a></u></font><br></div><div>[1] - <a href="https://github.com/openstack/cinder/blob/02389a1d2ac4822d37b1f7fbd29391097bfcb56f/cinder/volume/flows/manager/manage_existing_snapshot.py#L241-L246" target="_blank">https://github.com/openstack<wbr>/cinder/blob/02389a1d2ac4822d3<wbr>7b1f7fbd29391097bfcb56f/<wbr>cinder/volume/flows/manager/<wbr>manage_existing_snapshot.py#<wbr>L241-L246</a></div><div>[2] - <a href="https://github.com/openstack/cinder/blob/02389a1d2ac4822d37b1f7fbd29391097bfcb56f/cinder/volume/flows/manager/manage_existing_snapshot.py#L241" target="_blank">https://github.com/<wbr>openstack/cinder/blob/<wbr>02389a1d2ac4822d37b1f7fbd29391<wbr>097bfcb56f/cinder/volume/<wbr>flows/manager/manage_existing_<wbr>snapshot.py#L241</a></div><div><br></div><div><br></div><div>Best regards.</div><div>Michael Dovgal,</div><div>mdovgal on <a href="http://chat.freenode.net/" target="_blank" style="font-size:13px">chat.freenode.net</a><br></div><div>Mirantis Inc.<br></div></div>