-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
Storage in R4.0 fixes/improvements/missing parts #2256
Comments
As for |
It tries to parse (untrusted) volume content, so remove it to not use it accidentally. QubesOS/qubes-issues#2256
This script should run as fast as possible, so avoid importing large module. In fact the only used thing was argparse wrapper, so switch to the standard one and drop aliases. QubesOS/qubes-issues#2256
The script is already running as root QubesOS/qubes-issues#2256
|
Add 'backenddomain' element when source (not target) domain is not dom0. Fix XML elemenet name. Actually set volume.domain when listing VM-exposed devices. QubesOS/qubes-issues#2256
No need to be root here. QubesOS/qubes-issues#2256
Add 'backenddomain' element when source (not target) domain is not dom0. Fix XML elemenet name. Actually set volume.domain when listing VM-exposed devices. QubesOS/qubes-issues#2256
...instead of manual copy in python. DD is much faster and when used with `conv=sparse` it will correctly preserve sparse image. QubesOS/qubes-issues#2256
The wrapper doesn't do anything else than translating command parameters, but it's load time is significant (because of python imports mostly). Since we can't use python lvm API from non-root user anyway, lets drop the wrapper and call `lvm` directly (or through sudo when necessary). This makes VM startup much faster - storage preparation is down from over 10s to about 3s. QubesOS/qubes-issues#2256
- add missing lvm remove call when commiting changes - delay creating volatile image until domain startup (it will be created then anyway) - reset cache only when really changed anything - attach VM to the volume (snapshot) created for its runtime - to not expose changes (for example in root volume) to child VMs until shutdown QubesOS/qubes-issues#2412 QubesOS/qubes-issues#2256
This may happen when removing not fully created VM. QubesOS/qubes-issues#2256
There were two: _reset and _reset_volume. Neither of them was working, but the later was closer. Remove the other one. QubesOS/qubes-issues#2256
Just calling pool.init_volume isn't enough - a lot of code depends on additional data loaded into vm.storage object. Provide a convenient wrapper for this. At the same time, fix loading extra volumes from qubes.xml - don't fail on volume not mentioned in initial vm.volume_config. QubesOS/qubes-issues#2256
There are mutiple cases when snapshots are inconsistently created, for example: - "-back" snapshot created from the "new" data, instead of old one - "-snap" created even when volume.snap_on_start=False - probably more Fix this by following volume.snap_on_start and volume.save_on_stop directly, instead of using abstraction of old volume types. QubesOS/qubes-issues#2256
In case of LVM (at least), "internal" flag is initialized only when listing volume attached to given VM, but not when listing them from the pool. This looks like a limitation (bug?) of pool driver, it looks like much nicer fix is to handle the flag in qvm-block tool (which list VMs volumes anyway), than in LVM storage pool driver (which would need to keep second copy of volumes list - just like file driver). QubesOS/qubes-issues#2256
Things like if read-only volume is really read-only, volatile is volatile etc. QubesOS/qubes-issues#2256
Content should be reset back to base volume at each VM startup. Disposable VMs depend on this behaviour. QubesOS/qubes-issues#2256
Have dm-snapshot of dm-snapshot. The first layer is to "cache" changes done by base volume holder (TemplateVM in case of root.img), the second layer is to hold changes do by snapshot volume holder (AppVM in case of root.img). In case of Linux VMs the second layer is normally done inside of VM (original volume is exposed read-only). But this does not work for non-Linux VMs, orr even Linux but without qubes-specific startup scripts. This is first part of the change - actual construction of two layers of dm-snapshot, not plugged in to core scripts yet. QubesOS/qubes-issues#2256
Use the right cow image and apply the second layer to provide read-write access. The correct setup is: - base image + base cow -> read-only snapshot (base changes "cached" until committed) - read-only snapshot + VM cow -> read-write snapshot (changes discarded after VM shutdown) This way, even VM without Qubes-specific startup scripts will can benefit from Template VMs, while VMs with Qubes-specific startup scripts may still see original root.img content (for possible signature verification, when storage domain got implemented). QubesOS/qubes-issues#2256
Content should be reset back to base volume at each VM startup. Disposable VMs depend on this behaviour. QubesOS/qubes-issues#2256
Have dm-snapshot of dm-snapshot. The first layer is to "cache" changes done by base volume holder (TemplateVM in case of root.img), the second layer is to hold changes do by snapshot volume holder (AppVM in case of root.img). In case of Linux VMs the second layer is normally done inside of VM (original volume is exposed read-only). But this does not work for non-Linux VMs, orr even Linux but without qubes-specific startup scripts. This is first part of the change - actual construction of two layers of dm-snapshot, not plugged in to core scripts yet. QubesOS/qubes-issues#2256
Do not create it at volume creation time. It it needed only when VM is running, so create it just before startup only. QubesOS/qubes-issues#2256
- improve TestPool mock - init_volume now return appropriate mock type, instead of TestPool - improve patching base directory (/var/lib/qubes) - it is stored in more than one place... - fix inheritance in TC_01_ThinPool class - fix expected LVM volume names ('vm-' prefix) - fix cleanup after FilePool tests - remove temporary qubes.xml QubesOS/qubes-issues#2256
Don't set 'source' volume in various places (each VM class constructor etc), do it as part of volume initialization. And when it needs to be re-calculated, call storage.init_volume again. This code was duplicated, and as usual in such a case, those copies were different - one have set 'size', the other one not. QubesOS/qubes-issues#2256
Do not create it at volume creation time. It it needed only when VM is running, so create it just before startup only. QubesOS/qubes-issues#2256
|
Abandon keeping the most recent volume revision on bare VID name - this leads to various problems with atomic commit (needs to rename/remove old one before committing new one). Instead, always have volume revision suffix, even for the newest one. To make absolutely sure that the right revision is chosen, number revisions sequentially, in addition to timestamps. This avoid wrong ordering in case of time change (including time sync problems). This approach also makes it easier to recover from interrupted operation (including commit, clone, resize etc), because old revision is kept there, as normal revision (instead of -tmp or such). QubesOS/qubes-issues#2256
Do not write directly to main volume, instead create temporary volume and only commit it to the main one when operation is finished. This solve multiple problems: - import operation can be aborted, without data loss - importing new data over existing volume will not leave traces of previous content - especially when importing smaller volume to bigger one - import operation can be reverted - it create separate revision, similar to start/stop - easier to prevent qube from starting during import operation - template still can be used when importing new version QubesOS/qubes-issues#2256
Abandon keeping the most recent volume revision on bare VID name - this leads to various problems with atomic commit (needs to rename/remove old one before committing new one). Instead, always have volume revision suffix, even for the newest one. To make absolutely sure that the right revision is chosen, number revisions sequentially, in addition to timestamps. This avoid wrong ordering in case of time change (including time sync problems). This approach also makes it easier to recover from interrupted operation (including commit, clone, resize etc), because old revision is kept there, as normal revision (instead of -tmp or such). QubesOS/qubes-issues#2256
Do not write directly to main volume, instead create temporary volume and only commit it to the main one when operation is finished. This solve multiple problems: - import operation can be aborted, without data loss - importing new data over existing volume will not leave traces of previous content - especially when importing smaller volume to bigger one - import operation can be reverted - it create separate revision, similar to start/stop - easier to prevent qube from starting during import operation - template still can be used when importing new version QubesOS/qubes-issues#2256
Abandon keeping the most recent volume revision on bare VID name - this leads to various problems with atomic commit (needs to rename/remove old one before committing new one). Instead, always have volume revision suffix, even for the newest one. To make absolutely sure that the right revision is chosen, number revisions sequentially, in addition to timestamps. This avoid wrong ordering in case of time change (including time sync problems). This approach also makes it easier to recover from interrupted operation (including commit, clone, resize etc), because old revision is kept there, as normal revision (instead of -tmp or such). QubesOS/qubes-issues#2256
Do not write directly to main volume, instead create temporary volume and only commit it to the main one when operation is finished. This solve multiple problems: - import operation can be aborted, without data loss - importing new data over existing volume will not leave traces of previous content - especially when importing smaller volume to bigger one - import operation can be reverted - it create separate revision, similar to start/stop - easier to prevent qube from starting during import operation - template still can be used when importing new version QubesOS/qubes-issues#2256
Abandon keeping the most recent volume revision on bare VID name - this leads to various problems with atomic commit (needs to rename/remove old one before committing new one). Instead, always have volume revision suffix, even for the newest one. To make absolutely sure that the right revision is chosen, number revisions sequentially, in addition to timestamps. This avoid wrong ordering in case of time change (including time sync problems). This approach also makes it easier to recover from interrupted operation (including commit, clone, resize etc), because old revision is kept there, as normal revision (instead of -tmp or such). QubesOS/qubes-issues#2256
Do not write directly to main volume, instead create temporary volume and only commit it to the main one when operation is finished. This solve multiple problems: - import operation can be aborted, without data loss - importing new data over existing volume will not leave traces of previous content - especially when importing smaller volume to bigger one - import operation can be reverted - it create separate revision, similar to start/stop - easier to prevent qube from starting during import operation - template still can be used when importing new version QubesOS/qubes-issues#2256
First rename volume to backup revision, regardless of revisions_to_keep, then rename -snap to current volume. And only then remove backup revision (if exceed revisions_to_keep). This way even if commit operation is interrupted, there is still a volume with the data. This requires also adjusting few functions to actually fallback to most recent backup revision if the current volume isn't found - create _vid_current property for this purpose. Also, use -snap volume for clone operation and commit it normally later. This makes it safer to interrupt or even revert. QubesOS/qubes-issues#2256
Do not write directly to main volume, instead create temporary volume and only commit it to the main one when operation is finished. This solve multiple problems: - import operation can be aborted, without data loss - importing new data over existing volume will not leave traces of previous content - especially when importing smaller volume to bigger one - import operation can be reverted - it create separate revision, similar to start/stop - easier to prevent qube from starting during import operation - template still can be used when importing new version QubesOS/qubes-issues#2256
All points handled. |
Most of those are just minor things, so lets collect them in a single ticket to not trash github-issues repo.
qubes-lvm
is already running as root, no need to usesudo
internally; and BTW it isn't possible to allow non-root user managing LVM: besides access to various files,/dev/mapper/control
driver have hardcoded check forCAP_SYS_ADMIN
qubes-lvm
should be as minimal/fast as possible - it is called multiple times during some time-critical actions (like DispVM startup); for example it should not loadqubes.xml
, nor even importqubes
vm.storage.stop()
should not be called invm.shutdown()
- VM is still running at that time (system inside is shutting down), evenvm.kill()
isn't good idea - VM can always shutdown itself (like when someone runpoweroff
inside); it needs to be done from some real shutdown event handler. Libvirt 2.2 is going to support something like this (/etc/libvirt/hooks/libxl
), but for now all we have is block devices hotplug scripts. Libvirt 2.2 is going to be released somewhere in September, so we can wait for it.ThinPool
do not implementresize
methodqvm-block
(or any other tool) do not support resizing volumes; not sure if that should beqvm-block
work, but surely it should be available somewhereqvm-block ls
list internal VM volumes (even without--internal
flag), if VM is created with non-default poolqubes-lvm
(or any other storage utility) should not parse volumes content in any way; I see there unused functionlvm_image_changed
, which callstune2fs
on given volumevolume.snap_on_start=False
)qvm-block ls
when called without particular VM, list empty metadata for internal volumes: first of all those volumes should be hidden by default (without-i
flag), but even when listed, should have domain and volume name filledvm.volumes['root'].source
still point at old template's root.I'll update this list with further issues when found.
/cc @kalkin
The text was updated successfully, but these errors were encountered: