Skip to content

Allow all storage drivers to shrink volumes, like file-reflink#835

Open
rustybird wants to merge 2 commits into
QubesOS:mainfrom
rustybird:shrink-volumes
Open

Allow all storage drivers to shrink volumes, like file-reflink#835
rustybird wants to merge 2 commits into
QubesOS:mainfrom
rustybird:shrink-volumes

Conversation

@rustybird

@rustybird rustybird commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Similar in purpose to #477, #478, #479 by @a-barinov in 2022, but with the shrinking check happening on the frontend side as suggested by @marmarek. The frontend already had such a check but only in the qvm-volume tool; QubesOS/qubes-core-admin-client#475 centralizes this check to qubesadmin.storage.Volume.resize() so that any other callers are protected as well. (Qube Manager's qube Settings dialog / qubes-vm-settings also has its own logic that avoids calling resize() if it would shrink.)

@codecov

codecov Bot commented Jul 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 70.33%. Comparing base (befbb9b) to head (cee4105).
⚠️ Report is 28 commits behind head on main.

Files with missing lines Patch % Lines
qubes/storage/lvm.py 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #835      +/-   ##
==========================================
- Coverage   70.46%   70.33%   -0.14%     
==========================================
  Files          61       61              
  Lines       14161    14137      -24     
==========================================
- Hits         9979     9943      -36     
- Misses       4182     4194      +12     
Flag Coverage Δ
unittests 70.33% <83.33%> (-0.14%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rustybird rustybird changed the title Allow all storage drivers to shrink volumes, like file-reflink Allow lvm_thin and file to shrink volumes, like file-reflink Jul 10, 2026
@rustybird

rustybird commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

@Rudd-O: Are you sure that OpenZFS's zfs set volsize=... - which the 'zfs' driver uses to resize volumes, right? - does not support shrinking? Here's someone in the OpenZFS forum (upvoted by two people) wishing that it didn't shrink without prompting for confirmation: openzfs/zfs#14820. And some people in the FreeNAS forum also claiming that it works: https://www.truenas.com/community/threads/changing-size-shrink-on-active-zvol.42142/#post-444130

Maybe it fails if snapshots of the zvol exist? If OpenZFS does support shrinking even then, I propose to add this commit to the PR: rustybird@shrink-volumes-zfs

@rustybird rustybird changed the title Allow lvm_thin and file to shrink volumes, like file-reflink Allow all storage drivers to shrink volumes, like file-reflink Jul 20, 2026
@rustybird

Copy link
Copy Markdown
Contributor Author

After setting up ZFS, I tested shrinking a 'zfs' driver volume and it worked fine. So I've added that commit to the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant