mbox series

[ndctl,0/7] Policy based reconfiguration for daxctl

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

Message

Verma, Vishal L Aug. 31, 2021, 9:04 a.m. UTC
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/ndctl/daxctl.conf

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

Any file under '/etc/ndctl/' 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[1].
A branch containing these patches is available at [2].

[1]: https://lore.kernel.org/nvdimm/20210824095106.104808-1-qi.fuli@fujitsu.com/
[2]: https://github.com/pmem/ndctl/tree/vv/daxctl_config

Vishal Verma (7):
  ndctl: Update ndctl.spec.in for 'ndctl.conf'
  daxctl: Documentation updates for persistent reconfiguration
  util/parse-config: refactor filter_conf_files into util/
  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 auto-onlining

 .../daxctl/daxctl-reconfigure-device.txt      |  67 +++++++++
 configure.ac                                  |   9 +-
 daxctl/lib/libdaxctl.c                        |  37 +++++
 ndctl/lib/libndctl.c                          |  19 +--
 daxctl/libdaxctl.h                            |   2 +
 util/parse-configs.h                          |  19 +++
 daxctl/daxctl.c                               |   1 +
 daxctl/device.c                               | 141 +++++++++++++++++-
 util/parse-configs.c                          |  67 +++++++++
 daxctl/90-daxctl-device.rules                 |   1 +
 daxctl/Makefile.am                            |  12 ++
 daxctl/daxdev-auto-reconfigure.sh             |   3 +
 daxctl/daxdev-reconfigure@.service            |   8 +
 daxctl/lib/Makefile.am                        |   6 +
 daxctl/lib/libdaxctl.sym                      |   2 +
 ndctl.spec.in                                 |   4 +
 ndctl/lib/Makefile.am                         |   2 +
 17 files changed, 381 insertions(+), 19 deletions(-)
 create mode 100644 daxctl/90-daxctl-device.rules
 create mode 100755 daxctl/daxdev-auto-reconfigure.sh
 create mode 100644 daxctl/daxdev-reconfigure@.service


base-commit: 5f1026ef3ad108f3f5aa889ef15edae92cb5de43

Comments

Dan Williams Sept. 16, 2021, 10:12 p.m. UTC | #1
On Tue, Aug 31, 2021 at 2:05 AM Vishal Verma <vishal.l.verma@intel.com> wrote:
>
> 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/ndctl/daxctl.conf

Take these comments as provisional until I read through the rest, but
this is just a reaction to the proposed ini format.

>
>   [auto-online unique_identifier_foo]

I am thinking this section name should be "reconfigure-device
unique_identifier_foo" if only because resize might also be something
someone wants to do, and if other commands get config automation it
makes it clearer which config snippets apply to which command.

>   uuid = 48d8e42c-a2f0-4312-9e70-a837faafe862

I think this should be called:

"nvdimm.uuid"

...or something like that to make it clear this depends on dax devices
emitted by libnvdimm, and not those that come from "soft-reserved"
memory. It also helps distinguish if we ever get UUIDs in the HMAT
which is something I have been meaning to propose.

>   mode = system-ram

I can see this being "mode = devdax" if feature was being used to
change size or alignment.

>   online = true
>   movable = false

I wonder if these keys should be prefixed by the mode name:

system-ram.online = true
system-ram.movable = false

...so it's a bit more self documenting about which parameters are
sub-options, and delineates them from generic options like size.

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

any concern about name collisions between ndctl, daxctl, and cxl-cli
section names?
Verma, Vishal L Nov. 19, 2021, 8:57 p.m. UTC | #2
On Thu, 2021-09-16 at 15:12 -0700, Dan Williams wrote:
> On Tue, Aug 31, 2021 at 2:05 AM Vishal Verma <vishal.l.verma@intel.com> wrote:
> > 
> > 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/ndctl/daxctl.conf
> 
> Take these comments as provisional until I read through the rest, but
> this is just a reaction to the proposed ini format.

I somehow missed this email originally, and just saw it on lore..

> > 
> >   [auto-online unique_identifier_foo]
> 
> I am thinking this section name should be "reconfigure-device
> unique_identifier_foo" if only because resize might also be something
> someone wants to do, and if other commands get config automation it
> makes it clearer which config snippets apply to which command.

Yep that makes sense - I'll change this.
> 
> >   uuid = 48d8e42c-a2f0-4312-9e70-a837faafe862
> 
> I think this should be called:
> 
> "nvdimm.uuid"
> 
> ...or something like that to make it clear this depends on dax devices
> emitted by libnvdimm, and not those that come from "soft-reserved"
> memory. It also helps distinguish if we ever get UUIDs in the HMAT
> which is something I have been meaning to propose.

Yep makes sense, will change.

> >   mode = system-ram
> 
> I can see this being "mode = devdax" if feature was being used to
> change size or alignment.

Agreed, but that should 'just work' right - especially once we rename
the section name from auto-online to reconfigure-device.

> 
> >   online = true
> >   movable = false
> 
> I wonder if these keys should be prefixed by the mode name:
> 
> system-ram.online = true
> system-ram.movable = false

Hm, maybe, but since the config options feed directly into the commands
params, I figured we can let the command's option parsing throw any
errors for incompatible options. My hope was for config identifiers to
- as far as possible - exactly match command-line options. If we do
make changes like this, I feel for every command that supports config,
the man page is asking for a dedicated config section documenting every
config option it supports. Maybe this is a good idea regardless :)

> 
> ...so it's a bit more self documenting about which parameters are
> sub-options, and delineates them from generic options like size.
> 
> > Any file under '/etc/ndctl/' can be used - all files with a '.conf' suffix
> > will be considered when looking for matches.
> 
> any concern about name collisions between ndctl, daxctl, and cxl-cli
> section names?

Yep good point, changed this to be in /etc/daxctl/, and cxl-cli can get
its own directory too when the time comes.