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

ZFS: Adding ZED configuration options #64306

Closed
wants to merge 13 commits into from
Closed

ZFS: Adding ZED configuration options #64306

wants to merge 13 commits into from

Conversation

sjau
Copy link

@sjau sjau commented Jul 4, 2019

Motivation for this change

The ZFS Events Daemon (ZED) offer notifications upon zpool events like errors on scrubbing, failing disks and more (if desired). Enabling/altering those options in the configuration.nix helps to lessen the administrative tasks of regularly checking the status of the zpools.

Most of the options that are configurable in the '/etc/zfs/zed.d/zed.rc' file can be configured now through the configuration.nix. A few options, like changing the lock folder, were left alone as the use of those doesn't seem to be widespread.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

# matching subclasses are excluded from logging.
#ZED_SYSLOG_SUBCLASS_INCLUDE="checksum|scrub_*|vdev.*"
#ZED_SYSLOG_SUBCLASS_EXCLUDE="statechange|config_*|history_event"
''
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to see this as a more general option as an abstraction, something like

{
  options.services.zfs.zed.settings = mkOption {
    type = with types; attrsOf (nullOr (either str (either int bool)));
    # ...
  };
}

, leaning towards NixOS/rfcs#42, then people can override these settings and add ones not supported by the module.

Then you can move these definitions into the config section of the module like this:

{
  services.zfs.zed.settings = {
    ZED_DEBUG_LOG = mkDefault cfgZED.debugLog;
    ZED_EMAIL_ADDR = mkDefault (concatStringsSep " " cfgZED.email.addresses);
    # ...
  };
}

And the config file gets generated only from this settings option (where null values mean that it won't get set, which simplifies things and makes sense).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't resolved

email.program = mkOption {
type = types.nullOr types.str;
default = null;
example = "mail";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might make sense to use pkgs.system-sendmail by default here.

Also need to make sure ZED can get access to these executables through PATH (if using a non-path executable). Should maybe be noted in the description or supported somehow.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How to use pkgs.system-sendmail here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like default = "${pkgs.system-sendmail}/bin/sendmail"

nixos/modules/tasks/filesystems/zfs.nix Show resolved Hide resolved
nixos/modules/tasks/filesystems/zfs.nix Outdated Show resolved Hide resolved
nixos/modules/tasks/filesystems/zfs.nix Outdated Show resolved Hide resolved
nixos/modules/tasks/filesystems/zfs.nix Outdated Show resolved Hide resolved
};

email.options = mkOption {
type = types.str;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

types.listOf types.str is nicer for a list of commandline arguments.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But they need to be in a given order according to the mail program being used. So I think types.listOf types.str is less usefull in this case.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually command line tools don't care about the order of options, and listOf str keeps everything in order anyways, it just concatenates all assignments together. Also it can deal with escaping properly, which might be very important here since this will be used by data received from arbitrary mail subjects and such.

@@ -89,6 +91,202 @@ let
}
'';

zedConf = concatStrings [ ''
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This value is never used as of now

@sjau sjau closed this Aug 9, 2019
@infinisil
Copy link
Member

Why close it?

@sjau
Copy link
Author

sjau commented Aug 9, 2019

Why not close it? There's no point in pursuing this anymore.

@infinisil
Copy link
Member

Well if you don't want to do the suggested changes then sure, but there's no inherent reason this would have to be closed

@sjau
Copy link
Author

sjau commented Aug 9, 2019

Well if you don't want to do the suggested changes then sure

There lies the whole problem. You call them suggested meaning there's an option to accept them or not but in reality there is no such option. So there's no point in pursuing this any further.

@infinisil
Copy link
Member

Sorry but as a reviewer of PR's it's my job to ensure quality code, and that's especially important for modules. I'm willing to discuss the suggestions if you don't think they're justified, but ultimately I am the one who would have to merge this and therefore be responsible for having this code in nixpkgs

@sjau sjau deleted the zfs_zed branch September 20, 2019 09:32
@nyanloutre nyanloutre mentioned this pull request Nov 3, 2019
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants