-
-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failure to restore vm with disk size smaller than default #7176
Failure to restore vm with disk size smaller than default #7176
Comments
|
|
I ran into the same type of issue with a template build for a mirageOS unikernel (qubes-mirage-firewall). My
and when I try to install it into dom0:
The EDIT: add the full backtrace |
Not sure if that can help, and my knowledge does not permit me to try that patch, but as we seem to have the
|
@palainp Neat! qubesadmin.backup.restore has the relevant code, but there's lots of indirection so it might have to be refactored a bit. |
OK, I was kind of able to fix this, but due to too many API layers this is not the cleanest fix. Contrary to what @rustybird said previously, the error message is actually triggered in admin.vm.volume.Import script, section starting from line 69. Commenting it out will get rid of the error, but your restored volumes will not be resized. I therefore decided to look for a cleaner way which sent me down a rabbit hole... First, inspired by @palainp I made a similar change to restore code in restore.py
This was not enough though, as for whatever reason a function just below patched prohibits volume downsizing during restore, which I consider to be a bug. So one additional fix is needed:
This fixes restore code to properly take care of volume downsizing. I was hoping that this will do the job, but turned out the underlying storage driver cannot downsize volumes! I think this was done to prevent user from reducing volume size from qube settings or commend line (which is a right thing to do), but baking this into storage backend does sounds way too extreme to me. Anyway, I'm not keen to edit underlying Qubes API so I decided to fully restore the ability to downsize volumes. As I use LVM backend, all the changes I needed are limited to lvm.py. First, I had to remove backend restriction to downsize volumes:
Second, we need to allow extend operation to downsize volumes:
Keep in mind this will likely enable system-wide LVM volumes downsize. A cleaner approach would be to modify Qubes internal API so that restore operation could indicate that volume downsize shall be allowed. Alternatively, all the downsize checks can be move to appropriate frontends, leaving my added backend downsize capability intact. I definitely prefer second solution as more architecturally correct ne. |
@a-barinov You, I, and @marmarek all agree that the downsize checks do not belong in qubesd. Care to send a PR with your changes? |
You'll have it in a few days. Let me verify that other frontends have appropriate downsize checks, and also check other backends. |
Migrate from resize() followed by unspecified-size import_data() to the newer method import_data_with_size(), which fixes two bugs. 1. When restoring a volume with a size that's smaller than the default, the resize step didn't attempt to shrink (and not all storage drivers would have supported it anyway), which caused the import step to fail with the message "not enough data": Fixes QubesOS/qubes-issues#7176 2. When restoring a volume with a size that's not divisible by 4 MiB (e.g. backed up from file-reflink), LVM Thin implicitly rounds up the resize to next multiple, which again caused the import step to fail in the same way: https://forum.qubes-os.org/t/backup-didnt-restore-private-volume/17874
Allow admin.vm.volume.ImportWithSize too, not only admin.vm.volume.Import. QubesOS/qubes-issues#7176
Automated announcement from builder-github The package
|
Automated announcement from builder-github The package
|
Automated announcement from builder-github The component
|
Automated announcement from builder-github The component
|
Migrate from resize() followed by unspecified-size import_data() to the newer method import_data_with_size(), fixing two bugs. 1. When restoring a volume with a size that's smaller than the default, the resize step didn't attempt to shrink (and not all storage drivers would have supported it anyway), which caused the import step to fail with the message "not enough data": Fixes QubesOS/qubes-issues#7176 2. When restoring a volume with a size that's not divisible by 4 MiB (e.g. backed up from file-reflink), LVM Thin implicitly rounds up the resize to next multiple, which again caused the import step to fail in the same way: https://forum.qubes-os.org/t/backup-didnt-restore-private-volume/17874 (cherry picked from commit ba9b24d)
Automated announcement from builder-github The component
|
Automated announcement from builder-github The component
Or update dom0 via Qubes Manager. |
Automated announcement from builder-github The package
|
Automated announcement from builder-github The package
|
Qubes OS release
4.1.0-rc3
Brief summary
When trying to restore a TemplateVM with root or private volume smaller than default (10G and 2G respectively), restore fails with error "not enough data".
I have not tested other vm types or backups created in Qubes 4.0.
Steps to reproduce
Expected behavior
VM getting restored from backup and can be started without errors.
Actual behavior
Trying to restore, you get the following error:
Restored VM then cannot start.
The text was updated successfully, but these errors were encountered: