zdev: onboard --site option on zdev commands

In some high-availability setups, root and boot disks of a Linux
installation are copied to remote sites that can take over execution
of a Linux workload in case of an outage of the original site.
A site in this context is an execution environment such as an LPAR
or z/VM guest.

Each site may provide a different set of devices, or require different
parameters to be applied per device. chzdev supports site-specific
device configuration for up to 10 sites. Each site is identified by
a number in the range 0 to 9. You can provide a separate set of persistent
device configuration for each site. The IPL Load parameter value specified
during boot determines the currently active site. Only the device
configuration of the active site is applied during boot and when new
devices become available. A common configuration can be provided that is
applied when no site-specific configuration is available for a device in
the active site.

User can use the --site parameter to configure devices for a specific
site only. Configuration actions without a site parameter apply to the
common configuration.

During the boot, the active site configuration is chosed based on the
IPL LOADPARM variable. If the LOADPARM contains no valid site-id (0 to 9),
the fallback-site id will be used. The fallback-site-id can also be
configured with the zdev tools by not specifying the --site parameter.

Some of the new chzdev/lszdev commands with site-parameter can be as
follows

1. chzdev -ep f001 --site 3

This command is used to configure the device f001 for the site 3. During
boot, if the LOADPARM value is S3, this device configuration will be
used.

2. lszdev --site 3

This command lists all the devices which are configured for site 3.

3. chzdev -ep f001

Above command does not have a --site parameter. This device settings
will be used for the following conditions

1. When the loadparm specifies a site, (e.g S3), and the device does not
   have an associated config-set, zdev uses fallback config set.
2. When the loadparm does not specify any site information, then the
   fallback config set will be used.

When the loadparm specifies a site, and the device does not have an
associated config set, nor a fallback site, nothing is configured for this
device.

Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Vineeth Vijayan <vneethv@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Vineeth Vijayan
2022-09-11 09:32:19 +02:00
committed by Jan Höppner
parent b3551f50a8
commit 198c9fc052
9 changed files with 145 additions and 5 deletions

View File

@@ -19,6 +19,20 @@
struct subtype;
struct setting_list;
/**
* Currently zdev supports 10 sites. Which means, zdev support 10 different
* set of attributes which are specific to each site. When the user does
* not provide any site information, the common set will be used which is
* not specific to any site. So, total we have 11 persistent attribute sets
* Where,
* 0- 9: Site specific attributes
* 10: Common attributes which do not belong to any sites
*/
#define NUM_SITES 11
#define NUM_USER_SITES (NUM_SITES - 1)
#define SITE_FALLBACK NUM_USER_SITES
/**
* struct device_state - Represent the state of a device in a configuration
* @settings: List of attribute settings

View File

@@ -38,6 +38,7 @@ extern struct devtype *devtypes[];
* devtypes with empty title will not be shown with --list-types.
* @devname: Short name for devices of this device type
* @modules: (Optional) Array of kernel modules required for this devtype
* @site_support: Support for site-specific configuration for the device-type
* @subtypes: Array of subtypes
* @type_attribs: Array of device type attributes (may point to empty array)
* @unknown_type_attribs: Allow specification of unknown device type attributes
@@ -59,6 +60,7 @@ struct devtype {
const char title[DEVTYPE_TITLE_LEN + 1];
const char *devname;
const char **modules;
unsigned int site_support:1;
struct subtype **subtypes;
struct attrib **type_attribs;

View File

@@ -103,6 +103,8 @@ extern int delayed_warnings;
extern unsigned long longrun_total;
extern unsigned long longrun_current;
extern int global_site_id;
void misc_exit(void);
void indent(unsigned int, const char *, ...);
void error(const char *, ...);
@@ -239,6 +241,7 @@ void longrun_stop(void);
char *skip_comp(char *);
void byte_swap(uint8_t *, unsigned int *, unsigned);
bool valid_hex(const char *);
bool is_valid_site(const char *);
void debug_init(int, char **);
#endif /* MISC_H */