Skip to content
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

Do not activate not currently used LVM volumes #6184

Open
marmarek opened this issue Nov 4, 2020 · 1 comment · May be fixed by QubesOS/qubes-core-admin#382
Open

Do not activate not currently used LVM volumes #6184

marmarek opened this issue Nov 4, 2020 · 1 comment · May be fixed by QubesOS/qubes-core-admin#382
Labels
C: core C: storage P: default Priority: default. Default priority for new issues, to be replaced given sufficient information. T: enhancement Type: enhancement. A new feature that does not yet exist or improvement of existing functionality.

Comments

@marmarek
Copy link
Member

marmarek commented Nov 4, 2020

The problem you're addressing (if any)

Active LVM volumes takes some kernel resources, but also activating them takes time. Active volumes also require more locking on LVM side when handling them - for example when creating a snapshot (volume clone) if source volume is active, it needs to be suspended. This takes time.

Describe the solution you'd like

Keep active only volumes currently in use by a running VM. Others should be inactive. LVM thin snapshots are inactive by default, unless explicitly requested to be activated (we the current LVM storage pool driver does). This require following change:

  • drop -kn and -ay options from lvcreate call
  • add lvchange -ay call in the VM start path
  • add lvchange -an call in the VM shutdown path

Where is the value to a user, and who might that user be?

Less resources used in dom0. Faster VM startup/shutdown time.

Relevant documentation you've consulted

https://dev.qubes-os.org/projects/core-admin/en/latest/qubes-storage.html

Related, non-duplicate issues

@marmarek marmarek added T: enhancement Type: enhancement. A new feature that does not yet exist or improvement of existing functionality. P: default Priority: default. Default priority for new issues, to be replaced given sufficient information. labels Nov 4, 2020
@marmarek marmarek added this to the Release 4.1 milestone Nov 4, 2020
marmarek added a commit to marmarek/qubes-core-admin that referenced this issue Jan 15, 2021
This prevents udev from accessing not currently used volumes, and also
makes LVM snapshot operations faster (less locking to do).

There is at least one unsolved problem here: inactive volumes do not
have size listed on `lvs` output. There is a band-aid by caching the
usage from the last time the volume was active, but it isn't enough for
many cases (at the very least - reporting disk usage of a VM that wasn't
started recently).

There may be also other places that assume existing volumes always have
relevant /dev/ node present.

Fixes QubesOS/qubes-issues#6184
@marmarek
Copy link
Member Author

The exact performance gain needs to be measured. I initially considered it for R4.1, but now I think it may be too risky change at this stage - if the benefits are not great, I'd rather postpone it for a later version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: core C: storage P: default Priority: default. Default priority for new issues, to be replaced given sufficient information. T: enhancement Type: enhancement. A new feature that does not yet exist or improvement of existing functionality.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants