zdev: Write zfcp-lun udev rules to separate files

Change chzdev's udev rule generation from the previous approach of
combining all zfcp-lun udev rules associated with an FCP device into a
single file to storing zfcp-lun udev rules in one file per zfcp-lun.
This is done to enable per-device udev rule masking.

With udev rule masking, if a udev rule file by the same name exists in
both /etc and /run, the udev daemon will only consider the rules found
in /etc.

The auto-configuration feature will make use of per-device udev rule
masking to introduce a new class of configuration data (stored in /run)
that is only active if no user-provided configuration data (in /etc)
exists.

In addition, change chzdev to allow the regeneration of udev rules by
using the --force command line like in the following example:

 # chzdev zfcp-lun --configured --enable --persistent --force

This can be used to convert all existing zfcp-lun udev rules from the
old format to the new one.

Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Peter Oberparleiter
2017-09-01 11:05:54 +02:00
committed by Jan Höppner
parent f32bff9688
commit a86fb8b091
3 changed files with 55 additions and 9 deletions

View File

@@ -1333,7 +1333,7 @@ static exit_code_t cfg_write(struct device *dev, int prereq, config_t config,
struct subtype *st = dev->subtype;
exit_code_t rc = EXIT_OK;
if (!device_needs_writing(dev, config))
if (!device_needs_writing(dev, config) && !force)
goto out;
if (check_active && config == config_persistent &&
@@ -1624,6 +1624,10 @@ static exit_code_t print_config_result(struct selected_dev_node *sel,
already = device_needs_writing(dev, config) ? 0 : 1;
}
/* Re-do actions if run with --force */
if (force)
already = 0;
if (dev) {
devname = dev->subtype->devname;
devid = dev->id;