mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
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>
113 lines
3.6 KiB
C
113 lines
3.6 KiB
C
/*
|
|
* zdev - Modify and display the persistent configuration of devices
|
|
*
|
|
* Copyright IBM Corp. 2016, 2017
|
|
*
|
|
* s390-tools is free software; you can redistribute it and/or modify
|
|
* it under the terms of the MIT license. See LICENSE for details.
|
|
*/
|
|
|
|
#ifndef DEVTYPE_H
|
|
#define DEVTYPE_H
|
|
|
|
#include <stddef.h>
|
|
|
|
#include "exit_code.h"
|
|
#include "misc.h"
|
|
|
|
#define DEVTYPE_TITLE_LEN 60
|
|
|
|
struct devtype;
|
|
struct device;
|
|
struct devnode;
|
|
struct namespace;
|
|
struct selected_dev_node;
|
|
struct subtype;
|
|
struct util_list;
|
|
|
|
/* NULL-terminated list of device types. */
|
|
extern struct devtype *devtypes[];
|
|
|
|
/* Define a NULL-terminated list of struct subtypes */
|
|
#define SUBTYPE_ARRAY(...) ((struct subtype *[]) { __VA_ARGS__ NULL })
|
|
|
|
/**
|
|
* struct devtype - Definition of a device type
|
|
* @name: Short name of this device type
|
|
* @title: Short description of this device type (max. 60 characters).
|
|
* 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
|
|
* @processed: Set if device type has already been processed
|
|
*
|
|
* @active_settings: Device type settings from the active configuration
|
|
* @persistent_settings: Device type settings from the persistent configuration
|
|
* @active_exists: Devtype configuration exists in active configuration
|
|
* @persistent_exists: Devtype configuration exists in persistent configuration
|
|
*
|
|
* @init: Initialize device type
|
|
* @exit: Release dynamically allocated resources associated with this type
|
|
* @read_settings: Retrieve device type settings from specified configuration
|
|
* @write_settings: Apply device type settings to specified configuration
|
|
*/
|
|
struct devtype {
|
|
/* Static data */
|
|
const char *name;
|
|
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;
|
|
unsigned int unknown_type_attribs:1;
|
|
|
|
/* Dynamic data */
|
|
struct setting_list *active_settings;
|
|
struct setting_list *persistent_settings;
|
|
unsigned int active_exists:1;
|
|
unsigned int persistent_exists:1;
|
|
unsigned int processed:1;
|
|
|
|
/* Methods */
|
|
void (*init)(struct devtype *);
|
|
void (*exit)(struct devtype *);
|
|
|
|
/* Devtype settings. */
|
|
exit_code_t (*read_settings)(struct devtype *, config_t);
|
|
exit_code_t (*write_settings)(struct devtype *, config_t);
|
|
};
|
|
|
|
void devtypes_init(void);
|
|
void devtypes_exit(void);
|
|
|
|
void devtype_print(struct devtype *, int);
|
|
|
|
struct devtype *devtype_find(const char *);
|
|
struct attrib *devtype_find_type_attrib(struct devtype *, const char *);
|
|
struct attrib *devtype_find_dev_attrib(struct devtype *, const char *);
|
|
|
|
exit_code_t devtype_apply_settings(struct devtype *, config_t,
|
|
struct util_list *);
|
|
exit_code_t devtype_apply_strlist(struct devtype *, config_t,
|
|
struct util_list *);
|
|
|
|
bool devtype_is_id_valid(struct devtype *, const char *);
|
|
bool devtype_is_id_range_valid(struct devtype *, const char *);
|
|
bool devtype_needs_writing(struct devtype *, config_t);
|
|
|
|
void devtype_add_modules(struct util_list *, struct devtype *, int);
|
|
bool devtype_is_module_loaded(struct devtype *);
|
|
int devtype_count_namespaces(struct devtype *);
|
|
int devtype_count_subtypes(struct devtype *);
|
|
|
|
struct namespace *devtype_most_similar_namespace(struct devtype *,
|
|
struct subtype *,
|
|
const char *id);
|
|
|
|
#endif /* DEVTYPE_H */
|