mbox series

[ndctl,v3,00/11] Policy based reconfiguration for daxctl

Message ID 20211210223440.3946603-1-vishal.l.verma@intel.com (mailing list archive)
Headers show
Series Policy based reconfiguration for daxctl | expand

Message

Verma, Vishal L Dec. 10, 2021, 10:34 p.m. UTC
Changes since v2[1]:
- Remove stale Link: trailers from commit messages (Dan)
- Link to the iniparser library already packaged by distros instead of
  forking it (Dan).
- Improve commit message for "ndctl, util: add parse-configs helper"
  (Dan)
- Squash "util/parse-config: refactor filter_conf_files into util/" into
  the original patch it modifies since I'm modifying Qi's original
  patchset anyway
- Rename {ndctl,daxctl}_{get,set}_configs_dir to
  {ndctl,daxctl}_{get,set}_config_path (Dan)
- Replace {ndctl,daxctl}_ctx ** ctx with *ctx respectively, as the
  former is unnecessary. (Dan)
- Allow *_set_config_path() to return errors (Dan)
- Move {ndctl,daxctl}_set_config_path into {ndctl,daxctl}_new (Dan)
- Update config paths to {sysconfdir}/{ndctl,daxctl}.conf.d/  (Dan)
- Move the config_path scandir() call deeper in the stack so we don't
  have to store scandir results anywhere, and so that it is run just
  before the config parsing happens. This way the only thing that's
  stored in 'ctx' is the config_path itself, and lib{nd,dax}ctl are
  freed of having to link to GPL utils such as util/strbuf.  (Dan)


These patches add policy (config file) support to daxctl. The
introductory user is daxctl-reconfigure-device. Sysadmins may wish to
use daxctl devices as system-ram, but it may be cumbersome to automate
the reconfiguration step for every device upon boot.

Introduce a new option for daxctl-reconfigure-device, --check-config.
This is at the heart of policy based reconfiguration, as it allows
daxctl to look up reconfiguration parameters for a given device from the
config system instead of the command line.

Some systemd and udev glue then automates this for every new dax device
that shows up, providing a way for the administrator to simply list all
the 'system-ram' UUIDs in a config file, and not have to worry about
anything else.

An example config file can be:

  # cat /etc/daxctl.conf.d/daxctl.conf

  [reconfigure-device unique_identifier_foo]
  nvdimm.uuid = 48d8e42c-a2f0-4312-9e70-a837faafe862
  mode = system-ram
  online = true
  movable = false

Any file under '/etc/daxctl.conf.d/' can be used - all files with a
'.conf' suffix will be considered when looking for matches.

These patches depend on the initial config file support from Qi Fuli,
which is included here after some modifications from review feedback.

A branch containing these patches is available at [2].

[1]: https://lore.kernel.org/nvdimm/20211206222830.2266018-1-vishal.l.verma@intel.com/
[2]: https://github.com/pmem/ndctl/tree/vv/daxctl_config_v3


QI Fuli (4):
  ndctl, util: add parse-configs helper
  ndctl: make ndctl support configuration files
  ndctl, config: add the default ndctl configuration file
  ndctl, monitor: refator monitor for supporting multiple config files

Vishal Verma (7):
  ndctl: Update ndctl.spec.in for 'ndctl.conf'
  daxctl: Documentation updates for persistent reconfiguration
  daxctl: add basic config parsing support
  util/parse-configs: add a key/value search helper
  daxctl/device.c: add an option for getting params from a config file
  daxctl: add systemd service and udev rule for automatic
    reconfiguration
  daxctl: add and install an example config file

 .../daxctl/daxctl-reconfigure-device.txt      |  75 ++++++++
 Documentation/ndctl/ndctl-monitor.txt         |   8 +-
 configure.ac                                  |  22 ++-
 Makefile.am                                   |   2 +
 ndctl/lib/private.h                           |   1 +
 daxctl/lib/libdaxctl.c                        |  20 ++
 ndctl/lib/libndctl.c                          |  20 ++
 daxctl/libdaxctl.h                            |   2 +
 ndctl/libndctl.h                              |   2 +
 util/parse-configs.h                          |  53 ++++++
 daxctl/device.c                               | 174 +++++++++++++++++-
 ndctl/monitor.c                               |  73 ++++----
 util/parse-configs.c                          | 156 ++++++++++++++++
 Documentation/daxctl/Makefile.am              |  11 +-
 Documentation/ndctl/Makefile.am               |   2 +-
 daxctl/90-daxctl-device.rules                 |   1 +
 daxctl/Makefile.am                            |  14 +-
 daxctl/daxctl.example.conf                    |  27 +++
 daxctl/daxdev-reconfigure@.service            |   8 +
 daxctl/lib/Makefile.am                        |   6 +
 daxctl/lib/libdaxctl.sym                      |   2 +
 ndctl.spec.in                                 |   7 +-
 ndctl/Makefile.am                             |  11 +-
 ndctl/lib/Makefile.am                         |   6 +
 ndctl/lib/libndctl.sym                        |   2 +
 ndctl/ndctl.conf                              |  56 ++++++
 26 files changed, 710 insertions(+), 51 deletions(-)
 create mode 100644 util/parse-configs.h
 create mode 100644 util/parse-configs.c
 create mode 100644 daxctl/90-daxctl-device.rules
 create mode 100644 daxctl/daxctl.example.conf
 create mode 100644 daxctl/daxdev-reconfigure@.service
 create mode 100644 ndctl/ndctl.conf


base-commit: 4e646fa490ba4b782afa188dd8818b94c419924e