Allow volume shrinking#479
Conversation
Bypass size check for file and lvm if shrinking is allowed. Implement size check for reflink as it wasn't there.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #479 +/- ##
==========================================
- Coverage 65.82% 65.80% -0.02%
==========================================
Files 53 53
Lines 10015 10023 +8
==========================================
+ Hits 6592 6596 +4
- Misses 3423 3427 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
This PR should not change anything in how volumes are currently resized. An the next step, patch to allow volume when restoring from backup will be submitted. I see Codecov complaining about reduced coverage, let me know if this needs to be dealt with before PR is accepted. |
A test for new resize parameter would be useful. See qubes/tests/storage_lvm.py for example - you can add something based on test_006_resize that attempt to shrink the volume (either with allow_shrink=True and False - and check for expected outcome). |
|
Is the storage driver API really the right place to distinguish between extending and resizing? Duplicating this safety check in each driver looks strange to me. Why not something like:
|
I'm a bit worried about this step - if you update core-admin but not core-admin-client, then you'll end up without the safety check at all. In dom0, a package dependency could be used to avoid this, but not in sys-gui. Maybe sys-gui is still rare enough to not care about it right now... ? |
I hadn't thought of that... @a-barinov's approach of having the safety check in the storage driver might be the way to go then. That also avoids introducing a TOCTOU problem if there are concurrent API calls. (Is there something ReflinkVolume and FileVolume could use to enforce |
Tried doing this, but can't find a way to re-run CI test to check if the tests I added do make sense / do not fail. Deleting this PR and creating a new one does not sound like a good solution. |
We're doing some maintenance on CI, should be back online in few hours. |
|
PipelineRetry |
|
This looks good as is, but there needs to be further change to actually use the new parameter (expose it in api/admin.py, and then add support in qvm-volume tool). The backup case is handled by |
Change Volume.resize call to allow volume shrinking.
Bypass size check for file and lvm if shrinking is allowed.
Implement size check for reflink as it wasn't there.