zdev: Add option to select IPL device

Add new command-line option --ipldev. When specified and IPL was done
from a supported device type, the IPL device is selected for the
requested tool operation.

Example to list IPL device information:

$ lszdev --ipldev

Example to create a persistent configuration for the IPL device:

$ chzdev --enable --persistent --ipldev

Reviewed-by: Vineeth Vijayan <vneethv@linux.ibm.com>
Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Peter Oberparleiter
2024-07-04 16:10:17 +02:00
committed by Jan Höppner
parent cad4e9e15b
commit d9a9bd8dcf
14 changed files with 158 additions and 5 deletions

View File

@@ -69,7 +69,8 @@ bool select_opts_dev_specified(struct select_opts *select)
!util_list_is_empty(&select->by_if) ||
!util_list_is_empty(&select->by_attr) ||
select->all || select->configured || select->existing ||
select->online || select->offline || select->failed)
select->online || select->offline || select->failed ||
select->ipldev)
return true;
return false;
@@ -1207,6 +1208,19 @@ out:
return rc;
}
/* Select device that was used for IPL. */
static void select_ipldev(struct util_list *selected)
{
struct subtype *st;
char *id;
if (!subtypes_find_ipldev(&st, &id))
return;
selected_dev_list_add(selected, st->devtype, st, id, NULL, 0);
free(id);
}
/* Determine list of IDs of selected devices based on selection options.
* Results are stored as list of struct selected_dev_node in SELECTED.
* If @existing is set, only return nodes for existing devices.
@@ -1235,7 +1249,7 @@ exit_code_t select_devices(struct select_opts *select,
!(util_list_is_empty(&select->by_path) &&
util_list_is_empty(&select->by_node) &&
util_list_is_empty(&select->by_if) &&
util_list_is_empty(&select->by_attr)))
util_list_is_empty(&select->by_attr) && !select->ipldev))
goto by_function;
/* Convert device ID specifications to enable tracking of specifications
@@ -1291,6 +1305,9 @@ by_function:
goto out;
}
if (select->ipldev)
select_ipldev(selected);
out:
/* Release device ID specifications tracking list. */
ptrlist_free(specs, 1);