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
lvm: cleanups #93024
Merged
Merged
lvm: cleanups #93024
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
2d2b751
lvm2: remove unused default.upstream file
flokli 5e1eb7b
lvm2: cleanups, make udev optional
flokli 33030f1
lvm2: add myself as maintainer
ajs124 fbe7027
lvm2: fetch sources from http instead of git
flokli 3ca74a9
lvm2: 2.03.01 -> 2.03.09
ajs124 198d1e6
lvm2: make --enable-cmdlib optional
flokli df67459
lvm2: don't embed ./configure line in lvm2 binary
flokli d3a991d
lvm2: add multiple output support
flokli e6a6846
lvm2: fix paths to use /run instead of /var/run.
ajs124 b812931
lvm2: fix location to systemd-run invocation
flokli 9f83907
lvm2: only split bin and lib out from out if cmdlib isn't enabled
flokli 1a1e723
nixos/tasks/lvm: add dmeventd and lvmthin support
ajs124 e55ef86
systemd_with_lvm2: remove
flokli d056f6e
nixos/test/installer: add postBootCommands
ajs124 53a3436
nixos/tests/installer: lvm: test lvm2-pvscan@ units
ajs124 12d32ee
lvm2: rename enable_{cmdlib,dmeventd} to enable{Cmdlib,Dmeventd}
flokli 9583669
lvm2: passthru tests
flokli File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,70 @@ | ||
{ config, lib, pkgs, ... }: | ||
|
||
with lib; | ||
let | ||
cfg = config.services.lvm; | ||
in { | ||
options.services.lvm = { | ||
package = mkOption { | ||
type = types.package; | ||
default = if cfg.dmeventd.enable then pkgs.lvm2_dmeventd else pkgs.lvm2; | ||
internal = true; | ||
defaultText = "pkgs.lvm2"; | ||
description = '' | ||
This option allows you to override the LVM package that's used on the system | ||
(udev rules, tmpfiles, systemd services). | ||
Defaults to pkgs.lvm2, or pkgs.lvm2_dmeventd if dmeventd is enabled. | ||
''; | ||
}; | ||
dmeventd.enable = mkEnableOption "the LVM dmevent daemon"; | ||
boot.thin.enable = mkEnableOption "support for booting from ThinLVs"; | ||
}; | ||
|
||
{ | ||
|
||
###### implementation | ||
config = mkMerge [ | ||
(mkIf (!config.boot.isContainer) { | ||
environment.etc."tmpfiles.d/lvm2.conf".source = "${cfg.package}/lib/tmpfiles.d/lvm2.conf"; | ||
environment.systemPackages = [ cfg.package ]; | ||
systemd.packages = [ cfg.package ]; | ||
|
||
config = mkIf (!config.boot.isContainer) { | ||
# TODO: update once https://github.com/NixOS/nixpkgs/pull/93006 was merged | ||
services.udev.packages = [ cfg.package.out ]; | ||
}) | ||
(mkIf cfg.dmeventd.enable { | ||
systemd.sockets."dm-event".wantedBy = [ "sockets.target" ]; | ||
systemd.services."lvm2-monitor".wantedBy = [ "sysinit.target" ]; | ||
|
||
environment.systemPackages = [ pkgs.lvm2 ]; | ||
environment.etc."lvm/lvm.conf".text = '' | ||
dmeventd/executable = "${cfg.package}/bin/dmeventd" | ||
''; | ||
}) | ||
(mkIf cfg.boot.thin.enable { | ||
boot.initrd = { | ||
kernelModules = [ "dm-snapshot" "dm-thin-pool" ]; | ||
|
||
services.udev.packages = [ pkgs.lvm2 ]; | ||
extraUtilsCommands = '' | ||
copy_bin_and_libs ${pkgs.thin-provisioning-tools}/bin/pdata_tools | ||
copy_bin_and_libs ${pkgs.thin-provisioning-tools}/bin/thin_check | ||
''; | ||
}; | ||
|
||
}; | ||
environment.etc."lvm/lvm.conf".text = '' | ||
global/thin_check_executable = "${pkgs.thin-provisioning-tools}/bin/thin_check" | ||
''; | ||
}) | ||
(mkIf (cfg.dmeventd.enable || cfg.boot.thin.enable) { | ||
boot.initrd.preLVMCommands = '' | ||
mkdir -p /etc/lvm | ||
cat << EOF >> /etc/lvm/lvm.conf | ||
${optionalString cfg.boot.thin.enable '' | ||
global/thin_check_executable = "$(command -v thin_check)" | ||
''} | ||
${optionalString cfg.dmeventd.enable '' | ||
dmeventd/executable = "$(command -v false)" | ||
activation/monitoring = 0 | ||
''} | ||
EOF | ||
''; | ||
}) | ||
]; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a comment why the sleep is necessary here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's already in the commit message.
Also, it's not really "needed".
There's some racyness causing some waiting every now and then, and I at least felt like this will make it less likely to trigger. The test still succeeds, it's just less likely to take longer.