5. Reference: Resources
This section describes the resource model supported by the zhmcclient package.
Note that the zhmcclient package supports only a subset of the resources described in the HMC API book. We will grow the implemented subset over time, and if you find that a particular resource you need is missing, please open an issue in the zhmcclient issue tracker.
See Resource model concepts for a description of the concepts used in representing the resource model.
The resource descriptions in this section do not detail the resource properties. The description of the resource properties of a particular HMC resource type can be found in its “Data model” section in the HMC API book. Each Python resource class mentions the corresponding HMC resource type.
The data types used in these “Data model” sections are represented in Python data types according to the mapping shown in the following table:
HMC API data type |
Python data type |
---|---|
Boolean |
|
Byte, Integer, Long, Short |
|
Float |
|
String, String Enum |
|
Array |
|
Object |
5.1. CPCs
A CPC (Central Processor Complex) is a physical IBM Z or LinuxONE computer.
A particular HMC can manage multiple CPCs and can discover other CPCs that are not managed by that HMC. Such other CPCs are called “unmanaged CPCs” and they may or may not be managed by another HMC.
This section describes the interface for managed CPCs using resource class
Cpc
and the corresponding manager class
CpcManager
.
The HMC can manage a range of old and new CPC generations. Some older CPC generations are not capable of supporting the HMC Web Services API; these older CPCs can be managed using the GUI of the HMC, but not through its Web Services API. Therefore, such older CPCs will not be exposed at the HMC Web Services API, and thus will not show up in the API of this Python package.
TODO: List earliest CPC generation that supports the HMC Web Services API.
A CPC can be in any of the following three modes:
DPM mode: Dynamic Partition Manager is enabled for the CPC.
Classic mode: The CPC does not have Dynamic Partition Manager enabled, and is not member of an ensemble.
Ensemble mode: The CPC is member of an ensemble. This Python client does not support the functionality that is specific to ensemble mode.
The functionality supported at the HMC API and thus also for users of this Python client, depends on the mode in which the CPC currently is. If a particular functionality is available only in a specific mode, that is indicated in the description of the functionality.
- class zhmcclient.CpcManager(client)[source]
Manager providing access to the managed CPCs exposed by the HMC this client is connected to.
Derived from
BaseManager
; see there for common methods and attributes.Objects of this class are not directly created by the user; they are accessible via the following instance variable of a
Client
object:Attributes:
Client
: The client defining the scope for this manager.Console
: The Console representing the HMC this CPC is managed by.case_insensitive_names
bool
: Indicates whether the names of the resources are treated case insensitively.class_name
The resource class name
parent
Subclass of
BaseResource
: Parent resource defining the scope for this manager.resource_class
The Python class of the parent resource of this manager.
session
Session
: Session with the HMC.Methods:
list
([full_properties, filter_args])List the CPCs managed by the HMC this client is connected to.
__repr__
()Return a string with the state of this manager object, for debug purposes.
dump
()Dump the resources of this resource manager as a resource definition.
find
(**filter_args)Find exactly one resource in scope of this manager, by matching resource properties against the specified filter arguments, and return its Python resource object (e.g.
find_by_name
(name)Find a resource by name (i.e.
find_local
(name, uri[, properties])Return a local resource object without fetching it from the HMC.
findall
(**filter_args)Find zero or more resources in scope of this manager, by matching resource properties against the specified filter arguments, and return a list of their Python resource objects (e.g.
flush
()Invalidate the Name-URI cache of this manager.
invalidate_cache
()Invalidate the Name-URI cache of this manager.
resource_object
(uri_or_oid[, props])Return a minimalistic Python resource object for this resource class, that is scoped to this manager.
- property console
Console
: The Console representing the HMC this CPC is managed by.The returned object is cached, so it is looked up only upon first access to this property.
The returned object has only the following properties set:
‘object-uri’
Use
get_property()
orprop()
to access any properties regardless of whether they are already set or first need to be retrieved.
- list(full_properties=False, filter_args=None)[source]
List the CPCs managed by the HMC this client is connected to.
Authorization requirements:
Object-access permission to any CPC to be included in the result.
- Parameters:
full_properties (bool) – Controls whether the full set of resource properties should be retrieved, vs. only the short set as returned by the list operation.
filter_args (dict) –
Filter arguments that narrow the list of returned resources to those that match the specified filter arguments. For details, see Filtering.
None causes no filtering to happen, i.e. all resources are returned.
- Returns:
A list of
Cpc
objects.- Raises:
- class zhmcclient.Cpc(manager, uri, name=None, properties=None)[source]
Representation of a managed CPC.
Derived from
BaseResource
; see there for common methods and attributes.Objects of this class are not directly created by the user; they are returned from creation or list functions on their manager object (in this case,
CpcManager
).Attributes:
Access to the LPARs in this CPC.
Access to the Partitions in this CPC.
Access to the Adapters in this CPC.
Access to the Virtual Switches in this CPC.
Access to the Capacity Groups in this CPC.
Access to the Virtual Switches in this CPC.
Access to the Reset Activation Profiles in this CPC.
Access to the Image Activation Profiles in this CPC.
Access to the Load Activation Profiles in this CPC.
Indicates whether this CPC is currently in DPM mode (Dynamic Partition Manager mode).
The maximum number of partitions of this CPC.
ceased_existence
Indicates that the corresponding object on the HMC no longer exists, if auto-update is enabled for the resource.
full_properties
A boolean indicating whether or not the resource properties in this object are the full set of resource properties.
manager
Subclass of
BaseManager
: Manager object for this resource (and for all resources of the same type in the scope of that manager).name
The name of the resource.
properties
The properties of this resource that are currently present in this Python object, as a dictionary.
properties_timestamp
The point in time of the last update of the resource properties cached in this object, as Unix time (an integer that is the number of seconds since the Unix epoch).
uri
The canonical URI path of the resource.
Methods:
dump
()Dump this Cpc resource with its properties and child resources (recursively) as a resource definition.
feature_enabled
(feature_name)Indicates whether the specified feature is enabled for this CPC.
Returns information about the features available for this CPC.
update_properties
(properties)Update writeable properties of this CPC.
start
([wait_for_completion, operation_timeout])Start this CPC, using the HMC operation "Start CPC".
stop
([wait_for_completion, operation_timeout])Stop this DPM-mode CPC, using the HMC operation "Stop CPC".
activate
(activation_profile_name[, force, ...])Activate this classic-mode CPC, using the HMC operation "Activate CPC".
deactivate
([force, wait_for_completion, ...])Deactivate this CPC, using the HMC operation "Deactivate CPC".
import_profiles
(profile_area[, ...])Import activation profiles and/or system activity profiles for this CPC from the SE hard drive into the CPC using the HMC operation "Import Profiles".
export_profiles
(profile_area[, ...])Export activation profiles and/or system activity profiles from this CPC to the SE hard drive using the HMC operation "Export Profiles".
get_wwpns
(partitions)Return the WWPNs of the host ports (of the HBAs) of the specified Partitions of this CPC.
get_free_crypto_domains
([crypto_adapters])Return a list of crypto domains that are free for usage on a list of crypto adapters in this CPC.
set_power_save
(power_saving[, ...])Set the power save setting of this CPC.
set_power_capping
(power_capping_state[, ...])Set the power capping settings of this CPC.
Return the energy management properties of the CPC.
Return the storage groups that are associated to this CPC.
validate_lun_path
(host_wwpn, host_port, ...)Validate if an FCP storage volume on an actual storage subsystem is reachable from this CPC, through a specified host port and using a specified host WWPN.
add_temporary_capacity
(record_id[, ...])Add temporary processors to the CPC or increase temporary model capacity of the CPC.
remove_temporary_capacity
(record_id[, ...])Remove temporary processors from the CPC or decrease temporary model capacity of the CPC.
set_auto_start_list
(auto_start_list)Set the auto-start list of partitions for this CPC.
import_dpm_configuration
(dpm_configuration)Import a DPM configuration into this CPC.
export_dpm_configuration
([...])Export a DPM configuration from this CPC and return it.
__repr__
()Return a string with the state of this resource, for debug purposes.
__str__
()Return a human readable string representation of this resource.
auto_update_enabled
()Return whether auto-update is currently enabled for the resource object.
cease_existence_local
()Update this Python object to indicate that the corresponding HMC object no longer exists.
disable_auto_update
()Disable auto-update for this resource object, if currently enabled.
enable_auto_update
()Enable auto-update for this resource object, if currently disabled.
get_properties_local
(names[, defaults])Return the values of a set of resource properties, using default values for those that are not present in this Python object, without retrieving them from the HMC.
get_property
(name)Return the value of a resource property.
prop
(name[, default])Return the value of a resource property, applying a default if it does not exist.
pull_full_properties
()Retrieve the full set of resource properties and cache them in this object.
update_properties_local
(properties)Update the values of a set of resource properties on this Python object without propagating the updates the HMC.
- property partitions
Access to the Partitions in this CPC.
- Type:
- property virtual_switches
Access to the Virtual Switches in this CPC.
- Type:
- property capacity_groups
Access to the Capacity Groups in this CPC.
- Type:
- property vswitches
Access to the Virtual Switches in this CPC.
Deprecated: This attribute is deprecated and using it will cause a
DeprecationWarning
to be issued. Usevirtual_switches
instead.- Type:
- property reset_activation_profiles
Access to the Reset Activation Profiles in this CPC.
- Type:
- property image_activation_profiles
Access to the Image Activation Profiles in this CPC.
- Type:
- property load_activation_profiles
Access to the Load Activation Profiles in this CPC.
- Type:
- property dpm_enabled
Indicates whether this CPC is currently in DPM mode (Dynamic Partition Manager mode).
If the CPC is not currently in DPM mode, or if the CPC does not support DPM mode (i.e. before z13), False is returned.
Authorization requirements:
Object-access permission to this CPC.
- Raises:
- Type:
- property maximum_active_partitions
The maximum number of partitions of this CPC.
For CPCs in DPM mode, the number indicates the maximum number of partitions. For CPCs in classic mode, the number indicates the maximum number of logical partitions (LPARs) that can be active at the same time.
The following table shows the maximum number of partitions by machine generation:
Machine generation
Maximum partitions
z196
60
z114
30
zEC12
60
zBC12
30
z13 / Emperor
85
z13s / Rockhopper
40
z14 / Emperor II
85
z14-ZR1 / Rockhopper II
40
z15-T01 / LinuxOne III (-LT1)
85
z15-T02 / LinuxOne III (-LT2)
40
z15-GT2
85
z16-A01
85
- Raises:
ValueError – Unknown machine type
- Type:
Integer
- dump()[source]
Dump this Cpc resource with its properties and child resources (recursively) as a resource definition.
The returned resource definition has the following format:
{ # Resource properties: "properties": {...}, # Child resources for any CPC mode: "capacity_groups": [...], # Child resources for DPM mode: "partitions": [...], "adapters": [...], "virtual_switches": [...], # Child resources for classic mode: "lpars": [...], # Faked Lpar children "reset_activation_profiles": [...], "image_activation_profiles": [...], "load_activation_profiles": [...], }
- Returns:
Resource definition of this resource.
- Return type:
- feature_enabled(feature_name)[source]
Indicates whether the specified feature is enabled for this CPC.
The HMC must generally support features, and the specified feature must be available for the CPC.
For a list of available features, see section “Features” in the HMC API, or use the
feature_info()
method.Authorization requirements:
Object-access permission to this CPC.
- Parameters:
feature_name (string) – The name of the feature.
- Returns:
True if the feature is enabled, or False if the feature is disabled (but available).
- Return type:
- Raises:
ValueError – Features are not supported on the HMC.
ValueError – The specified feature is not available for the CPC.
- feature_info()[source]
Returns information about the features available for this CPC.
Authorization requirements:
Object-access permission to this CPC.
- Returns:
An iterable where each item represents one feature that is available for this CPC.
Each item is a dictionary with the following items:
name (unicode string): Name of the feature.
description (unicode string): Short description of the feature.
state (bool): Enablement state of the feature (True if the enabled, False if disabled).
- Return type:
- Raises:
ValueError – Features are not supported on the HMC.
- update_properties(properties)[source]
Update writeable properties of this CPC.
This method serializes with other methods that access or change properties on the same Python object.
Authorization requirements:
Object-access permission to this CPC.
Task permission for the “CPC Details” task.
- start(wait_for_completion=True, operation_timeout=None)[source]
Start this CPC, using the HMC operation “Start CPC”.
This operation performs an orderly start of the CPC, including:
Turning CPC power on.
Performing a power-on reset, this includes allocating system resources to the CPC.
Starting partitions that are in the auto-start list of the CPC.
The CPC must be set for DPM operational mode (i.e. its ‘dpm-enabled’ property is True) and must currently be inactive.
Authorization requirements:
Object-access permission to this CPC.
Task permission for the “Start (start a single DPM system)” task.
- Parameters:
wait_for_completion (bool) –
Boolean controlling whether this method should wait for completion of the requested asynchronous HMC operation, as follows:
If True, this method will wait for completion of the asynchronous job performing the operation.
If False, this method will return immediately once the HMC has accepted the request to perform the operation.
operation_timeout (number) – Timeout in seconds, for waiting for completion of the asynchronous job performing the operation. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a
OperationTimeout
is raised.
- Returns:
If wait_for_completion is True, returns None.
If wait_for_completion is False, returns a
Job
object representing the asynchronously executing job on the HMC.- Return type:
None or
Job
- Raises:
OperationTimeout – The timeout expired while waiting for completion of the operation.
- stop(wait_for_completion=True, operation_timeout=None)[source]
Stop this DPM-mode CPC, using the HMC operation “Stop CPC”.
This operation performs an orderly shutdown of the CPC, including:
Stopping all partitions.
Ending hardware activity.
Clearing, releasing, and de-allocating hardware resources.
Turning off CPC power.
The CPC must be set for DPM operational mode (i.e. its ‘dpm-enabled’ property is True) and must currently be active.
Authorization requirements:
Object-access permission to this CPC.
Task permission for the “Stop (stop a single DPM system)” task.
- Parameters:
wait_for_completion (bool) –
Boolean controlling whether this method should wait for completion of the requested asynchronous HMC operation, as follows:
If True, this method will wait for completion of the asynchronous job performing the operation.
If False, this method will return immediately once the HMC has accepted the request to perform the operation.
operation_timeout (number) – Timeout in seconds, for waiting for completion of the asynchronous job performing the operation. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a
OperationTimeout
is raised.
- Returns:
If wait_for_completion is True, returns None.
If wait_for_completion is False, returns a
Job
object representing the asynchronously executing job on the HMC.- Return type:
None or
Job
- Raises:
OperationTimeout – The timeout expired while waiting for completion of the operation.
- activate(activation_profile_name, force=False, wait_for_completion=True, operation_timeout=None)[source]
Activate this classic-mode CPC, using the HMC operation “Activate CPC”.
This operation performs an orderly start of the CPC, including:
Turning CPC power on.
Performing a power-on reset, this includes allocating system resources to the CPC as defined by the reset activation profile.
Activating LPARs that are in the auto-start list defined by the reset activation profile.
If the CPC is already active in classic mode, only the operations are performed that are needed to get into the state defined by the specified reset activation profile.
The CPC must be set for classic operational mode (i.e. its ‘dpm-enabled’ property is False).
Authorization requirements:
Object-access permission to this CPC.
Task permission for the “Activate” task.
- Parameters:
activation_profile_name (string) – Name of the reset activation profile used to activate the CPC.
force (bool) – Boolean controlling whether the operation is permitted if the CPC is in ‘operating’ status.
wait_for_completion (bool) –
Boolean controlling whether this method should wait for completion of the requested asynchronous HMC operation, as follows:
If True, this method will wait for completion of the asynchronous job performing the operation.
If False, this method will return immediately once the HMC has accepted the request to perform the operation.
operation_timeout (number) – Timeout in seconds, for waiting for completion of the asynchronous job performing the operation. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a
OperationTimeout
is raised.
- Returns:
If wait_for_completion is True, returns None.
If wait_for_completion is False, returns a
Job
object representing the asynchronously executing job on the HMC.- Return type:
None or
Job
- Raises:
OperationTimeout – The timeout expired while waiting for completion of the operation.
- deactivate(force=False, wait_for_completion=True, operation_timeout=None)[source]
Deactivate this CPC, using the HMC operation “Deactivate CPC”.
This operation performs an orderly shutdown of the CPC, including:
Stopping all LPARs.
Ending hardware activity.
Clearing, releasing, and de-allocating hardware resources.
Turning off CPC power.
The CPC must be set for classic operational mode (i.e. its ‘dpm-enabled’ property is False).
Authorization requirements:
Object-access permission to this CPC.
Task permission for the “Deactivate” task.
- Parameters:
force (bool) – Boolean controlling whether the operation is permitted if the CPC is in ‘operating’ status.
wait_for_completion (bool) –
Boolean controlling whether this method should wait for completion of the requested asynchronous HMC operation, as follows:
If True, this method will wait for completion of the asynchronous job performing the operation.
If False, this method will return immediately once the HMC has accepted the request to perform the operation.
operation_timeout (number) – Timeout in seconds, for waiting for completion of the asynchronous job performing the operation. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a
OperationTimeout
is raised.
- Returns:
If wait_for_completion is True, returns None.
If wait_for_completion is False, returns a
Job
object representing the asynchronously executing job on the HMC.- Return type:
None or
Job
- Raises:
OperationTimeout – The timeout expired while waiting for completion of the operation.
- import_profiles(profile_area, wait_for_completion=True, operation_timeout=None)[source]
Import activation profiles and/or system activity profiles for this CPC from the SE hard drive into the CPC using the HMC operation “Import Profiles”.
This operation is not permitted when the CPC is in DPM mode.
Authorization requirements:
Object-access permission to this CPC.
Task permission for the “CIM Actions ExportSettingsData” task.
- Parameters:
profile_area (int) – The numbered hard drive area (1-4) from which the profiles are imported.
wait_for_completion (bool) –
Boolean controlling whether this method should wait for completion of the requested asynchronous HMC operation, as follows:
If True, this method will wait for completion of the asynchronous job performing the operation.
If False, this method will return immediately once the HMC has accepted the request to perform the operation.
operation_timeout (number) – Timeout in seconds, for waiting for completion of the asynchronous job performing the operation. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a
OperationTimeout
is raised.
- Returns:
If wait_for_completion is True, returns None.
If wait_for_completion is False, returns a
Job
object representing the asynchronously executing job on the HMC.- Return type:
None or
Job
- Raises:
OperationTimeout – The timeout expired while waiting for completion of the operation.
- export_profiles(profile_area, wait_for_completion=True, operation_timeout=None)[source]
Export activation profiles and/or system activity profiles from this CPC to the SE hard drive using the HMC operation “Export Profiles”.
This operation is not permitted when the CPC is in DPM mode.
Authorization requirements:
Object-access permission to this CPC.
Task permission for the “CIM Actions ExportSettingsData” task.
- Parameters:
profile_area (int) – The numbered hard drive area (1-4) to which the profiles are exported. Any existing data is overwritten.
wait_for_completion (bool) –
Boolean controlling whether this method should wait for completion of the requested asynchronous HMC operation, as follows:
If True, this method will wait for completion of the asynchronous job performing the operation.
If False, this method will return immediately once the HMC has accepted the request to perform the operation.
operation_timeout (number) – Timeout in seconds, for waiting for completion of the asynchronous job performing the operation. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a
OperationTimeout
is raised.
- Returns:
If wait_for_completion is True, returns None.
If wait_for_completion is False, returns a
Job
object representing the asynchronously executing job on the HMC.- Return type:
None or
Job
- Raises:
OperationTimeout – The timeout expired while waiting for completion of the operation.
- get_wwpns(partitions)[source]
Return the WWPNs of the host ports (of the HBAs) of the specified Partitions of this CPC.
This method performs the HMC operation “Export WWPN List”.
Authorization requirements:
Object-access permission to this CPC.
Object-access permission to the Partitions designated by the “partitions” parameter.
Task permission for the “Export WWPNs” task.
- Parameters:
partitions (iterable of
Partition
) – Partitions to be used.- Returns:
A list of items for each WWPN, where each item is a dict with the following keys:
’partition-name’ (string): Name of the Partition.
’adapter-id’ (string): ID of the FCP Adapter.
’device-number’ (string): Virtual device number of the HBA.
’wwpn’ (string): WWPN of the HBA.
- Raises:
- get_free_crypto_domains(crypto_adapters=None)[source]
Return a list of crypto domains that are free for usage on a list of crypto adapters in this CPC.
A crypto domain is considered free for usage if it is not assigned to any defined partition of this CPC in access mode ‘control-usage’ on any of the specified crypto adapters.
For this test, all currently defined partitions of this CPC are checked, regardless of whether or not they are active. This ensures that a crypto domain that is found to be free for usage can be assigned to a partition for ‘control-usage’ access to the specified crypto adapters, without causing a crypto domain conflict when activating that partition.
Note that a similar notion of free domains does not exist for access mode ‘control’, because a crypto domain on a crypto adapter can be in control access by multiple active partitions.
This method requires the CPC to be in DPM mode.
Example:
crypto domains adapters 0 1 2 3 +---+---+---+---+ c1 |A,c|a,c| | C | +---+---+---+---+ c2 |b,c|B,c| B | C | +---+---+---+---+
In this example, the CPC has two crypto adapters c1 and c2. For simplicity of the example, we assume these crypto adapters support only 4 crypto domains.
Partition A uses only adapter c1 and has domain 0 in ‘control-usage’ access (indicated by an upper case letter ‘A’ in the corresponding cell) and has domain 1 in ‘control’ access (indicated by a lower case letter ‘a’ in the corresponding cell).
Partition B uses only adapter c2 and has domain 0 in ‘control’ access and domains 1 and 2 in ‘control-usage’ access.
Partition C uses both adapters, and has domains 0 and 1 in ‘control’ access and domain 3 in ‘control-usage’ access.
The domains free for usage in this example are shown in the following table, for each combination of crypto adapters to be investigated:
crypto_adapters
domains free for usage
c1
1, 2
c2
0
c1, c2
(empty list)
Experimental: This method has been added in v0.14.0 and is currently considered experimental. Its interface may change incompatibly. Once the interface remains stable, this experimental marker will be removed.
Authorization requirements:
Object-access permission to this CPC.
Object-access permission to all of its Partitions.
Object-access permission to all of its crypto Adapters.
- Parameters:
crypto_adapters (iterable of
Adapter
) –The crypto Adapters to be investigated.
None means to investigate all crypto adapters of this CPC.
- Returns:
A sorted list of domain index numbers (integers) of the crypto domains that are free for usage on the specified crypto adapters.
Returns None, if
crypto_adapters
was an empty list or ifcrypto_adapters
was None and the CPC has no crypto adapters.- Raises:
- set_power_save(power_saving, wait_for_completion=True, operation_timeout=None)[source]
Set the power save setting of this CPC.
The current power save setting in effect for a CPC is described in the “cpc-power-saving” property of the CPC.
This method performs the HMC operation “Set CPC Power Save”. It requires that the feature “Automate/advanced management suite” (FC 0020) is installed and enabled, and fails otherwise.
This method will also fail if the CPC is under group control.
Whether a CPC currently allows this method is described in the “cpc-power-save-allowed” property of the CPC.
Authorization requirements:
Object-access permission to this CPC.
Task permission for the “Power Save” task.
- Parameters:
power_saving (string) –
The new power save setting, with the possible values:
”high-performance” - The power consumption and performance of the CPC are not reduced. This is the default setting.
”low-power” - Low power consumption for all components of the CPC enabled for power saving.
”custom” - Components may have their own settings changed individually. No component settings are actually changed when this mode is entered.
wait_for_completion (bool) –
Boolean controlling whether this method should wait for completion of the requested asynchronous HMC operation, as follows:
If True, this method will wait for completion of the asynchronous job performing the operation.
If False, this method will return immediately once the HMC has accepted the request to perform the operation.
operation_timeout (number) – Timeout in seconds, for waiting for completion of the asynchronous job performing the operation. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a
OperationTimeout
is raised.
- Returns:
If wait_for_completion is True, returns None.
If wait_for_completion is False, returns a
Job
object representing the asynchronously executing job on the HMC.- Return type:
None or
Job
- Raises:
HTTPError – See the HTTP status and reason codes of operation “Set CPC Power Save” in the HMC API book.
OperationTimeout – The timeout expired while waiting for completion of the operation.
- set_power_capping(power_capping_state, power_cap=None, wait_for_completion=True, operation_timeout=None)[source]
Set the power capping settings of this CPC. The power capping settings of a CPC define whether or not the power consumption of the CPC is limited and if so, what the limit is. Use this method to limit the peak power consumption of a CPC, or to remove a power consumption limit for a CPC.
The current power capping settings in effect for a CPC are described in the “cpc-power-capping-state” and “cpc-power-cap-current” properties of the CPC.
This method performs the HMC operation “Set CPC Power Capping”. It requires that the feature “Automate/advanced management suite” (FC 0020) is installed and enabled, and fails otherwise.
This method will also fail if the CPC is under group control.
Whether a CPC currently allows this method is described in the “cpc-power-cap-allowed” property of the CPC.
Authorization requirements:
Object-access permission to this CPC.
Task permission for the “Power Capping” task.
- Parameters:
power_capping_state (string) –
The power capping state to be set, with the possible values:
”disabled” - The power cap of the CPC is not set and the peak power consumption is not limited. This is the default setting.
”enabled” - The peak power consumption of the CPC is limited to the specified power cap value.
”custom” - Individually configure the components for power capping. No component settings are actually changed when this mode is entered.
power_cap (integer) –
The power cap value to be set, as a power consumption in Watt. This parameter is required not to be None if power_capping_state=”enabled”.
The specified value must be between the values of the CPC properties “cpc-power-cap-minimum” and “cpc-power-cap-maximum”.
wait_for_completion (bool) –
Boolean controlling whether this method should wait for completion of the requested asynchronous HMC operation, as follows:
If True, this method will wait for completion of the asynchronous job performing the operation.
If False, this method will return immediately once the HMC has accepted the request to perform the operation.
operation_timeout (number) – Timeout in seconds, for waiting for completion of the asynchronous job performing the operation. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a
OperationTimeout
is raised.
- Returns:
If wait_for_completion is True, returns None.
If wait_for_completion is False, returns a
Job
object representing the asynchronously executing job on the HMC.- Return type:
None or
Job
- Raises:
HTTPError – See the HTTP status and reason codes of operation “Set CPC Power Save” in the HMC API book.
OperationTimeout – The timeout expired while waiting for completion of the operation.
- get_energy_management_properties()[source]
Return the energy management properties of the CPC.
The returned energy management properties are a subset of the properties of the CPC resource, and are also available as normal properties of the CPC resource. In so far, there is no new data provided by this method. However, because only a subset of the properties is returned, this method is faster than retrieving the complete set of CPC properties (e.g. via
pull_full_properties()
).This method performs the HMC operation “Get CPC Energy Management Data”, and returns only the energy management properties for this CPC from the operation result. Note that in non-ensemble mode of a CPC, the HMC operation result will only contain data for the CPC alone.
It requires that the feature “Automate/advanced management suite” (FC 0020) is installed and enabled, and returns empty values for most properties, otherwise.
Authorization requirements:
Object-access permission to this CPC.
- Returns:
A dictionary of properties of the CPC that are related to energy management. For details, see section “Energy management related additional properties” in the data model for the CPC resource in the HMC API book.
- Return type:
- Raises:
HTTPError – See the HTTP status and reason codes of operation “Get CPC Energy Management Data” in the HMC API book.
ParseError – Also raised by this method when the JSON response could be parsed but contains inconsistent data.
- list_associated_storage_groups(full_properties=False, filter_args=None)[source]
Return the storage groups that are associated to this CPC.
If the CPC does not support the “dpm-storage-management” feature, or does not have it enabled, an empty list is returned.
Storage groups for which the authenticated user does not have object-access permission are not included.
Authorization requirements:
Object-access permission to any storage groups to be included in the result.
- Parameters:
full_properties (bool) – Controls that the full set of resource properties for each returned storage group is being retrieved, vs. only the following short set: “object-uri”, “cpc-uri”, “name”, “fulfillment-state”, and “type”.
filter_args (dict) –
Filter arguments that narrow the list of returned resources to those that match the specified filter arguments. For details, see Filtering.
None causes no filtering to happen.
The ‘cpc-uri’ property is automatically added to the filter arguments and must not be specified in this parameter.
- Returns:
A list of
StorageGroup
objects.- Raises:
ValueError – The filter_args parameter specifies the ‘cpc-uri’ property
- validate_lun_path(host_wwpn, host_port, wwpn, lun)[source]
Validate if an FCP storage volume on an actual storage subsystem is reachable from this CPC, through a specified host port and using a specified host WWPN.
This method performs the “Validate LUN Path” HMC operation.
If the volume is reachable, the method returns. If the volume is not reachable (and no other errors occur), an
HTTPError
is raised, and itsreason
property indicates the reason as follows:484: Target WWPN cannot be reached.
485: Target WWPN can be reached, but LUN cannot be reached.
The CPC must have the “dpm-storage-management” feature enabled.
- Parameters:
host_wwpn (string) –
World wide port name (WWPN) of the host (CPC), as a hexadecimal number of up to 16 characters in any lexical case.
This may be the WWPN of the physical storage port, or a WWPN of a virtual HBA. In any case, it must be the kind of WWPN that is used for zoning and LUN masking in the SAN.
host_port (
Port
) – Storage port on the CPC that will be used for validating reachability.wwpn (string) – World wide port name (WWPN) of the FCP storage subsystem containing the storage volume, as a hexadecimal number of up to 16 characters in any lexical case.
lun (string) – Logical Unit Number (LUN) of the storage volume within its FCP storage subsystem, as a hexadecimal number of up to 16 characters in any lexical case.
Authorization requirements:
Object-access permission to the storage group owning this storage volume.
Task permission to the “Configure Storage - Storage Administrator” task.
- Raises:
- add_temporary_capacity(record_id, software_model=None, processor_info=None, test=False, force=False)[source]
Add temporary processors to the CPC or increase temporary model capacity of the CPC.
This method performs the “Add Temporary Capacity” HMC operation.
If the request would exceed the processor capacity that is installed on the CPC or the limits of the capacity record, the operation will fail, unless the force parameter is True.
- Parameters:
record_id (string) – The ID of the capacity record to be used for any updates of the processor capacity.
software_model (string) –
The name of the software model to be activated for the CPC. This must be one of the software models defined within the specified capacity record. The software model implies the number of general purpose processors that will be active once the operation succeeds.
If None, the software model and the number of general purpose processors of the CPC will remain unchanged.
processor_info (dict) –
The number of specialty processors to be added to the CPC.
If None, the number of specialty processors of the CPC will remain unchanged.
Each item in the dictionary identifies the number of one type of specialty processor. The key of the item must be a string specifying the type of specialty processor (‘aap’, ‘cbp’, ‘icf’, ‘ifl’, ‘iip’, ‘sap’), and the value of the item must be an integer specifying the number of processors of that type to be added.
If an item for a type of specialty processor is not provided, or if the value of the item is None, the number of specialty processors of that type will remain unchanged.
test (bool) – Indicates whether test (True) or real (False) resources should be activated. Test resources are automatically deactivated after 24h.
force (bool) – True indicates that the operation should proceed if not enough processors are available. True is permitted only for CBU, CPE and loaner capacity records.
Authorization requirements:
Object-access permission to the CPC.
Task permission to the “Perform Model Conversion” task.
- Raises:
- remove_temporary_capacity(record_id, software_model=None, processor_info=None)[source]
Remove temporary processors from the CPC or decrease temporary model capacity of the CPC.
This method performs the “Remove Temporary Capacity” HMC operation.
You can only remove activated resources for the specific offering. You cannot remove dedicated engines or the last processor of a processor type. If you remove resources back to the base configuration, the capacity record activation is completed. That is, if you remove the last temporary processor, your capacity record is deactivated. For a CBU and On/Off CoD record, to add resources again, you must use another
add_temporary_capacity()
operation. For an On/Off CoD test or CPE record, once the record is deactivated, it is no longer available for use. You can then delete the record.After removal of the resources, the capacity record remains as an installed record. If you want a record deleted, you must manually delete the record on the “Installed Records” page in the HMC GUI.
- Parameters:
record_id (string) – The ID of the capacity record to be used for any updates of the processor capacity.
software_model (string) –
The name of the software model to be activated for the CPC. This must be one of the software models defined within the specified capacity record. The software model implies the number of general purpose processors that will be active once the operation succeeds.
If None, the software model and the number of general purpose processors of the CPC will remain unchanged.
processor_info (dict) –
The number of specialty processors to be removed from the CPC.
If None, the number of specialty processors of the CPC will remain unchanged.
Each item in the dictionary identifies the number of one type of specialty processor. The key of the item must be a string specifying the type of specialty processor (‘aap’, ‘cbp’, ‘icf’, ‘ifl’, ‘iip’, ‘sap’), and the value of the item must be an integer specifying the number of processors of that type to be removed.
If an item for a type of specialty processor is not provided, or if the value of the item is None, the number of specialty processors of that type will remain unchanged.
Authorization requirements:
Object-access permission to the CPC.
Task permission to the “Perform Model Conversion” task.
- Raises:
- set_auto_start_list(auto_start_list)[source]
Set the auto-start list of partitions for this CPC.
The current auto-start list is replaced with this new list.
The auto-start list may contain named partition groups that are formed just for the purpose of auto-starting (they have nothing to do with Group objects on the HMC).
This method performs the “Set Auto-Start List” HMC operation.
This method requires the CPC to be in DPM mode.
- Parameters:
auto_start_list (list) –
The auto-start list to be set.
Each list item is one of:
tuple(partition, post_start_delay)
tuple(partition_list, name, description, post_start_delay)
Where:
partition (
Partition
): The partition to be auto-started.post_start_delay (int): Delay in seconds to wait after starting this partition or partition group, and before the next partition or partition group in the list is started.
partition_list (list of
Partition
): The partitions in the partition group to be auto-started.name (string): Name of the partition group.
description (string): Description of the partition group.
Authorization requirements:
Object-access permission to this CPC.
Task permission to the “System Details” task.
Object-access permission to all partitions specified in the auto-start list.
- Raises:
- import_dpm_configuration(dpm_configuration)[source]
Import a DPM configuration into this CPC.
This includes settable CPC properties, settable properties of physical adapters, Hipersocket adapters, partitions with their child objects, virtual functions, virtual switches, capacity groups, storage related resources, storage ports, and network ports.
This method performs the “Import DPM Configuration” HMC operation.
This method requires the CPC to be in DPM mode.
Authorization requirements:
Object-access permission to this CPC.
Task permission to the “Import Dynamic Partition Manager Configuration” task.
- Parameters:
dpm_configuration (dict) –
A DPM configuration, represented as a dictionary with the fields described for the “Import DPM Configuration” operation in the HMC API book.
Resource URIs are represented as URI strings in the fields of the DPM configuration, as described for the request body fields of the HMC operation. URIs of imported resource objects can be chosen to be preserved or newly allocated via the “preserve-uris” field.
Adapter PCHIDs may be different between the imported adapter objects and the actual adapters in this CPC and can be mapped via the “adapter-mapping” field.
Host WWPNs of FICON adapters can be chosen to be preserved or newly allocated via the “preserve-wwpns” field.
- Returns:
If the complete input DPM configuration has been applied to the CPC, None is returned.
If only a part of the input DPM configuration has been applied, a list of dict objects is returned that describe what was not applied. For details, see the description of the response of the “Import DPM Configuration” operation in the HMC API book.
To verify that the complete input DPM configuration has been applied, the caller must verify the return value to be None and not just verify that no exceptions have been raised.
- Return type:
list or None
- Raises:
- export_dpm_configuration(include_unused_adapters=False)[source]
Export a DPM configuration from this CPC and return it.
The DPM configuration includes settable CPC properties and all DPM specific objects of or associated with the CPC, such as adapters with their ports, virtual switches, partitions with their child objects, capacity groups, and various storage and tape related resources.
By default, only those adapters of the CPC are exported that are referenced by other DPM specific objects.
This method performs the “Get Inventory” HMC operation and extracts the relevant elements into the result.
This method requires the CPC to be in DPM mode.
Authorization requirements:
Object-access permission to this CPC.
- Parameters:
include_unused_adapters (bool) – Controls whether the full set of adapters should be returned, vs. only those that are referenced by other DPM objects that are part of the return data.
- Returns:
A DPM configuration, represented as a dictionary with the fields described for the “Import DPM Configuration” operation in the HMC API book.
Resource URIs are represented as URI strings in the fields of the DPM configuration, as described for the request body fields of the HMC operation.
Empty fields are omitted from the returned configuration. This allows using newer versions of zhmcclient that may have added support for a feature of a new generation of Z systems with older generations of Z systems that did not yet have the feature.
The optional “preserve-uris”, “preserve-wwpns”, and “adapter-mapping” fields will not be in the returned dictionary, so their defaults will be used when importing this DPM configuration unchanged to a CPC.
The returned DPM configuration object can be passed to
import_dpm_configuration()
either unchanged, or after changing it, e.g. by adding the optional “preserve-uris”, “preserve-wwpns”, or “adapter-mapping” fields.- Return type:
- Raises:
ConsistencyError –
5.2. Unmanaged CPCs
A CPC (Central Processor Complex) is a physical IBM Z or LinuxONE computer.
A particular HMC can manage multiple CPCs and can discover other CPCs that are not managed by that HMC. Such other CPCs are called “unmanaged CPCs” and they may or may not be managed by another HMC.
This section describes the interface for unmanaged CPCs using resource class
UnmanagedCpc
and the corresponding manager class
UnmanagedCpcManager
.
- class zhmcclient.UnmanagedCpcManager(console)[source]
Manager providing access to the CPCs that have been discovered by the HMC this client is connected to, but are not managed by it. They may or may not be managed by another HMC.
Derived from
BaseManager
; see there for common methods and attributes.Objects of this class are not directly created by the user; they are accessible via the following instance variable of a
Console
object:Attributes:
Console defining the scope for this manager.
case_insensitive_names
bool
: Indicates whether the names of the resources are treated case insensitively.class_name
The resource class name
parent
Subclass of
BaseResource
: Parent resource defining the scope for this manager.resource_class
The Python class of the parent resource of this manager.
session
Session
: Session with the HMC.Methods:
list
([full_properties, filter_args])List the unmanaged CPCs exposed by the HMC this client is connected to.
__repr__
()Return a string with the state of this manager object, for debug purposes.
dump
()Dump the resources of this resource manager as a resource definition.
find
(**filter_args)Find exactly one resource in scope of this manager, by matching resource properties against the specified filter arguments, and return its Python resource object (e.g.
find_by_name
(name)Find a resource by name (i.e.
find_local
(name, uri[, properties])Return a local resource object without fetching it from the HMC.
findall
(**filter_args)Find zero or more resources in scope of this manager, by matching resource properties against the specified filter arguments, and return a list of their Python resource objects (e.g.
flush
()Invalidate the Name-URI cache of this manager.
invalidate_cache
()Invalidate the Name-URI cache of this manager.
resource_object
(uri_or_oid[, props])Return a minimalistic Python resource object for this resource class, that is scoped to this manager.
- list(full_properties=False, filter_args=None)[source]
List the unmanaged CPCs exposed by the HMC this client is connected to.
Because the CPCs are unmanaged, the returned
UnmanagedCpc
objects cannot perform any operations and will have only the following properties:object-uri
name
Authorization requirements:
None
- Parameters:
full_properties (bool) – Ignored (exists for consistency with other list() methods).
filter_args (dict) –
Filter arguments that narrow the list of returned resources to those that match the specified filter arguments. For details, see Filtering.
None causes no filtering to happen, i.e. all resources are returned.
- Returns:
A list of
UnmanagedCpc
objects.- Raises:
- class zhmcclient.UnmanagedCpc(manager, uri, name=None, properties=None)[source]
Representation of an unmanaged CPC.
Derived from
BaseResource
; see there for common methods and attributes.Objects of this class are not directly created by the user; they are returned from creation or list functions on their manager object (in this case,
UnmanagedCpcManager
).Methods:
__repr__
()Return a string with the state of this resource, for debug purposes.
__str__
()Return a human readable string representation of this resource.
auto_update_enabled
()Return whether auto-update is currently enabled for the resource object.
cease_existence_local
()Update this Python object to indicate that the corresponding HMC object no longer exists.
disable_auto_update
()Disable auto-update for this resource object, if currently enabled.
dump
()Dump this resource with its properties and child resources (recursively) as a resource definition.
enable_auto_update
()Enable auto-update for this resource object, if currently disabled.
get_properties_local
(names[, defaults])Return the values of a set of resource properties, using default values for those that are not present in this Python object, without retrieving them from the HMC.
get_property
(name)Return the value of a resource property.
prop
(name[, default])Return the value of a resource property, applying a default if it does not exist.
pull_full_properties
()Retrieve the full set of resource properties and cache them in this object.
update_properties_local
(properties)Update the values of a set of resource properties on this Python object without propagating the updates the HMC.
Attributes:
ceased_existence
Indicates that the corresponding object on the HMC no longer exists, if auto-update is enabled for the resource.
full_properties
A boolean indicating whether or not the resource properties in this object are the full set of resource properties.
manager
Subclass of
BaseManager
: Manager object for this resource (and for all resources of the same type in the scope of that manager).name
The name of the resource.
properties
The properties of this resource that are currently present in this Python object, as a dictionary.
properties_timestamp
The point in time of the last update of the resource properties cached in this object, as Unix time (an integer that is the number of seconds since the Unix epoch).
uri
The canonical URI path of the resource.
5.3. Activation profiles
An Activation Profile controls the activation of a CPC or LPAR. They are used to tailor the operation of a CPC and are stored in the Support Element associated with the CPC.
Activation Profile resources are contained in CPC resources.
Activation Profile resources only exist in CPCs that are not in DPM mode.
- TODO: If Reset Activation Profiles are used to determine the CPC mode,
should they not exist in all CPC modes?
There are three types of Activation Profiles:
Reset: The Reset Activation Profile defines for a CPC the mode in which the CPC licensed internal code will be loaded (e.g. DPM mode or classic mode) and how much central storage and expanded storage will be used.
Image: For CPCs in classic mode, each LPAR can have an Image Activation Profile. The Image Activation Profile determines the number of CPs that the LPAR will use and whether these CPs will be dedicated to the LPAR or shared. It also allows assigning the amount of central storage and expanded storage that will be used by each LPAR.
Load: For CPCs in classic mode, each LPAR can have a Load Activation Profile. The Load Activation Profile defines the channel address of the device that the operating system for that LPAR will be loaded (booted) from.
- class zhmcclient.ActivationProfileManager(cpc, profile_type)[source]
Manager providing access to the Activation Profiles of a particular type in a particular CPC (the scoping CPC).
Possible types of activation profiles are:
Reset Activation Profile
Image Activation Profile
Load Activation Profile
Derived from
BaseManager
; see there for common methods and attributes.Objects of this class are not directly created by the user; they are accessible via the following instance variables of a
Cpc
object (in classic mode or ensemble mode):Attributes:
CPC defining the scope for this manager.
Type of the Activation Profiles managed by this object:
case_insensitive_names
bool
: Indicates whether the names of the resources are treated case insensitively.class_name
The resource class name
parent
Subclass of
BaseResource
: Parent resource defining the scope for this manager.resource_class
The Python class of the parent resource of this manager.
session
Session
: Session with the HMC.Methods:
list
([full_properties, filter_args])List the Activation Profiles of this CPC, of the profile type managed by this object.
__repr__
()Return a string with the state of this manager object, for debug purposes.
dump
()Dump the resources of this resource manager as a resource definition.
find
(**filter_args)Find exactly one resource in scope of this manager, by matching resource properties against the specified filter arguments, and return its Python resource object (e.g.
find_by_name
(name)Find a resource by name (i.e.
find_local
(name, uri[, properties])Return a local resource object without fetching it from the HMC.
findall
(**filter_args)Find zero or more resources in scope of this manager, by matching resource properties against the specified filter arguments, and return a list of their Python resource objects (e.g.
flush
()Invalidate the Name-URI cache of this manager.
invalidate_cache
()Invalidate the Name-URI cache of this manager.
resource_object
(uri_or_oid[, props])Return a minimalistic Python resource object for this resource class, that is scoped to this manager.
- property profile_type
Type of the Activation Profiles managed by this object:
'reset'
- Reset Activation Profiles'image'
- Image Activation Profiles'load'
- Load Activation Profiles
- Type:
- list(full_properties=False, filter_args=None)[source]
List the Activation Profiles of this CPC, of the profile type managed by this object.
Authorization requirements:
Object-access permission to this CPC.
- Parameters:
full_properties (bool) – Controls whether the full set of resource properties should be retrieved, vs. only the short set as returned by the list operation.
filter_args (dict) –
Filter arguments that narrow the list of returned resources to those that match the specified filter arguments. For details, see Filtering.
None causes no filtering to happen, i.e. all resources are returned.
- Returns:
A list of
ActivationProfile
objects.- Raises:
- class zhmcclient.ActivationProfile(manager, uri, name=None, properties=None)[source]
Representation of an Activation Profile of a particular type.
Derived from
BaseResource
; see there for common methods and attributes.Objects of this class are not directly created by the user; they are returned from creation or list functions on their manager object (in this case,
ActivationProfileManager
).Methods:
update_properties
(properties)Update writeable properties of this Activation Profile.
__repr__
()Return a string with the state of this resource, for debug purposes.
__str__
()Return a human readable string representation of this resource.
auto_update_enabled
()Return whether auto-update is currently enabled for the resource object.
cease_existence_local
()Update this Python object to indicate that the corresponding HMC object no longer exists.
disable_auto_update
()Disable auto-update for this resource object, if currently enabled.
dump
()Dump this resource with its properties and child resources (recursively) as a resource definition.
enable_auto_update
()Enable auto-update for this resource object, if currently disabled.
get_properties_local
(names[, defaults])Return the values of a set of resource properties, using default values for those that are not present in this Python object, without retrieving them from the HMC.
get_property
(name)Return the value of a resource property.
prop
(name[, default])Return the value of a resource property, applying a default if it does not exist.
pull_full_properties
()Retrieve the full set of resource properties and cache them in this object.
update_properties_local
(properties)Update the values of a set of resource properties on this Python object without propagating the updates the HMC.
Attributes:
ceased_existence
Indicates that the corresponding object on the HMC no longer exists, if auto-update is enabled for the resource.
full_properties
A boolean indicating whether or not the resource properties in this object are the full set of resource properties.
manager
Subclass of
BaseManager
: Manager object for this resource (and for all resources of the same type in the scope of that manager).name
The name of the resource.
properties
The properties of this resource that are currently present in this Python object, as a dictionary.
properties_timestamp
The point in time of the last update of the resource properties cached in this object, as Unix time (an integer that is the number of seconds since the Unix epoch).
uri
The canonical URI path of the resource.
- update_properties(properties)[source]
Update writeable properties of this Activation Profile.
This method serializes with other methods that access or change properties on the same Python object.
Authorization requirements:
Object-access permission to the CPC of this Activation Profile.
Task permission for the “Customize/Delete Activation Profiles” task.
- Parameters:
properties (dict) – New values for the properties to be updated. Properties not to be updated are omitted. Allowable properties are the properties with qualifier (w) in section ‘Data model’ in section ‘<profile_type> activation profile’ in the HMC API book, where <profile_type> is the profile type of this object (e.g. Reset, Load, Image).
- Raises:
5.4. LPARs
A LPAR (Logical Partition) is a subset of the hardware resources of a CPC in classic mode (or ensemble mode), virtualized as a separate computer.
LPARs cannot be created or deleted by the user; they can only be listed.
LPAR resources are contained in CPC resources.
LPAR resources only exist in CPCs that are in classic mode (or ensemble mode). CPCs in DPM mode have Partition resources, instead.
- class zhmcclient.LparManager(cpc)[source]
Manager providing access to the LPARs in a particular CPC.
Derived from
BaseManager
; see there for common methods and attributes.Objects of this class are not directly created by the user; they are accessible via the following instance variable of a
Cpc
object (in DPM mode):Attributes:
CPC defining the scope for this manager.
case_insensitive_names
bool
: Indicates whether the names of the resources are treated case insensitively.class_name
The resource class name
parent
Subclass of
BaseResource
: Parent resource defining the scope for this manager.resource_class
The Python class of the parent resource of this manager.
session
Session
: Session with the HMC.Methods:
list
([full_properties, filter_args])List the LPARs in this CPC.
__repr__
()Return a string with the state of this manager object, for debug purposes.
dump
()Dump the resources of this resource manager as a resource definition.
find
(**filter_args)Find exactly one resource in scope of this manager, by matching resource properties against the specified filter arguments, and return its Python resource object (e.g.
find_by_name
(name)Find a resource by name (i.e.
find_local
(name, uri[, properties])Return a local resource object without fetching it from the HMC.
findall
(**filter_args)Find zero or more resources in scope of this manager, by matching resource properties against the specified filter arguments, and return a list of their Python resource objects (e.g.
flush
()Invalidate the Name-URI cache of this manager.
invalidate_cache
()Invalidate the Name-URI cache of this manager.
resource_object
(uri_or_oid[, props])Return a minimalistic Python resource object for this resource class, that is scoped to this manager.
- list(full_properties=False, filter_args=None)[source]
List the LPARs in this CPC.
Authorization requirements:
Object-access permission to this CPC.
Object-access permission to any LPAR to be included in the result.
- Parameters:
full_properties (bool) – Controls whether the full set of resource properties should be retrieved, vs. only the short set as returned by the list operation.
filter_args (dict) –
Filter arguments that narrow the list of returned resources to those that match the specified filter arguments. For details, see Filtering.
None causes no filtering to happen, i.e. all resources are returned.
- Returns:
A list of
Lpar
objects.- Raises:
- class zhmcclient.Lpar(manager, uri, name=None, properties=None)[source]
Representation of an LPAR.
Derived from
BaseResource
; see there for common methods and attributes.Objects of this class are not directly created by the user; they are returned from creation or list functions on their manager object (in this case,
LparManager
).Methods:
update_properties
(properties)Update writeable properties of this LPAR.
activate
([wait_for_completion, ...])Activate (start) this LPAR, using the HMC operation "Activate Logical Partition".
deactivate
([wait_for_completion, ...])De-activate (stop) this LPAR, using the HMC operation "Deactivate Logical Partition".
scsi_load
(load_address, wwpn, lun[, ...])Load (boot) this LPAR from a designated SCSI device, using the HMC operation "SCSI Load".
scsi_dump
(load_address, wwpn, lun[, ...])Load a standalone dump program from a designated SCSI device in this LPAR, using the HMC operation "SCSI Dump".
nvme_load
(load_address[, load_parameter, ...])Load (boot) this LPAR from a designated NVMe device, using the HMC operation "NVMe Load".
nvme_dump
(load_address[, load_parameter, ...])Load a standalone dump program from a designated NVMe device in this LPAR, using the HMC operation "NVMe Dump".
load
([load_address, load_parameter, ...])Load (boot) this LPAR from a load address (boot device), using the HMC operation "Load Logical Partition".
stop
([wait_for_completion, ...])Stop this LPAR, using the HMC operation "Stop Logical Partition".
reset_clear
([force, wait_for_completion, ...])Reset this LPAR and clears its memory.
reset_normal
([force, wait_for_completion, ...])Reset this LPAR without clearing its memory.
open_os_message_channel
([...])Open a JMS message channel to this LPAR's operating system, returning the string "topic" representing the message channel.
send_os_command
(os_command_text[, is_priority])Send a command to the operating system running in this LPAR.
psw_restart
([wait_for_completion, ...])Restart this LPAR, using the HMC operation "PSW Restart".
wait_for_status
(status[, status_timeout])Wait until the status of this LPAR has a desired value.
__repr__
()Return a string with the state of this resource, for debug purposes.
__str__
()Return a human readable string representation of this resource.
auto_update_enabled
()Return whether auto-update is currently enabled for the resource object.
cease_existence_local
()Update this Python object to indicate that the corresponding HMC object no longer exists.
disable_auto_update
()Disable auto-update for this resource object, if currently enabled.
dump
()Dump this resource with its properties and child resources (recursively) as a resource definition.
enable_auto_update
()Enable auto-update for this resource object, if currently disabled.
get_properties_local
(names[, defaults])Return the values of a set of resource properties, using default values for those that are not present in this Python object, without retrieving them from the HMC.
get_property
(name)Return the value of a resource property.
prop
(name[, default])Return the value of a resource property, applying a default if it does not exist.
pull_full_properties
()Retrieve the full set of resource properties and cache them in this object.
update_properties_local
(properties)Update the values of a set of resource properties on this Python object without propagating the updates the HMC.
Attributes:
ceased_existence
Indicates that the corresponding object on the HMC no longer exists, if auto-update is enabled for the resource.
full_properties
A boolean indicating whether or not the resource properties in this object are the full set of resource properties.
manager
Subclass of
BaseManager
: Manager object for this resource (and for all resources of the same type in the scope of that manager).name
The name of the resource.
properties
The properties of this resource that are currently present in this Python object, as a dictionary.
properties_timestamp
The point in time of the last update of the resource properties cached in this object, as Unix time (an integer that is the number of seconds since the Unix epoch).
uri
The canonical URI path of the resource.
- update_properties(properties)[source]
Update writeable properties of this LPAR.
This method serializes with other methods that access or change properties on the same Python object.
Authorization requirements:
Object-access permission to this LPAR.
Before HMC API version 3.6 in an update to HMC 2.15.0: Object-access permission to the CPC of this LPAR.
Task permission for the “Change Object Definition” task.
Since HMC 2.14.1: If the “next-activation-profile-name” property is to be updated, task permission for the “Change Object Options” task or the “Customize/Delete Activation Profiles” task.
Before HMC 2.15.0: For an LPAR whose activation-mode is “zaware”, task permission for the “Firmware Details” task.
Since HMC 2.15.0: If any of the “ssc-” or “zaware-” properties is to be updated, task permission for the “Firmware Details” task.
Since HMC 2.15.0: If any of the numbers of allocated or reserved cores is to be updated, task permission for the “Logical Processor Add” task.
- activate(wait_for_completion=True, operation_timeout=None, status_timeout=None, allow_status_exceptions=False, activation_profile_name=None, force=False)[source]
Activate (start) this LPAR, using the HMC operation “Activate Logical Partition”.
This HMC operation has deferred status behavior: If the asynchronous job on the HMC is complete, it takes a few seconds until the LPAR status has reached the desired value. If wait_for_completion=True, this method repeatedly checks the status of the LPAR after the HMC operation has completed, and waits until the status is in the desired state “not-operating” (which indicates that the LPAR is active but no operating system is running), or “operating”, or if allow_status_exceptions was set additionally in the state “exceptions”.
Authorization requirements:
Object-access permission to this LPAR.
Before HMC API version 3.6 in an update to HMC 2.15.0: Object-access permission to the CPC of this LPAR.
Task permission for the “Activate” task.
- Parameters:
wait_for_completion (bool) –
Boolean controlling whether this method should wait for completion of the requested asynchronous HMC operation, as follows:
If True, this method will wait for completion of the asynchronous job performing the operation, and for the status becoming “not-operating” or “operating” (or in addition “exceptions”, if allow_status_exceptions was set.
If False, this method will return immediately once the HMC has accepted the request to perform the operation.
operation_timeout (number) – Timeout in seconds, for waiting for completion of the asynchronous job performing the operation. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a
OperationTimeout
is raised.status_timeout (number) – Timeout in seconds, for waiting that the status of the LPAR has reached the desired status, after the HMC operation has completed. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a
StatusTimeout
is raised.allow_status_exceptions (bool) – Boolean controlling whether LPAR status “exceptions” is considered an additional acceptable end status when wait_for_completion is set.
activation_profile_name (string) –
Name of the image
ActivationProfile
to use for activation.None means that the activation profile specified in the next-activation-profile-name property of the LPAR is used.
force (bool) –
Boolean controlling whether this operation is permitted when the LPAR is in the “operating” status.
TBD: What will happen with the LPAR in that case (deactivated then activated? nothing?)
- Returns:
If wait_for_completion is True, returns None.
If wait_for_completion is False, returns a
Job
object representing the asynchronously executing job on the HMC.- Return type:
None or
Job
- Raises:
OperationTimeout – The timeout expired while waiting for completion of the operation.
StatusTimeout – The timeout expired while waiting for the desired LPAR status.
- deactivate(wait_for_completion=True, operation_timeout=None, status_timeout=None, allow_status_exceptions=False, force=False)[source]
De-activate (stop) this LPAR, using the HMC operation “Deactivate Logical Partition”.
This HMC operation has deferred status behavior: If the asynchronous job on the HMC is complete, it takes a few seconds until the LPAR status has reached the desired value. If wait_for_completion=True, this method repeatedly checks the status of the LPAR after the HMC operation has completed, and waits until the status is in the desired state “not-activated”, or if allow_status_exceptions was set additionally in the state “exceptions”.
Authorization requirements:
Object-access permission to this LPAR.
Before HMC API version 3.6 in an update to HMC 2.15.0: Object-access permission to the CPC of this LPAR.
Task permission for the “Deactivate” task.
- Parameters:
wait_for_completion (bool) –
Boolean controlling whether this method should wait for completion of the requested asynchronous HMC operation, as follows:
If True, this method will wait for completion of the asynchronous job performing the operation, and for the status becoming “non-activated” (or in addition “exceptions”, if allow_status_exceptions was set.
If False, this method will return immediately once the HMC has accepted the request to perform the operation.
operation_timeout (number) – Timeout in seconds, for waiting for completion of the asynchronous job performing the operation. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a
OperationTimeout
is raised.status_timeout (number) – Timeout in seconds, for waiting that the status of the LPAR has reached the desired status, after the HMC operation has completed. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a
StatusTimeout
is raised.allow_status_exceptions (bool) – Boolean controlling whether LPAR status “exceptions” is considered an additional acceptable end status when wait_for_completion is set.
force (bool) –
Boolean controlling whether this operation is permitted when the LPAR is in the “operating” status.
TBD: What will happen with the LPAR in that case (deactivated then activated? nothing?)
- Returns:
If wait_for_completion is True, returns None.
If wait_for_completion is False, returns a
Job
object representing the asynchronously executing job on the HMC.- Return type:
None or
Job
- Raises:
OperationTimeout – The timeout expired while waiting for completion of the operation.
StatusTimeout – The timeout expired while waiting for the desired LPAR status.
- scsi_load(load_address, wwpn, lun, load_parameter=None, disk_partition_id=None, operating_system_specific_load_parameters=None, boot_record_logical_block_address=None, force=False, wait_for_completion=True, operation_timeout=None, status_timeout=None, allow_status_exceptions=False, secure_boot=False, os_ipl_token=None, clear_indicator=True)[source]
Load (boot) this LPAR from a designated SCSI device, using the HMC operation “SCSI Load”.
This HMC operation has deferred status behavior: If the asynchronous job on the HMC is complete, it takes a few seconds until the LPAR status has reached the desired value. If wait_for_completion=True, this method repeatedly checks the status of the LPAR after the HMC operation has completed, and waits until the status is in the desired state “operating”, or if allow_status_exceptions was set additionally in the state “exceptions”.
Authorization requirements:
Object-access permission to this LPAR.
Before HMC API version 3.6 in an update to HMC 2.15.0: Object-access permission to the CPC of this LPAR.
Task permission for the “SCSI Load” task.
- Parameters:
load_address (string) – Device number of the boot device.
wwpn (string) – Worldwide port name (WWPN) of the target SCSI device to be used for this operation, in hexadecimal.
lun (string) – Hexadecimal logical unit number (LUN) to be used for the SCSI load.
load_parameter (string) – Optional load control string. If empty string or None, it is not passed to the HMC, and the HMC default of an empty string will be used.
disk_partition_id (integer) – Optional disk-partition-id (also called the boot program selector) to be used for the SCSI load. If None, it is not passed to the HMC, and the HMC default of 0 will be used.
operating_system_specific_load_parameters (string) – Optional operating system specific load parameters to be used for the SCSI load. If empty string or None, it is not passed to the HMC, and the HMC default of an empty string will be used.
boot_record_logical_block_address (string) – Optional hexadecimal boot record logical block address to be used for the SCSI load. If None, it is not passed to the HMC, and the HMC default of “0” will be used.
force (bool) – Boolean controlling whether this operation is permitted when the LPAR is in the “operating” status.
wait_for_completion (bool) –
Boolean controlling whether this method should wait for completion of the requested asynchronous HMC operation, as follows:
If True, this method will wait for completion of the asynchronous job performing the operation, and for the status becoming “operating” (or in addition “exceptions”, if allow_status_exceptions was set.
If False, this method will return immediately once the HMC has accepted the request to perform the operation.
operation_timeout (number) – Timeout in seconds, for waiting for completion of the asynchronous job performing the operation. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a
OperationTimeout
is raised.status_timeout (number) – Timeout in seconds, for waiting that the status of the LPAR has reached the desired status, after the HMC operation has completed. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a
StatusTimeout
is raised.allow_status_exceptions (bool) – Boolean controlling whether LPAR status “exceptions” is considered an additional acceptable end status when wait_for_completion is set.
secure_boot (bool) – Boolean controlling whether the system checks the software signature of what is loaded against what the distributor signed it with. If False or None, it is not passed to the HMC, and the HMC default of False will be used. Requires the LPAR to be on a z15 or later.
os_ipl_token (string) – Optional hexadecimal value to be used for the SCSI load. If None, it is not passed to the HMC.
clear_indicator (bool) – Optional boolean controlling whether the memory should be cleared before performing the load or not cleared. If True or None, it is not passed to the HMC, and the HMC default of True will be used if the LPAR is on a z14 with SE version 2.14.1 or higher. Requires the LPAR to be on a z14 with SE version 2.14.1 or higher.
- Returns:
If wait_for_completion is True, returns None.
If wait_for_completion is False, returns a
Job
object representing the asynchronously executing job on the HMC.- Return type:
None or
Job
- Raises:
OperationTimeout – The timeout expired while waiting for completion of the operation.
StatusTimeout – The timeout expired while waiting for the desired LPAR status.
- scsi_dump(load_address, wwpn, lun, load_parameter=None, disk_partition_id=None, operating_system_specific_load_parameters=None, boot_record_logical_block_address=None, os_ipl_token=None, wait_for_completion=True, operation_timeout=None, status_timeout=None, allow_status_exceptions=False, force=False, secure_boot=False)[source]
Load a standalone dump program from a designated SCSI device in this LPAR, using the HMC operation “SCSI Dump”.
This HMC operation has deferred status behavior: If the asynchronous job on the HMC is complete, it takes a few seconds until the LPAR status has reached the desired value. If wait_for_completion=True, this method repeatedly checks the status of the LPAR after the HMC operation has completed, and waits until the status is in the desired state “operating”, or if allow_status_exceptions was set additionally in the state “exceptions”.
Authorization requirements:
Object-access permission to this LPAR.
Before HMC API version 3.6 in an update to HMC 2.15.0: Object-access permission to the CPC of this LPAR.
Task permission for the “SCSI Dump” task.
- Parameters:
load_address (string) – Device number of the boot device.
wwpn (string) – Worldwide port name (WWPN) of the target SCSI device to be used for this operation, in hexadecimal.
lun (string) – Hexadecimal logical unit number (LUN) to be used for the SCSI dump.
load_parameter (string) – Optional load control string. If empty string or None, it is not passed to the HMC, and the HMC default of an empty string will be used.
disk_partition_id (integer) – Optional disk-partition-id (also called the boot program selector) to be used for the SCSI dump. If None, it is not passed to the HMC, and the HMC default of 0 will be used.
operating_system_specific_load_parameters (string) – Optional operating system specific load parameters to be used for the SCSI dump. If empty string or None, it is not passed to the HMC, and the HMC default of an empty string will be used.
boot_record_logical_block_address (string) – Optional hexadecimal boot record logical block address to be used for the SCSI dump. If None, it is not passed to the HMC, and the HMC default of “0” will be used.
os_ipl_token (string) – Optional hexadecimal value to be used for the SCSI dump. If None, it is not passed to the HMC.
wait_for_completion (bool) –
Boolean controlling whether this method should wait for completion of the requested asynchronous HMC operation, as follows:
If True, this method will wait for completion of the asynchronous job performing the operation, and for the status becoming “operating” (or in addition “exceptions”, if allow_status_exceptions was set.
If False, this method will return immediately once the HMC has accepted the request to perform the operation.
operation_timeout (number) – Timeout in seconds, for waiting for completion of the asynchronous job performing the operation. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a
OperationTimeout
is raised.status_timeout (number) – Timeout in seconds, for waiting that the status of the LPAR has reached the desired status, after the HMC operation has completed. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a
StatusTimeout
is raised.allow_status_exceptions (bool) – Boolean controlling whether LPAR status “exceptions” is considered an additional acceptable end status when wait_for_completion is set.
force (bool) – Boolean controlling whether this operation is permitted when the LPAR is in the “operating” status.
secure_boot (bool) – Boolean controlling whether the system checks the software signature of what is loaded against what the distributor signed it with. If False or None, it is not passed to the HMC, and the HMC default of False will be used. Requires the LPAR to be on a z15 or later.
- Returns:
If wait_for_completion is True, returns None.
If wait_for_completion is False, returns a
Job
object representing the asynchronously executing job on the HMC.- Return type:
None or
Job
- Raises:
OperationTimeout – The timeout expired while waiting for completion of the operation.
StatusTimeout – The timeout expired while waiting for the desired LPAR status.
- nvme_load(load_address, load_parameter=None, secure_boot=False, clear_indicator=True, disk_partition_id=None, operating_system_specific_load_parameters=None, boot_record_logical_block_address=None, force=False, wait_for_completion=True, operation_timeout=None, status_timeout=None, allow_status_exceptions=False)[source]
Load (boot) this LPAR from a designated NVMe device, using the HMC operation “NVMe Load”.
This operation requires z15 or later.
This HMC operation has deferred status behavior: If the asynchronous job on the HMC is complete, it takes a few seconds until the LPAR status has reached the desired value. If wait_for_completion=True, this method repeatedly checks the status of the LPAR after the HMC operation has completed, and waits until the status is in the desired state “operating”, or if allow_status_exceptions was set additionally in the state “exceptions”.
Authorization requirements:
Object-access permission to this LPAR.
Task permission for the “Load” task.
- Parameters:
load_address (string) – Device number of the boot device.
load_parameter (string) – Optional load control string. If empty string or None, it is not passed to the HMC, and the HMC default of an empty string will be used.
secure_boot (bool) – Boolean controlling whether the system checks the software signature of what is loaded against what the distributor signed it with. If False or None, it is not passed to the HMC, and the HMC default of False will be used. Requires the LPAR to be on a z15 or later.
clear_indicator (bool) – Optional boolean controlling whether the memory should be cleared before performing the load or not cleared. If True or None, it is not passed to the HMC, and the HMC default of True will be used if the LPAR is on a z14 with SE version 2.14.1 or higher. Requires the LPAR to be on a z14 with SE version 2.14.1 or higher.
disk_partition_id (integer) – Optional disk-partition-id (also called the boot program selector) to be used for the NVMe Load. If None, it is not passed to the HMC, and the HMC default of 0 will be used.
operating_system_specific_load_parameters (string) – Optional operating system specific load parameters to be used for the NVMe Load. If empty string or None, it is not passed to the HMC, and the HMC default of an empty string will be used.
boot_record_logical_block_address (string) – Optional hexadecimal boot record logical block address to be used for the NVMe Load. If None, it is not passed to the HMC, and the HMC default of “0” will be used.
force (bool) – Boolean controlling whether this operation is permitted when the LPAR is in the “operating” status.
wait_for_completion (bool) –
Boolean controlling whether this method should wait for completion of the requested asynchronous HMC operation, as follows:
If True, this method will wait for completion of the asynchronous job performing the operation, and for the status becoming “operating” (or in addition “exceptions”, if allow_status_exceptions was set.
If False, this method will return immediately once the HMC has accepted the request to perform the operation.
operation_timeout (number) – Timeout in seconds, for waiting for completion of the asynchronous job performing the operation. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a
OperationTimeout
is raised.status_timeout (number) – Timeout in seconds, for waiting that the status of the LPAR has reached the desired status, after the HMC operation has completed. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a
StatusTimeout
is raised.allow_status_exceptions (bool) – Boolean controlling whether LPAR status “exceptions” is considered an additional acceptable end status when wait_for_completion is set.
- Returns:
If wait_for_completion is True, returns None.
If wait_for_completion is False, returns a
Job
object representing the asynchronously executing job on the HMC.- Return type:
None or
Job
- Raises:
OperationTimeout – The timeout expired while waiting for completion of the operation.
StatusTimeout – The timeout expired while waiting for the desired LPAR status.
- nvme_dump(load_address, load_parameter=None, secure_boot=False, disk_partition_id=None, operating_system_specific_load_parameters=None, boot_record_logical_block_address=None, force=False, wait_for_completion=True, operation_timeout=None, status_timeout=None, allow_status_exceptions=False)[source]
Load a standalone dump program from a designated NVMe device in this LPAR, using the HMC operation “NVMe Dump”.
This operation requires z15 or later.
This HMC operation has deferred status behavior: If the asynchronous job on the HMC is complete, it takes a few seconds until the LPAR status has reached the desired value. If wait_for_completion=True, this method repeatedly checks the status of the LPAR after the HMC operation has completed, and waits until the status is in the desired state “operating”, or if allow_status_exceptions was set additionally in the state “exceptions”.
Authorization requirements:
Object-access permission to this LPAR.
Task permission for the “NVMe Dump” task.
- Parameters:
load_address (string) – Device number of the boot device.
load_parameter (string) – Optional load control string. If empty string or None, it is not passed to the HMC, and the HMC default of an empty string will be used.
secure_boot (bool) – Boolean controlling whether the system checks the software signature of what is loaded against what the distributor signed it with. If False or None, it is not passed to the HMC, and the HMC default of False will be used. Requires the LPAR to be on a z15 or later.
disk_partition_id (integer) – Optional disk-partition-id (also called the boot program selector) to be used for the NVMe dump. If None, it is not passed to the HMC, and the HMC default of 0 will be used.
operating_system_specific_load_parameters (string) – Optional operating system specific load parameters to be used for the NVMe dump. If empty string or None, it is not passed to the HMC, and the HMC default of an empty string will be used.
boot_record_logical_block_address (string) – Optional hexadecimal boot record logical block address to be used for the NVMe dump. If None, it is not passed to the HMC, and the HMC default of “0” will be used.
force (bool) – Boolean controlling whether this operation is permitted when the LPAR is in the “operating” status.
wait_for_completion (bool) –
Boolean controlling whether this method should wait for completion of the requested asynchronous HMC operation, as follows:
If True, this method will wait for completion of the asynchronous job performing the operation, and for the status becoming “operating” (or in addition “exceptions”, if allow_status_exceptions was set.
If False, this method will return immediately once the HMC has accepted the request to perform the operation.
operation_timeout (number) – Timeout in seconds, for waiting for completion of the asynchronous job performing the operation. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a
OperationTimeout
is raised.status_timeout (number) – Timeout in seconds, for waiting that the status of the LPAR has reached the desired status, after the HMC operation has completed. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a
StatusTimeout
is raised.allow_status_exceptions (bool) – Boolean controlling whether LPAR status “exceptions” is considered an additional acceptable end status when wait_for_completion is set.
- Returns:
If wait_for_completion is True, returns None.
If wait_for_completion is False, returns a
Job
object representing the asynchronously executing job on the HMC.- Return type:
None or
Job
- Raises:
OperationTimeout – The timeout expired while waiting for completion of the operation.
StatusTimeout – The timeout expired while waiting for the desired LPAR status.
- load(load_address=None, load_parameter=None, clear_indicator=True, store_status_indicator=False, wait_for_completion=True, operation_timeout=None, status_timeout=None, allow_status_exceptions=False, force=False)[source]
Load (boot) this LPAR from a load address (boot device), using the HMC operation “Load Logical Partition”.
This HMC operation has deferred status behavior: If the asynchronous job on the HMC is complete, it takes a few seconds until the LPAR status has reached the desired value. If wait_for_completion=True, this method repeatedly checks the status of the LPAR after the HMC operation has completed, and waits until the status is in the desired state “operating”, or if allow_status_exceptions was set additionally in the state “exceptions”.
Authorization requirements:
Object-access permission to this LPAR.
Before HMC API version 3.6 in an update to HMC 2.15.0: Object-access permission to the CPC of this LPAR.
Task permission for the “Load” task.
- Parameters:
load_address (string) – Device number of the boot device. Up to z13, this parameter is required. Starting with z14, this parameter is optional and defaults to the load address specified in the ‘last-used-load-address’ property of the Lpar.
load_parameter (string) – Optional load control string. If empty string or None, it is not passed to the HMC, and the HMC default of an empty string will be used.
clear_indicator (bool) – Optional boolean controlling whether the memory should be cleared before performing the load or not cleared. The default value is True.
store_status_indicator (bool) – Optional boolean controlling whether the status should be stored before performing the Load. The default value is False.
wait_for_completion (bool) –
Boolean controlling whether this method should wait for completion of the requested asynchronous HMC operation, as follows:
If True, this method will wait for completion of the asynchronous job performing the operation, and for the status becoming “operating” (or in addition “exceptions”, if allow_status_exceptions was set.
If False, this method will return immediately once the HMC has accepted the request to perform the operation.
operation_timeout (number) – Timeout in seconds, for waiting for completion of the asynchronous job performing the operation. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a
OperationTimeout
is raised.status_timeout (number) – Timeout in seconds, for waiting that the status of the LPAR has reached the desired status, after the HMC operation has completed. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a
StatusTimeout
is raised.allow_status_exceptions (bool) – Boolean controlling whether LPAR status “exceptions” is considered an additional acceptable end status when wait_for_completion is set.
force (bool) –
Boolean controlling whether this operation is permitted when the LPAR is in the “operating” status.
TBD: What will happen with the LPAR in that case (deactivated then activated? nothing?)
- Returns:
If wait_for_completion is True, returns None.
If wait_for_completion is False, returns a
Job
object representing the asynchronously executing job on the HMC.- Return type:
None or
Job
- Raises:
OperationTimeout – The timeout expired while waiting for completion of the operation.
StatusTimeout – The timeout expired while waiting for the desired LPAR status.
- stop(wait_for_completion=True, operation_timeout=None, status_timeout=None, allow_status_exceptions=False)[source]
Stop this LPAR, using the HMC operation “Stop Logical Partition”. The stop operation stops the processors from processing instructions.
This HMC operation has deferred status behavior: If the asynchronous job on the HMC is complete, it takes a few seconds until the LPAR status has reached the desired value. If wait_for_completion=True, this method repeatedly checks the status of the LPAR after the HMC operation has completed, and waits until the status is in the desired state “not-operating”, or if allow_status_exceptions was set additionally in the state “exceptions”.
Authorization requirements:
Object-access permission to this LPAR.
Before HMC API version 3.6 in an update to HMC 2.15.0: Object-access permission to the CPC of this LPAR.
Task permission for the “Stop” task.
- Parameters:
wait_for_completion (bool) –
Boolean controlling whether this method should wait for completion of the requested asynchronous HMC operation, as follows:
If True, this method will wait for completion of the asynchronous job performing the operation, and for the status becoming “not-operating” (or in addition “exceptions”, if allow_status_exceptions was set.
If False, this method will return immediately once the HMC has accepted the request to perform the operation.
operation_timeout (number) – Timeout in seconds, for waiting for completion of the asynchronous job performing the operation. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a
OperationTimeout
is raised.status_timeout (number) – Timeout in seconds, for waiting that the status of the LPAR has reached the desired status, after the HMC operation has completed. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a
StatusTimeout
is raised.allow_status_exceptions (bool) – Boolean controlling whether LPAR status “exceptions” is considered an additional acceptable end status when wait_for_completion is set.
- Returns:
If wait_for_completion is True, returns None.
If wait_for_completion is False, returns a
Job
object representing the asynchronously executing job on the HMC.- Return type:
None or
Job
- Raises:
OperationTimeout – The timeout expired while waiting for completion of the operation.
StatusTimeout – The timeout expired while waiting for the desired LPAR status.
- reset_clear(force=False, wait_for_completion=True, operation_timeout=None, status_timeout=None, allow_status_exceptions=False, os_ipl_token=None)[source]
Reset this LPAR and clears its memory.
This includes clearing its pending interruptions, resetting its channel subsystem and resetting its processors, and clearing its memory, using the HMC operation “Reset Clear”.
This HMC operation has deferred status behavior: If the asynchronous job on the HMC is complete, it takes a few seconds until the LPAR status has reached the desired value. If wait_for_completion=True, this method repeatedly checks the status of the LPAR after the HMC operation has completed, and waits until the status is in the desired state “operating”, or if allow_status_exceptions was set additionally in the state “exceptions”.
Authorization requirements:
Object-access permission to this LPAR.
Before HMC API version 3.6 in an update to HMC 2.15.0: Object-access permission to the CPC of this LPAR.
Task permission for the “Reset Clear” task.
- Parameters:
force (bool) – Boolean controlling whether this operation is permitted when the LPAR is in the “operating” status. The default is False.
wait_for_completion (bool) –
Boolean controlling whether this method should wait for completion of the requested asynchronous HMC operation, as follows:
If True, this method will wait for completion of the asynchronous job performing the operation, and for the status becoming “operating” (or in addition “exceptions”, if allow_status_exceptions was set.
If False, this method will return immediately once the HMC has accepted the request to perform the operation.
operation_timeout (number) – Timeout in seconds, for waiting for completion of the asynchronous job performing the operation. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a
OperationTimeout
is raised.status_timeout (number) – Timeout in seconds, for waiting that the status of the LPAR has reached the desired status, after the HMC operation has completed. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a
StatusTimeout
is raised.allow_status_exceptions (bool) – Boolean controlling whether LPAR status “exceptions” is considered an additional acceptable end status when wait_for_completion is set.
os_ipl_token (string) – Applicable only to z/OS, this parameter requests that this operation only be performed if the provided value matches the current value of the ‘os-ipl-token’ property of the LPAR.
- Returns:
If wait_for_completion is True, returns None.
If wait_for_completion is False, returns a
Job
object representing the asynchronously executing job on the HMC.- Return type:
None or
Job
- Raises:
OperationTimeout – The timeout expired while waiting for completion of the operation.
StatusTimeout – The timeout expired while waiting for the desired LPAR status.
- reset_normal(force=False, wait_for_completion=True, operation_timeout=None, status_timeout=None, allow_status_exceptions=False, os_ipl_token=None)[source]
Reset this LPAR without clearing its memory.
This includes clearing its pending interruptions, resetting its channel subsystem and resetting its processors, using the HMC operation “Reset Normal”.
This HMC operation has deferred status behavior: If the asynchronous job on the HMC is complete, it takes a few seconds until the LPAR status has reached the desired value. If wait_for_completion=True, this method repeatedly checks the status of the LPAR after the HMC operation has completed, and waits until the status is in the desired state “operating”, or if allow_status_exceptions was set additionally in the state “exceptions”.
Authorization requirements:
Object-access permission to this LPAR.
Before HMC API version 3.6 in an update to HMC 2.15.0: Object-access permission to the CPC of this LPAR.
Task permission for the “Reset Clear” task.
- Parameters:
force (bool) – Boolean controlling whether this operation is permitted when the LPAR is in the “operating” status. The default is False.
wait_for_completion (bool) –
Boolean controlling whether this method should wait for completion of the requested asynchronous HMC operation, as follows:
If True, this method will wait for completion of the asynchronous job performing the operation, and for the status becoming “operating” (or in addition “exceptions”, if allow_status_exceptions was set.
If False, this method will return immediately once the HMC has accepted the request to perform the operation.
operation_timeout (number) – Timeout in seconds, for waiting for completion of the asynchronous job performing the operation. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a
OperationTimeout
is raised.status_timeout (number) – Timeout in seconds, for waiting that the status of the LPAR has reached the desired status, after the HMC operation has completed. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a
StatusTimeout
is raised.allow_status_exceptions (bool) – Boolean controlling whether LPAR status “exceptions” is considered an additional acceptable end status when wait_for_completion is set.
os_ipl_token (string) – Applicable only to z/OS, this parameter requests that this operation only be performed if the provided value matches the current value of the ‘os-ipl-token’ property of the LPAR.
- Returns:
If wait_for_completion is True, returns None.
If wait_for_completion is False, returns a
Job
object representing the asynchronously executing job on the HMC.- Return type:
None or
Job
- Raises:
OperationTimeout – The timeout expired while waiting for completion of the operation.
StatusTimeout – The timeout expired while waiting for the desired LPAR status.
- open_os_message_channel(include_refresh_messages=True)[source]
Open a JMS message channel to this LPAR’s operating system, returning the string “topic” representing the message channel.
Authorization requirements:
Object-access permission to this Partition.
Task permission to the “Operating System Messages” task at least in view-only mode.
- Parameters:
include_refresh_messages (bool) –
Boolean controlling whether refresh operating systems messages should be sent, as follows:
If True, refresh messages will be recieved when the user connects to the topic. The default.
If False, refresh messages will not be recieved when the user connects to the topic.
- Returns:
Returns a string representing the os-message-notification JMS topic. The user can connect to this topic to start the flow of operating system messages.
- Return type:
- Raises:
- send_os_command(os_command_text, is_priority=False)[source]
Send a command to the operating system running in this LPAR.
Authorization requirements:
Object-access permission to this Partition.
Task permission to the “Operating System Messages” task in modification mode.
- Parameters:
os_command_text (string) – The text of the operating system command.
is_priority (bool) –
Boolean controlling whether this is a priority operating system command, as follows:
If True, this message is treated as a priority operating system command.
If False, this message is not treated as a priority operating system command. The default.
- Returns:
None
- Raises:
- psw_restart(wait_for_completion=True, operation_timeout=None, status_timeout=None, allow_status_exceptions=False)[source]
Restart this LPAR, using the HMC operation “PSW Restart”.
This HMC operation has deferred status behavior: If the asynchronous job on the HMC is complete, it takes a few seconds until the LPAR status has reached the desired value. If wait_for_completion=True, this method repeatedly checks the status of the LPAR after the HMC operation has completed, and waits until the status is in the desired state “operating”, or if allow_status_exceptions was set additionally in the state “exceptions”.
Authorization requirements:
Object-access permission to this LPAR.
Before HMC API version 3.6 in an update to HMC 2.15.0: Object-access permission to the CPC of this LPAR.
Task permission for the “PSW Restart” task.
- Parameters:
wait_for_completion (bool) –
Boolean controlling whether this method should wait for completion of the requested asynchronous HMC operation, as follows:
If True, this method will wait for completion of the asynchronous job performing the operation, and for the status becoming “operating” (or in addition “exceptions”, if allow_status_exceptions was set.
If False, this method will return immediately once the HMC has accepted the request to perform the operation.
operation_timeout (number) – Timeout in seconds, for waiting for completion of the asynchronous job performing the operation. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a
OperationTimeout
is raised.status_timeout (number) – Timeout in seconds, for waiting that the status of the LPAR has reached the desired status, after the HMC operation has completed. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a
StatusTimeout
is raised.allow_status_exceptions (bool) – Boolean controlling whether LPAR status “exceptions” is considered an additional acceptable end status when wait_for_completion is set.
- Returns:
If wait_for_completion is True, returns None.
If wait_for_completion is False, returns a
Job
object representing the asynchronously executing job on the HMC.- Return type:
None or
Job
- Raises:
OperationTimeout – The timeout expired while waiting for completion of the operation.
StatusTimeout – The timeout expired while waiting for the desired LPAR status.
- wait_for_status(status, status_timeout=None)[source]
Wait until the status of this LPAR has a desired value.
- Parameters:
status (string or iterable of string) –
Desired LPAR status or set of status values to reach; one or more of the following values:
"not-activated"
- The LPAR is not active."not-operating"
- The LPAR is active but no operating system is running in the LPAR."operating"
- The LPAR is active and an operating system is running in the LPAR."exceptions"
- The LPAR or its CPC has one or more unusual conditions.
Note that the description of LPAR status values in the HMC API book (as of its version 2.13.1) is partly confusing.
status_timeout (number) – Timeout in seconds, for waiting that the status of the LPAR has reached one of the desired status values. The special value 0 means that no timeout is set. None means that the default status timeout will be used. If the timeout expires , a
StatusTimeout
is raised.
- Raises:
StatusTimeout – The timeout expired while waiting for the desired LPAR status.
5.5. Partitions
A Partition is a subset of the hardware resources of a CPC in DPM mode, virtualized as a separate computer.
Partitions can be created and deleted dynamically, and their resources such as CPU, memory or I/O devices can be configured dynamically. You can create as many partition definitions as you want, but only a specific number of partitions can be active at any given time.
TODO: How can a user find out what the maximum is, before it is reached?
Partition resources are contained in CPC resources.
Partition resources only exist in CPCs that are in DPM mode. CPCs in classic mode (or ensemble mode) have LPAR resources, instead.
- class zhmcclient.PartitionManager(cpc)[source]
Manager providing access to the Partitions in a particular CPC.
Derived from
BaseManager
; see there for common methods and attributes.Objects of this class are not directly created by the user; they are accessible via the following instance variable of a
Cpc
object (in DPM mode):Attributes:
CPC defining the scope for this manager.
case_insensitive_names
bool
: Indicates whether the names of the resources are treated case insensitively.class_name
The resource class name
parent
Subclass of
BaseResource
: Parent resource defining the scope for this manager.resource_class
The Python class of the parent resource of this manager.
session
Session
: Session with the HMC.Methods:
list
([full_properties, filter_args])List the Partitions in this CPC.
create
(properties)Create and configure a Partition in this CPC.
__repr__
()Return a string with the state of this manager object, for debug purposes.
dump
()Dump the resources of this resource manager as a resource definition.
find
(**filter_args)Find exactly one resource in scope of this manager, by matching resource properties against the specified filter arguments, and return its Python resource object (e.g.
find_by_name
(name)Find a resource by name (i.e.
find_local
(name, uri[, properties])Return a local resource object without fetching it from the HMC.
findall
(**filter_args)Find zero or more resources in scope of this manager, by matching resource properties against the specified filter arguments, and return a list of their Python resource objects (e.g.
flush
()Invalidate the Name-URI cache of this manager.
invalidate_cache
()Invalidate the Name-URI cache of this manager.
resource_object
(uri_or_oid[, props])Return a minimalistic Python resource object for this resource class, that is scoped to this manager.
- list(full_properties=False, filter_args=None)[source]
List the Partitions in this CPC.
Authorization requirements:
Object-access permission to this CPC.
Object-access permission to any Partition to be included in the result.
- Parameters:
full_properties (bool) – Controls whether the full set of resource properties should be retrieved, vs. only the short set as returned by the list operation.
filter_args (dict) –
Filter arguments that narrow the list of returned resources to those that match the specified filter arguments. For details, see Filtering.
None causes no filtering to happen, i.e. all resources are returned.
- Returns:
A list of
Partition
objects.- Raises:
- create(properties)[source]
Create and configure a Partition in this CPC.
Authorization requirements:
Object-access permission to this CPC.
Task permission to the “New Partition” task.
- Parameters:
properties (dict) – Initial property values. Allowable properties are defined in section ‘Request body contents’ in section ‘Create Partition’ in the HMC API book.
- Returns:
The resource object for the new Partition. The object will have its ‘object-uri’ property set as returned by the HMC, and will also have the input properties set.
- Return type:
- Raises:
- class zhmcclient.Partition(manager, uri, name=None, properties=None)[source]
Representation of a Partition.
Derived from
BaseResource
; see there for common methods and attributes.Objects of this class are not directly created by the user; they are returned from creation or list functions on their manager object (in this case,
PartitionManager
).Attributes:
Access to the NICs in this Partition.
Access to the HBAs in this Partition.
Access to the Virtual Functions in this Partition.
ceased_existence
Indicates that the corresponding object on the HMC no longer exists, if auto-update is enabled for the resource.
full_properties
A boolean indicating whether or not the resource properties in this object are the full set of resource properties.
manager
Subclass of
BaseManager
: Manager object for this resource (and for all resources of the same type in the scope of that manager).name
The name of the resource.
properties
The properties of this resource that are currently present in this Python object, as a dictionary.
properties_timestamp
The point in time of the last update of the resource properties cached in this object, as Unix time (an integer that is the number of seconds since the Unix epoch).
uri
The canonical URI path of the resource.
Methods:
feature_enabled
(feature_name)Indicates whether the specified feature is enabled for the CPC of this partition.
Returns information about the features available for the CPC of this partition.
start
([wait_for_completion, ...])Start (activate) this Partition, using the HMC operation "Start Partition".
stop
([wait_for_completion, ...])Stop (deactivate) this Partition, using the HMC operation "Stop Partition".
delete
()Delete this Partition.
update_properties
(properties)Update writeable properties of this Partition.
dump_partition
(parameters[, ...])Dump this Partition, by loading a standalone dump program from a SCSI device and starting its execution, using the HMC operation 'Dump Partition'.
start_dump_program
(parameters[, ...])Dump this Partition, by loading a standalone dump program from a storage volume and starting its execution, using the HMC operation 'Start Dump Program'.
psw_restart
([wait_for_completion, ...])Initiates a PSW restart for this Partition, using the HMC operation 'Perform PSW Restart'.
mount_iso_image
(image, image_name, ins_file_name)Upload an ISO image and associate it to this Partition using the HMC operation 'Mount ISO Image'.
Unmount the currently mounted ISO from this Partition using the HMC operation 'Unmount ISO Image'.
open_os_message_channel
([...])Open a JMS message channel to this partition's operating system, returning the string "topic" representing the message channel.
send_os_command
(os_command_text[, is_priority])Send a command to the operating system running in this partition.
wait_for_status
(status[, status_timeout])Wait until the status of this partition has a desired value.
increase_crypto_config
(crypto_adapters, ...)Add crypto adapters and/or crypto domains to the crypto configuration of this partition.
decrease_crypto_config
(crypto_adapters, ...)Remove crypto adapters and/or crypto domains from the crypto configuration of this partition.
Change the access mode for a crypto domain that is currently included in the crypto configuration of this partition.
zeroize_crypto_domain
(crypto_adapter, ...)Zeroize a single crypto domain on a crypto adapter.
attach_storage_group
(storage_group)Attach a storage group to this partition.
detach_storage_group
(storage_group)Detach a storage group from this partition.
list_attached_storage_groups
([full_properties])Return the storage groups that are attached to this partition.
dump
()Dump this Partition resource with its properties and child resources (recursively) as a resource definition.
__repr__
()Return a string with the state of this resource, for debug purposes.
__str__
()Return a human readable string representation of this resource.
auto_update_enabled
()Return whether auto-update is currently enabled for the resource object.
cease_existence_local
()Update this Python object to indicate that the corresponding HMC object no longer exists.
disable_auto_update
()Disable auto-update for this resource object, if currently enabled.
enable_auto_update
()Enable auto-update for this resource object, if currently disabled.
get_properties_local
(names[, defaults])Return the values of a set of resource properties, using default values for those that are not present in this Python object, without retrieving them from the HMC.
get_property
(name)Return the value of a resource property.
prop
(name[, default])Return the value of a resource property, applying a default if it does not exist.
pull_full_properties
()Retrieve the full set of resource properties and cache them in this object.
update_properties_local
(properties)Update the values of a set of resource properties on this Python object without propagating the updates the HMC.
- property hbas
Access to the HBAs in this Partition.
If the “dpm-storage-management” feature is enabled, this property is None.
- Type:
- property virtual_functions
Access to the Virtual Functions in this Partition.
- Type:
- feature_enabled(feature_name)[source]
Indicates whether the specified feature is enabled for the CPC of this partition.
The HMC must generally support features, and the specified feature must be available for the CPC.
For a list of available features, see section “Features” in the HMC API, or use the
feature_info()
method.Authorization requirements:
Object-access permission to this partition.
- Parameters:
feature_name (string) – The name of the feature.
- Returns:
True if the feature is enabled, or False if the feature is disabled (but available).
- Return type:
- Raises:
ValueError – Features are not supported on the HMC.
ValueError – The specified feature is not available for the CPC.
- feature_info()[source]
Returns information about the features available for the CPC of this partition.
Authorization requirements:
Object-access permission to this partition.
- Returns:
An iterable where each item represents one feature that is available for the CPC of this partition.
Each item is a dictionary with the following items:
name (unicode string): Name of the feature.
description (unicode string): Short description of the feature.
state (bool): Enablement state of the feature (True if the enabled, False if disabled).
- Return type:
- Raises:
ValueError – Features are not supported on the HMC.
- start(wait_for_completion=True, operation_timeout=None, status_timeout=None)[source]
Start (activate) this Partition, using the HMC operation “Start Partition”.
This HMC operation has deferred status behavior: If the asynchronous job on the HMC is complete, it takes a few seconds until the partition status has reached the desired value (it still may show status “paused”). If wait_for_completion=True, this method repeatedly checks the status of the partition after the HMC operation has completed, and waits until the status is in one of the desired states “active” or “degraded”.
TODO: Describe what happens if the maximum number of active partitions is exceeded.
Authorization requirements:
Object-access permission to this Partition.
Task permission to the “Start Partition” task.
- Parameters:
wait_for_completion (bool) –
Boolean controlling whether this method should wait for completion of the requested asynchronous HMC operation, as follows:
If True, this method will wait for completion of the asynchronous job performing the operation.
If False, this method will return immediately once the HMC has accepted the request to perform the operation.
operation_timeout (number) – Timeout in seconds, for waiting for completion of the asynchronous job performing the operation. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a
OperationTimeout
is raised.status_timeout (number) – Timeout in seconds, for waiting that the status of the partition has reached the desired status, after the HMC operation has completed. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a
StatusTimeout
is raised.
- Returns:
If wait_for_completion is True, returns an empty
dict
object.If wait_for_completion is False, returns a
Job
object representing the asynchronously executing job on the HMC.- Return type:
- Raises:
OperationTimeout – The timeout expired while waiting for completion of the operation.
StatusTimeout – The timeout expired while waiting for the desired partition status.
- stop(wait_for_completion=True, operation_timeout=None, status_timeout=None)[source]
Stop (deactivate) this Partition, using the HMC operation “Stop Partition”.
Authorization requirements:
Object-access permission to this Partition.
Task permission to the “Stop Partition” task.
- Parameters:
wait_for_completion (bool) –
Boolean controlling whether this method should wait for completion of the requested asynchronous HMC operation, as follows:
If True, this method will wait for completion of the asynchronous job performing the operation.
If False, this method will return immediately once the HMC has accepted the request to perform the operation.
operation_timeout (number) – Timeout in seconds, for waiting for completion of the asynchronous job performing the operation. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a
OperationTimeout
is raised.status_timeout (number) – Timeout in seconds, for waiting that the status of the partition has reached the desired status, after the HMC operation has completed. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a
StatusTimeout
is raised.
- Returns:
If wait_for_completion is True, returns an empty
dict
object.If wait_for_completion is False, returns a
Job
object representing the asynchronously executing job on the HMC.- Return type:
- Raises:
OperationTimeout – The timeout expired while waiting for completion of the operation.
StatusTimeout – The timeout expired while waiting for the desired partition status.
- delete()[source]
Delete this Partition.
Authorization requirements:
Object-access permission to this Partition.
Task permission to the “Delete Partition” task.
- Raises:
- update_properties(properties)[source]
Update writeable properties of this Partition.
This method serializes with other methods that access or change properties on the same Python object.
Authorization requirements:
Object-access permission to this Partition.
Task permission to the “Partition Details” task.
- dump_partition(parameters, wait_for_completion=True, operation_timeout=None)[source]
Dump this Partition, by loading a standalone dump program from a SCSI device and starting its execution, using the HMC operation ‘Dump Partition’.
This operation requires that the CPC does not have the storage management feature (i.e. is a z13).
Authorization requirements:
Object-access permission to this Partition.
Task permission to the “Dump Partition” task.
- Parameters:
parameters (dict) – Input parameters for the operation. Allowable input parameters are defined in section ‘Request body contents’ in section ‘Dump Partition’ in the HMC API book.
wait_for_completion (bool) –
Boolean controlling whether this method should wait for completion of the requested asynchronous HMC operation, as follows:
If True, this method will wait for completion of the asynchronous job performing the operation.
If False, this method will return immediately once the HMC has accepted the request to perform the operation.
operation_timeout (number) – Timeout in seconds, for waiting for completion of the asynchronous job performing the operation. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a
OperationTimeout
is raised.
- Returns:
If wait_for_completion is True, returns an empty
dict
object.If wait_for_completion is False, returns a
Job
object representing the asynchronously executing job on the HMC.- Return type:
- Raises:
OperationTimeout – The timeout expired while waiting for completion of the operation.
- start_dump_program(parameters, wait_for_completion=True, operation_timeout=None)[source]
Dump this Partition, by loading a standalone dump program from a storage volume and starting its execution, using the HMC operation ‘Start Dump Program’.
This operation requires that the CPC has the storage management feature (i.e. is a z14 or later).
Authorization requirements:
Object-access permission to this Partition.
Task permission to the “Dump Partition” task.
- Parameters:
parameters (dict) – Input parameters for the operation. Allowable input parameters are defined in section ‘Request body contents’ in section ‘Start Dump Program’ in the HMC API book.
wait_for_completion (bool) –
Boolean controlling whether this method should wait for completion of the requested asynchronous HMC operation, as follows:
If True, this method will wait for completion of the asynchronous job performing the operation.
If False, this method will return immediately once the HMC has accepted the request to perform the operation.
operation_timeout (number) – Timeout in seconds, for waiting for completion of the asynchronous job performing the operation. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a
OperationTimeout
is raised.
- Returns:
If wait_for_completion is True, returns an empty
dict
object.If wait_for_completion is False, returns a
Job
object representing the asynchronously executing job on the HMC.- Return type:
- Raises:
OperationTimeout – The timeout expired while waiting for completion of the operation.
- psw_restart(wait_for_completion=True, operation_timeout=None)[source]
Initiates a PSW restart for this Partition, using the HMC operation ‘Perform PSW Restart’.
Authorization requirements:
Object-access permission to this Partition.
Task permission to the “PSW Restart” task.
- Parameters:
wait_for_completion (bool) –
Boolean controlling whether this method should wait for completion of the requested asynchronous HMC operation, as follows:
If True, this method will wait for completion of the asynchronous job performing the operation.
If False, this method will return immediately once the HMC has accepted the request to perform the operation.
operation_timeout (number) – Timeout in seconds, for waiting for completion of the asynchronous job performing the operation. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a
OperationTimeout
is raised.
- Returns:
If wait_for_completion is True, returns an empty
dict
object.If wait_for_completion is False, returns a
Job
object representing the asynchronously executing job on the HMC.- Return type:
- Raises:
OperationTimeout – The timeout expired while waiting for completion of the operation.
- mount_iso_image(image, image_name, ins_file_name)[source]
Upload an ISO image and associate it to this Partition using the HMC operation ‘Mount ISO Image’.
When the partition already has an ISO image associated, the newly uploaded image replaces the current one.
Authorization requirements:
Object-access permission to this Partition.
Task permission to the “Partition Details” task.
- Parameters:
image (byte string or file-like object) –
The content of the ISO image.
Images larger than 2GB cannot be specified as a Byte string; they must be specified as a file-like object.
File-like objects must have opened the file in binary mode.
image_name (string) –
The displayable name of the image.
This value must be a valid Linux file name without directories, must not contain blanks, and must end with ‘.iso’ in lower case.
This value will be shown in the ‘boot-iso-image-name’ property of this partition.
ins_file_name (string) –
The path name of the INS file within the file system of the ISO image.
This value will be shown in the ‘boot-iso-ins-file’ property of this partition.
- Raises:
- unmount_iso_image()[source]
Unmount the currently mounted ISO from this Partition using the HMC operation ‘Unmount ISO Image’. This operation sets the partition’s ‘boot-iso-image-name’ and ‘boot-iso-ins-file’ properties to null.
Authorization requirements:
Object-access permission to this Partition.
Task permission to the “Partition Details” task.
- Raises:
- open_os_message_channel(include_refresh_messages=True)[source]
Open a JMS message channel to this partition’s operating system, returning the string “topic” representing the message channel.
Authorization requirements:
Object-access permission to this Partition.
Task permission to the “Operating System Messages” task at least in view-only mode.
- Parameters:
include_refresh_messages (bool) –
Boolean controlling whether refresh operating systems messages should be sent, as follows:
If True, refresh messages will be recieved when the user connects to the topic. The default.
If False, refresh messages will not be recieved when the user connects to the topic.
- Returns:
Returns a string representing the os-message-notification JMS topic. The user can connect to this topic to start the flow of operating system messages.
- Return type:
- Raises:
- send_os_command(os_command_text, is_priority=False)[source]
Send a command to the operating system running in this partition.
Authorization requirements:
Object-access permission to this Partition.
Task permission to the “Operating System Messages” task in modification mode.
- Parameters:
os_command_text (string) – The text of the operating system command.
is_priority (bool) –
Boolean controlling whether this is a priority operating system command, as follows:
If True, this message is treated as a priority operating system command.
If False, this message is not treated as a priority operating system command. The default.
- Returns:
None
- Raises:
- wait_for_status(status, status_timeout=None)[source]
Wait until the status of this partition has a desired value.
- Parameters:
status (string or iterable of string) – Desired partition status or set of status values to reach; one or more of the values defined for the ‘status’ property in the data model for partitions in the HMC API book.
status_timeout (number) – Timeout in seconds, for waiting that the status of the partition has reached one of the desired status values. The special value 0 means that no timeout is set. None means that the default status timeout will be used. If the timeout expires, a
StatusTimeout
is raised.
- Raises:
StatusTimeout – The status timeout expired while waiting for the desired partition status.
- increase_crypto_config(crypto_adapters, crypto_domain_configurations)[source]
Add crypto adapters and/or crypto domains to the crypto configuration of this partition.
The general principle for maintaining crypto configurations of partitions is as follows: Each adapter included in the crypto configuration of a partition has all crypto domains included in the crypto configuration. Each crypto domain included in the crypto configuration has the same access mode on all adapters included in the crypto configuration.
Example: Assume that the current crypto configuration of a partition includes crypto adapter A and crypto domains 0 and 1. When this method is called to add adapter B and domain configurations for domains 1 and 2, the resulting crypto configuration of the partition will include domains 0, 1, and 2 on each of the adapters A and B.
Authorization requirements:
Object-access permission to this Partition.
Object-access permission to the specified Crypto Adapter.
Task permission to the “Partition Details” task.
- Parameters:
crypto_adapters (iterable of
Adapter
) – Crypto adapters that should be added to the crypto configuration of this partition.crypto_domain_configurations (iterable of domain_config) –
Crypto domain configurations that should be added to the crypto configuration of this partition.
A crypto domain configuration (domain_config) is a dictionary with the following keys:
"domain-index"
(integer): Domain index of the crypto domain.The domain index is a number in the range of 0 to a maximum that depends on the model of the crypto adapter and the CPC model. For the Crypto Express 5S adapter in a z13, the maximum domain index is 84.
"access-mode"
(string): Access mode for the crypto domain.The access mode specifies the way the partition can use the crypto domain on the crypto adapter(s), using one of the following string values:
"control"
- The partition can load cryptographic keys into the domain, but it may not use the domain to perform cryptographic operations."control-usage"
- The partition can load cryptographic keys into the domain, and it can use the domain to perform cryptographic operations.
- Raises:
- decrease_crypto_config(crypto_adapters, crypto_domain_indexes)[source]
Remove crypto adapters and/or crypto domains from the crypto configuration of this partition.
For the general principle for maintaining crypto configurations of partitions, see
increase_crypto_config()
.Example: Assume that the current crypto configuration of a partition includes crypto adapters A, B and C and crypto domains 0, 1, and 2 (on each of the adapters). When this method is called to remove adapter C and domain 2, the resulting crypto configuration of the partition will include domains 0 and 1 on each of the adapters A and B.
Authorization requirements:
Object-access permission to this Partition.
Object-access permission to the specified Crypto Adapters.
Task permission to the “Partition Details” task.
- Parameters:
crypto_adapters (iterable of
Adapter
) – Crypto adapters that should be removed from the crypto configuration of this partition.crypto_domain_indexes (iterable of integer) – Domain indexes of the crypto domains that should be removed from the crypto configuration of this partition. For values, see
increase_crypto_config()
.
- Raises:
- change_crypto_domain_config(crypto_domain_index, access_mode)[source]
Change the access mode for a crypto domain that is currently included in the crypto configuration of this partition.
The access mode will be changed for the specified crypto domain on all crypto adapters currently included in the crypto configuration of this partition.
For the general principle for maintaining crypto configurations of partitions, see
increase_crypto_config()
.Authorization requirements:
Object-access permission to this Partition.
Task permission to the “Partition Details” task.
- Parameters:
crypto_domain_index (integer) – Domain index of the crypto domain to be changed. For values, see
increase_crypto_config()
.access_mode (string) – The new access mode for the crypto domain. For values, see
increase_crypto_config()
.
- Raises:
- zeroize_crypto_domain(crypto_adapter, crypto_domain_index)[source]
Zeroize a single crypto domain on a crypto adapter.
Zeroizing a crypto domain clears the cryptographic keys and non-compliance mode settings in the crypto domain.
The crypto domain must be attached to this partition in “control-usage” access mode.
Supported CPC versions: z14 GA2 and above, and the corresponding LinuxOne systems.
Authorization requirements:
Object-access permission to this Partition.
Object-access permission to the specified Crypto Adapter.
Task permission to the “Zeroize Crypto Domain” task.
- Parameters:
- Raises:
- attach_storage_group(storage_group)[source]
Attach a storage group to this partition.
This will cause the storage volumes of the storage group to be attached to the partition, instantiating any necessary virtual storage resource objects.
A storage group can be attached to a partition regardless of its fulfillment state. The fulfillment state of its storage volumes and thus of the entire storage group changes as volumes are discovered by DPM, and will eventually reach “complete”.
The CPC must have the “dpm-storage-management” feature enabled.
Authorization requirements:
Object-access permission to this partition.
Object-access permission to the specified storage group.
Task permission to the “Partition Details” task.
- Parameters:
storage_group (
StorageGroup
) – Storage group to be attached. The storage group must not currently be attached to this partition.- Raises:
- detach_storage_group(storage_group)[source]
Detach a storage group from this partition.
This will cause the storage volumes of the storage group to be detached from the partition, removing any virtual storage resource objects that had been created upon attachment.
A storage group can be detached from a partition regardless of its fulfillment state. The fulfillment state of its storage volumes changes as volumes are discovered by DPM.
The CPC must have the “dpm-storage-management” feature enabled.
Authorization requirements:
Object-access permission to this partition.
Task permission to the “Partition Details” task.
- Parameters:
storage_group (
StorageGroup
) – Storage group to be detached. The storage group must currently be attached to this partition.- Raises:
- list_attached_storage_groups(full_properties=False)[source]
Return the storage groups that are attached to this partition.
The CPC must have the “dpm-storage-management” feature enabled.
Authorization requirements:
Object-access permission to this partition.
- Parameters:
full_properties (bool) –
Controls that the full set of resource properties for each returned storage group is being retrieved, vs. only the following short set: “object-uri”, “object-id”, “class”, “parent”.
TODO: Verify short list of properties.
- Returns:
List of
StorageGroup
objects representing the storage groups that are attached to this partition.- Raises:
- dump()[source]
Dump this Partition resource with its properties and child resources (recursively) as a resource definition.
The returned resource definition has the following format:
{ # Resource properties: "properties": {...}, # Child resources: "nics": [...], "hbas": [...], "virtual_functions": [...], }
- Returns:
Resource definition of this resource.
- Return type:
5.6. Adapters
An Adapter is a physical adapter card (e.g. OSA-Express adapter, Crypto adapter) or a logical adapter (e.g. HiperSockets switch).
Adapter resources are contained in CPC resources.
Adapters only exist in CPCs that are in DPM mode.
There are four types of Adapters:
Network Adapters: Network adapters enable communication through different networking transport protocols. These network adapters are OSA-Express, HiperSockets and RoCE-Express. DPM automatically discovers OSA-Express and RoCE-Express adapters because they are physical cards that are installed on the CPC. In contrast, HiperSockets are logical adapters and must be created and configured by an administrator using the ‘Create Hipersocket’ operation (see create_hipersocket()). Network Interface Cards (NICs) provide a partition with access to networks. Each NIC represents a unique connection between the partition and a specific network adapter.
Storage Adapters: Fibre Channel connections provide high-speed connections between CPCs and storage devices. DPM automatically discovers any storage adapters installed on the CPC. Host bus adapters (HBAs) provide a partition with access to external storage area networks (SANs) and devices that are connected to a CPC. Each HBA represents a unique connection between the partition and a specific storage adapter.
Accelerator Adapters: Accelerator adapters provide specialized functions to improve performance or use of computer resource like the IBM System z Enterprise Data Compression (zEDC) feature. DPM automatically discovers accelerators that are installed on the CPC. An accelerator virtual function provides a partition with access to zEDC features that are installed on a CPC. Each virtual function represents a unique connection between the partition and a physical feature card.
Crypto Adapters: Crypto adapters provide cryptographic processing functions. DPM automatically discovers cryptographic features that are installed on the CPC.
- class zhmcclient.AdapterManager(cpc)[source]
Manager providing access to the Adapters in a particular CPC.
Derived from
BaseManager
; see there for common methods and attributes.Objects of this class are not directly created by the user; they are accessible via the following instance variable of a
Cpc
object (in DPM mode):Attributes:
CPC defining the scope for this manager.
case_insensitive_names
bool
: Indicates whether the names of the resources are treated case insensitively.class_name
The resource class name
parent
Subclass of
BaseResource
: Parent resource defining the scope for this manager.resource_class
The Python class of the parent resource of this manager.
session
Session
: Session with the HMC.Methods:
list
([full_properties, filter_args])List the Adapters in this CPC.
create_hipersocket
(properties)Create and configure a HiperSockets Adapter in this CPC.
__repr__
()Return a string with the state of this manager object, for debug purposes.
dump
()Dump the resources of this resource manager as a resource definition.
find
(**filter_args)Find exactly one resource in scope of this manager, by matching resource properties against the specified filter arguments, and return its Python resource object (e.g.
find_by_name
(name)Find a resource by name (i.e.
find_local
(name, uri[, properties])Return a local resource object without fetching it from the HMC.
findall
(**filter_args)Find zero or more resources in scope of this manager, by matching resource properties against the specified filter arguments, and return a list of their Python resource objects (e.g.
flush
()Invalidate the Name-URI cache of this manager.
invalidate_cache
()Invalidate the Name-URI cache of this manager.
resource_object
(uri_or_oid[, props])Return a minimalistic Python resource object for this resource class, that is scoped to this manager.
- list(full_properties=False, filter_args=None)[source]
List the Adapters in this CPC.
Authorization requirements:
Object-access permission to this CPC.
Object-access permission to any Adapter to be included in the result.
- Parameters:
full_properties (bool) – Controls whether the full set of resource properties should be retrieved, vs. only the short set as returned by the list operation.
filter_args (dict) –
Filter arguments that narrow the list of returned resources to those that match the specified filter arguments. For details, see Filtering.
None causes no filtering to happen, i.e. all resources are returned.
- Returns:
A list of
Adapter
objects.- Raises:
- create_hipersocket(properties)[source]
Create and configure a HiperSockets Adapter in this CPC.
Authorization requirements:
Object-access permission to the scoping CPC.
Task permission to the “Create HiperSockets Adapter” task.
- Parameters:
properties (dict) – Initial property values. Allowable properties are defined in section ‘Request body contents’ in section ‘Create Hipersocket’ in the HMC API book.
- Returns:
The resource object for the new HiperSockets Adapter. The object will have its ‘object-uri’ property set as returned by the HMC, and will also have the input properties set.
- Return type:
- Raises:
- class zhmcclient.Adapter(manager, uri, name=None, properties=None)[source]
Representation of an Adapter.
Derived from
BaseResource
; see there for common methods and attributes.For the properties of an Adapter, see section ‘Data model’ in section ‘Adapter object’ in the HMC API book.
Objects of this class are not directly created by the user; they are returned from creation or list functions on their manager object (in this case,
AdapterManager
).Attributes:
Access to the Ports of this Adapter.
Name of adapter property that specifies the adapter port URIs, or the empty string ('') for adapters without ports.
Adapter type specific URI segment for adapter port URIs, or the empty string ('') for adapters without ports.
The maximum number of crypto domains on this crypto adapter.
ceased_existence
Indicates that the corresponding object on the HMC no longer exists, if auto-update is enabled for the resource.
full_properties
A boolean indicating whether or not the resource properties in this object are the full set of resource properties.
manager
Subclass of
BaseManager
: Manager object for this resource (and for all resources of the same type in the scope of that manager).name
The name of the resource.
properties
The properties of this resource that are currently present in this Python object, as a dictionary.
properties_timestamp
The point in time of the last update of the resource properties cached in this object, as Unix time (an integer that is the number of seconds since the Unix epoch).
uri
The canonical URI path of the resource.
Methods:
delete
()Delete this Adapter.
update_properties
(properties)Update writeable properties of this Adapter.
__repr__
()Return a string with the state of this Adapter, for debug purposes.
change_crypto_type
(crypto_type[, zeroize])Reconfigures a cryptographic adapter to a different crypto type.
change_adapter_type
(adapter_type)Reconfigures an adapter from one type to another, or to ungonfigured.
dump
()Dump this Adapter resource with its properties and child resources (recursively) as a resource definition.
list_assigned_partitions
([full_properties, ...])List the partitions assigned to this adapter.
__str__
()Return a human readable string representation of this resource.
auto_update_enabled
()Return whether auto-update is currently enabled for the resource object.
cease_existence_local
()Update this Python object to indicate that the corresponding HMC object no longer exists.
disable_auto_update
()Disable auto-update for this resource object, if currently enabled.
enable_auto_update
()Enable auto-update for this resource object, if currently disabled.
get_properties_local
(names[, defaults])Return the values of a set of resource properties, using default values for those that are not present in this Python object, without retrieving them from the HMC.
get_property
(name)Return the value of a resource property.
prop
(name[, default])Return the value of a resource property, applying a default if it does not exist.
pull_full_properties
()Retrieve the full set of resource properties and cache them in this object.
update_properties_local
(properties)Update the values of a set of resource properties on this Python object without propagating the updates the HMC.
- property port_uris_prop
Name of adapter property that specifies the adapter port URIs, or the empty string (‘’) for adapters without ports.
For example, ‘network-port-uris’ for a network adapter.
- Type:
- property port_uri_segment
Adapter type specific URI segment for adapter port URIs, or the empty string (‘’) for adapters without ports.
For example, ‘network-ports’ for a network adapter.
- Type:
- property maximum_crypto_domains
The maximum number of crypto domains on this crypto adapter.
The following table shows the maximum number of crypto domains for crypto adapters supported on IBM Z machine generations in DPM mode. The corresponding LinuxONE machine generations are listed in the notes below the table:
Adapter type
Machine generations
Maximum domains
Crypto Express 5S
z15 (5) / z14 (3) / z13 (1)
85
Crypto Express 5S
z15 (6) / z14-ZR1 (4) / z13s (2)
40
Crypto Express 6S
z16 (7) / z15 (5) / z14 (3)
85
Crypto Express 6S
z15 (6) / z14-ZR1 (4)
40
Crypto Express 7S
z16 (7) / z15 (5)
85
Crypto Express 7S
z15 (6)
40
Crypto Express 8S
z16 (7)
85
Notes:
Supported for z13 and LinuxONE Emperor
Supported for z13s and LinuxONE Rockhopper
Supported for z14 and LinuxONE Emperor II
Supported for z14-ZR1 and LinuxONE Rockhopper II
Supported for z15-T01 and LinuxONE III LT1
Supported for z15-T02 and LinuxONE III LT2
Supported for z16-A01 and LinuxONE 4
If this adapter is not a crypto adapter, None is returned.
If the crypto adapter card type is not known,
ValueError
is raised.- Raises:
ValueError – Unknown crypto card type
- Type:
Integer
- delete()[source]
Delete this Adapter.
The Adapter must be a HiperSockets Adapter.
Authorization requirements:
Object-access permission to the HiperSockets Adapter to be deleted.
Task permission to the “Delete HiperSockets Adapter” task.
- Raises:
- update_properties(properties)[source]
Update writeable properties of this Adapter.
This method serializes with other methods that access or change properties on the same Python object.
Authorization requirements:
Object-access permission to the Adapter.
Task permission for the “Adapter Details” task.
- change_crypto_type(crypto_type, zeroize=None)[source]
Reconfigures a cryptographic adapter to a different crypto type. This operation is only supported for cryptographic adapters.
The cryptographic adapter must be varied offline before its crypto type can be reconfigured.
Authorization requirements:
Object-access permission to this Adapter.
Task permission to the “Adapter Details” task.
- Parameters:
crypto_type (string) –
"accelerator"
: Crypto Express5S Accelerator"cca-coprocessor"
: Crypto Express5S CCA Coprocessor"ep11-coprocessor"
: Crypto Express5S EP11 Coprocessor
zeroize (bool) – Specifies whether the cryptographic adapter will be zeroized when it is reconfigured to a crypto type of
"accelerator"
. None means that the HMC-implemented default of True will be used.
- Raises:
- change_adapter_type(adapter_type)[source]
Reconfigures an adapter from one type to another, or to ungonfigured. Currently, only storage adapters can be reconfigured, and their adapter type is the supported storage protocol (FCP vs. FICON).
Storage adapter instances (i.e.
Adapter
objects) represent daughter cards on a physical storage card. Current storage cards require both daughter cards to be configured to the same protocol, so changing the type of the targeted adapter will also change the type of the adapter instance that represents the other daughter card on the same physical card. Zhmcclient users that need to determine the related adapter instance can do so by finding the storage adapter with a matching first 9 characters (card ID and slot ID) of their card-location property values.The targeted adapter and its related adapter on the same storage card must not already have the desired adapter type, they must not be attached to any partition, and they must not have an adapter status of ‘exceptions’.
Authorization requirements:
Object-access permission to this Adapter.
Task permission to the “Configure Storage - System Programmer” task.
- Parameters:
adapter_type (string) –
"fcp"
: FCP (Fibre Channel Protocol)"fc"
: FICON (Fibre Connection) protocol"not-configured"
: No adapter type configured
- Raises:
- dump()[source]
Dump this Adapter resource with its properties and child resources (recursively) as a resource definition.
The returned resource definition has the following format:
{ # Resource properties: "properties": {...}, # Child resources: "ports": [...], }
- Returns:
Resource definition of this resource.
- Return type:
- list_assigned_partitions(full_properties=False, filter_args=None)[source]
List the partitions assigned to this adapter.
This method is not supported for OSA adapters configured as OSM (because those cannot be assigned to partitions).
Authorization requirements:
Object-access permission to this Adapter.
- Parameters:
full_properties (bool) – Controls whether the full set of partition properties should be retrieved, vs. only a short set (uri, name, status).
filter_args (dict) –
Filter arguments that narrow the list of returned partitions to those that match the specified filter arguments. For details, see Filtering.
None causes no filtering to happen, i.e. all assigned partitions are returned.
- Returns:
A list of
Partition
objects.- Raises:
5.7. Ports
A Port is a physical connector port (jack) of an Adapter.
Port resources are contained in Adapter resources.
Ports only exist in CPCs that are in DPM mode.
- class zhmcclient.PortManager(adapter, port_type)[source]
Manager providing access to the Ports of a particular Adapter.
Derived from
BaseManager
; see there for common methods and attributes.Objects of this class are not directly created by the user; they are accessible as properties in higher level resources (in this case, the
Adapter
object).Attributes:
Adapter defining the scope for this manager.
Type of the Ports managed by this object:
case_insensitive_names
bool
: Indicates whether the names of the resources are treated case insensitively.class_name
The resource class name
parent
Subclass of
BaseResource
: Parent resource defining the scope for this manager.resource_class
The Python class of the parent resource of this manager.
session
Session
: Session with the HMC.Methods:
list
([full_properties, filter_args])List the Ports of this Adapter.
__repr__
()Return a string with the state of this manager object, for debug purposes.
dump
()Dump the resources of this resource manager as a resource definition.
find
(**filter_args)Find exactly one resource in scope of this manager, by matching resource properties against the specified filter arguments, and return its Python resource object (e.g.
find_by_name
(name)Find a resource by name (i.e.
find_local
(name, uri[, properties])Return a local resource object without fetching it from the HMC.
findall
(**filter_args)Find zero or more resources in scope of this manager, by matching resource properties against the specified filter arguments, and return a list of their Python resource objects (e.g.
flush
()Invalidate the Name-URI cache of this manager.
invalidate_cache
()Invalidate the Name-URI cache of this manager.
resource_object
(uri_or_oid[, props])Return a minimalistic Python resource object for this resource class, that is scoped to this manager.
- property port_type
Type of the Ports managed by this object:
'network'
- Ports of a network adapter'storage'
- Ports of a storage adapterNone
- Adapter family without ports
- Type:
- list(full_properties=False, filter_args=None)[source]
List the Ports of this Adapter.
If the adapter does not have any ports, an empty list is returned.
Authorization requirements:
Object-access permission to this Adapter.
- Parameters:
full_properties (bool) – Controls whether the full set of resource properties should be retrieved, vs. only the short set as returned by the list operation.
filter_args (dict) –
Filter arguments that narrow the list of returned resources to those that match the specified filter arguments. For details, see Filtering.
None causes no filtering to happen, i.e. all resources are returned.
- Returns:
A list of
Port
objects.- Raises:
- class zhmcclient.Port(manager, uri, name=None, properties=None)[source]
Representation of a Port.
Derived from
BaseResource
; see there for common methods and attributes.For the properties of a Port, see section ‘Data model - Port Element Object’ in section ‘Adapter object’ in the HMC API book.
Objects of this class are not directly created by the user; they are returned from creation or list functions on their manager object (in this case,
PortManager
).Methods:
update_properties
(properties)Update writeable properties of this Port.
dump
()Dump the Port resource with its properties as a resource definition.
__repr__
()Return a string with the state of this resource, for debug purposes.
__str__
()Return a human readable string representation of this resource.
auto_update_enabled
()Return whether auto-update is currently enabled for the resource object.
cease_existence_local
()Update this Python object to indicate that the corresponding HMC object no longer exists.
disable_auto_update
()Disable auto-update for this resource object, if currently enabled.
enable_auto_update
()Enable auto-update for this resource object, if currently disabled.
get_properties_local
(names[, defaults])Return the values of a set of resource properties, using default values for those that are not present in this Python object, without retrieving them from the HMC.
get_property
(name)Return the value of a resource property.
prop
(name[, default])Return the value of a resource property, applying a default if it does not exist.
pull_full_properties
()Retrieve the full set of resource properties and cache them in this object.
update_properties_local
(properties)Update the values of a set of resource properties on this Python object without propagating the updates the HMC.
Attributes:
ceased_existence
Indicates that the corresponding object on the HMC no longer exists, if auto-update is enabled for the resource.
full_properties
A boolean indicating whether or not the resource properties in this object are the full set of resource properties.
manager
Subclass of
BaseManager
: Manager object for this resource (and for all resources of the same type in the scope of that manager).name
The name of the resource.
properties
The properties of this resource that are currently present in this Python object, as a dictionary.
properties_timestamp
The point in time of the last update of the resource properties cached in this object, as Unix time (an integer that is the number of seconds since the Unix epoch).
uri
The canonical URI path of the resource.
- update_properties(properties)[source]
Update writeable properties of this Port.
This method serializes with other methods that access or change properties on the same Python object.
Authorization requirements:
Object-access permission to the Adapter of this Port.
Task permission to the “Adapter Details” task.
- dump()[source]
Dump the Port resource with its properties as a resource definition.
If the adapter of this port is a FICON adapter in the not-configured state, the port properties cannot be retrieved from the HMC, so an empty dict is returned.
Otherwise, the returned resource definition has the following format:
{ "properties": {...}, }
- Returns:
Resource definition of this Port resource.
- Return type:
5.8. NICs
A NIC (Network Interface Card) is a logical entity that provides a Partition with access to external communication networks through a Network Adapter. More specifically, a NIC connects a Partition with a Network Port, or with a Virtual Switch which then connects to the Network Port.
NIC resources are contained in Partition resources.
NICs only exist in CPCs that are in DPM mode.
- class zhmcclient.NicManager(partition)[source]
Manager providing access to the NICs in a particular Partition.
Derived from
BaseManager
; see there for common methods and attributes.Objects of this class are not directly created by the user; they are accessible via the following instance variable of a
Partition
object (in DPM mode):Attributes:
Partition defining the scope for this manager.
case_insensitive_names
bool
: Indicates whether the names of the resources are treated case insensitively.class_name
The resource class name
parent
Subclass of
BaseResource
: Parent resource defining the scope for this manager.resource_class
The Python class of the parent resource of this manager.
session
Session
: Session with the HMC.Methods:
list
([full_properties, filter_args])List the NICs in this Partition.
create
(properties)Create and configure a NIC in this Partition.
__repr__
()Return a string with the state of this manager object, for debug purposes.
dump
()Dump the resources of this resource manager as a resource definition.
find
(**filter_args)Find exactly one resource in scope of this manager, by matching resource properties against the specified filter arguments, and return its Python resource object (e.g.
find_by_name
(name)Find a resource by name (i.e.
find_local
(name, uri[, properties])Return a local resource object without fetching it from the HMC.
findall
(**filter_args)Find zero or more resources in scope of this manager, by matching resource properties against the specified filter arguments, and return a list of their Python resource objects (e.g.
flush
()Invalidate the Name-URI cache of this manager.
invalidate_cache
()Invalidate the Name-URI cache of this manager.
resource_object
(uri_or_oid[, props])Return a minimalistic Python resource object for this resource class, that is scoped to this manager.
- list(full_properties=False, filter_args=None)[source]
List the NICs in this Partition.
Authorization requirements:
Object-access permission to this Partition.
- Parameters:
full_properties (bool) – Controls whether the full set of resource properties should be retrieved, vs. only the short set as returned by the list operation.
filter_args (dict) –
Filter arguments that narrow the list of returned resources to those that match the specified filter arguments. For details, see Filtering.
None causes no filtering to happen, i.e. all resources are returned.
- Returns:
A list of
Nic
objects.- Raises:
- create(properties)[source]
Create and configure a NIC in this Partition.
The NIC must be backed by an adapter port (on an OSA, ROCE, or Hipersockets adapter).
The way the backing adapter port is specified in the “properties” parameter of this method depends on the adapter type, as follows:
For OSA and Hipersockets adapters, the “virtual-switch-uri” property is used to specify the URI of the virtual switch that is associated with the backing adapter port.
This virtual switch is a resource that automatically exists as soon as the adapter resource exists. Note that these virtual switches do not show up in the HMC GUI; but they do show up at the HMC REST API and thus also at the zhmcclient API as the
VirtualSwitch
class.The value for the “virtual-switch-uri” property can be determined from a given adapter name and port index as shown in the following example code (omitting any error handling):
partition = ... # Partition object for the new NIC adapter_name = 'OSA #1' # name of adapter with backing port adapter_port_index = 0 # port index of backing port adapter = partition.manager.cpc.adapters.find(name=adapter_name) vswitches = partition.manager.cpc.virtual_switches.findall( **{'backing-adapter-uri': adapter.uri}) vswitch = None for vs in vswitches: if vs.get_property('port') == adapter_port_index: vswitch = vs break properties['virtual-switch-uri'] = vswitch.uri
For RoCE adapters, the “network-adapter-port-uri” property is used to specify the URI of the backing adapter port, directly.
The value for the “network-adapter-port-uri” property can be determined from a given adapter name and port index as shown in the following example code (omitting any error handling):
partition = ... # Partition object for the new NIC adapter_name = 'ROCE #1' # name of adapter with backing port adapter_port_index = 0 # port index of backing port adapter = partition.manager.cpc.adapters.find(name=adapter_name) port = adapter.ports.find(index=adapter_port_index) properties['network-adapter-port-uri'] = port.uri
Authorization requirements:
Object-access permission to this Partition.
Object-access permission to the backing Adapter for the new NIC.
Task permission to the “Partition Details” task.
- Parameters:
properties (dict) – Initial property values. Allowable properties are defined in section ‘Request body contents’ in section ‘Create NIC’ in the HMC API book.
- Returns:
The resource object for the new NIC. The object will have its ‘element-uri’ property set as returned by the HMC, and will also have the input properties set.
- Return type:
- Raises:
- class zhmcclient.Nic(manager, uri, name=None, properties=None)[source]
Representation of a NIC.
Derived from
BaseResource
; see there for common methods and attributes.For the properties of a NIC resource, see section ‘Data model - NIC Element Object’ in section ‘Partition object’ in the HMC API book.
Objects of this class are not directly created by the user; they are returned from creation or list functions on their manager object (in this case,
NicManager
).Methods:
delete
()Delete this NIC.
update_properties
(properties)Update writeable properties of this NIC.
__repr__
()Return a string with the state of this resource, for debug purposes.
__str__
()Return a human readable string representation of this resource.
auto_update_enabled
()Return whether auto-update is currently enabled for the resource object.
cease_existence_local
()Update this Python object to indicate that the corresponding HMC object no longer exists.
disable_auto_update
()Disable auto-update for this resource object, if currently enabled.
dump
()Dump this resource with its properties and child resources (recursively) as a resource definition.
enable_auto_update
()Enable auto-update for this resource object, if currently disabled.
get_properties_local
(names[, defaults])Return the values of a set of resource properties, using default values for those that are not present in this Python object, without retrieving them from the HMC.
get_property
(name)Return the value of a resource property.
prop
(name[, default])Return the value of a resource property, applying a default if it does not exist.
pull_full_properties
()Retrieve the full set of resource properties and cache them in this object.
update_properties_local
(properties)Update the values of a set of resource properties on this Python object without propagating the updates the HMC.
Attributes:
ceased_existence
Indicates that the corresponding object on the HMC no longer exists, if auto-update is enabled for the resource.
full_properties
A boolean indicating whether or not the resource properties in this object are the full set of resource properties.
manager
Subclass of
BaseManager
: Manager object for this resource (and for all resources of the same type in the scope of that manager).name
The name of the resource.
properties
The properties of this resource that are currently present in this Python object, as a dictionary.
properties_timestamp
The point in time of the last update of the resource properties cached in this object, as Unix time (an integer that is the number of seconds since the Unix epoch).
uri
The canonical URI path of the resource.
- delete()[source]
Delete this NIC.
Authorization requirements:
Object-access permission to the Partition containing this HBA.
Task permission to the “Partition Details” task.
- Raises:
- update_properties(properties)[source]
Update writeable properties of this NIC.
This method serializes with other methods that access or change properties on the same Python object.
Authorization requirements:
Object-access permission to the Partition containing this NIC.
Object-access permission to the backing Adapter for this NIC.
Task permission to the “Partition Details” task.
5.9. HBAs
A HBA (Host Bus Adapter) is a logical entity that provides a Partition with access to external storage area networks (SANs) through an FCP Adapter. More specifically, an HBA connects a Partition with an Adapter Port on an FCP Adapter.
HBA resources are contained in Partition resources.
HBA resources only exist in CPCs that are in DPM mode and when the “dpm-storage-management” feature is not enabled. See section Storage Groups for details. When the “dpm-storage-management” feature is enabled, virtual HBAs are represented as Virtual Storage Resource resources.
- class zhmcclient.HbaManager(partition)[source]
Manager providing access to the HBAs in a particular Partition.
Derived from
BaseManager
; see there for common methods and attributes.Objects of this class are not directly created by the user; they are accessible via the following instance variable of a
Partition
object (in DPM mode):Note that this instance variable will be None if the “dpm-storage-management” feature is enabled.
Attributes:
Partition defining the scope for this manager.
case_insensitive_names
bool
: Indicates whether the names of the resources are treated case insensitively.class_name
The resource class name
parent
Subclass of
BaseResource
: Parent resource defining the scope for this manager.resource_class
The Python class of the parent resource of this manager.
session
Session
: Session with the HMC.Methods:
list
([full_properties, filter_args])List the HBAs in this Partition.
create
(properties)Create and configure an HBA in this Partition.
__repr__
()Return a string with the state of this manager object, for debug purposes.
dump
()Dump the resources of this resource manager as a resource definition.
find
(**filter_args)Find exactly one resource in scope of this manager, by matching resource properties against the specified filter arguments, and return its Python resource object (e.g.
find_by_name
(name)Find a resource by name (i.e.
find_local
(name, uri[, properties])Return a local resource object without fetching it from the HMC.
findall
(**filter_args)Find zero or more resources in scope of this manager, by matching resource properties against the specified filter arguments, and return a list of their Python resource objects (e.g.
flush
()Invalidate the Name-URI cache of this manager.
invalidate_cache
()Invalidate the Name-URI cache of this manager.
resource_object
(uri_or_oid[, props])Return a minimalistic Python resource object for this resource class, that is scoped to this manager.
- list(full_properties=False, filter_args=None)[source]
List the HBAs in this Partition.
The returned HBAs have only the ‘element-uri’ property set.
Filtering is supported only for the ‘element-uri’ property.
Authorization requirements:
Object-access permission to this Partition.
- Parameters:
full_properties (bool) – Controls whether the full set of resource properties should be retrieved, vs. only the short set as returned by the list operation.
filter_args (dict) –
Filter arguments that narrow the list of returned resources to those that match the specified filter arguments. For details, see Filtering.
None causes no filtering to happen, i.e. all resources are returned.
- Returns:
A list of
Hba
objects.- Raises:
- create(properties)[source]
Create and configure an HBA in this Partition.
The HBA must be backed by an adapter port on an FCP adapter.
The backing adapter port is specified in the “properties” parameter of this method by setting the “adapter-port-uri” property to the URI of the backing adapter port.
The value for the “adapter-port-uri” property can be determined from a given adapter name and port index as shown in the following example code (omitting any error handling):
partition = ... # Partition object for the new HBA adapter_name = 'FCP #1' # name of adapter with backing port adapter_port_index = 0 # port index of backing port adapter = partition.manager.cpc.adapters.find(name=adapter_name) port = adapter.ports.find(index=adapter_port_index) properties['adapter-port-uri'] = port.uri
Authorization requirements:
Object-access permission to this Partition.
Object-access permission to the backing Adapter for the new HBA.
Task permission to the “Partition Details” task.
- Parameters:
properties (dict) – Initial property values. Allowable properties are defined in section ‘Request body contents’ in section ‘Create HBA’ in the HMC API book.
- Returns:
The resource object for the new HBA. The object will have its ‘element-uri’ property set as returned by the HMC, and will also have the input properties set.
- Return type:
- Raises:
- class zhmcclient.Hba(manager, uri, name=None, properties=None)[source]
Representation of an HBA.
Derived from
BaseResource
; see there for common methods and attributes.For the properties of an HBA resource, see section ‘Data model - HBA Element Object’ in section ‘Partition object’ in the HMC API book.
Objects of this class are not directly created by the user; they are returned from creation or list functions on their manager object (in this case,
HbaManager
).Methods:
delete
()Delete this HBA.
update_properties
(properties)Update writeable properties of this HBA.
reassign_port
(port)Reassign this HBA to a new underlying FCP port.
__repr__
()Return a string with the state of this resource, for debug purposes.
__str__
()Return a human readable string representation of this resource.
auto_update_enabled
()Return whether auto-update is currently enabled for the resource object.
cease_existence_local
()Update this Python object to indicate that the corresponding HMC object no longer exists.
disable_auto_update
()Disable auto-update for this resource object, if currently enabled.
dump
()Dump this resource with its properties and child resources (recursively) as a resource definition.
enable_auto_update
()Enable auto-update for this resource object, if currently disabled.
get_properties_local
(names[, defaults])Return the values of a set of resource properties, using default values for those that are not present in this Python object, without retrieving them from the HMC.
get_property
(name)Return the value of a resource property.
prop
(name[, default])Return the value of a resource property, applying a default if it does not exist.
pull_full_properties
()Retrieve the full set of resource properties and cache them in this object.
update_properties_local
(properties)Update the values of a set of resource properties on this Python object without propagating the updates the HMC.
Attributes:
ceased_existence
Indicates that the corresponding object on the HMC no longer exists, if auto-update is enabled for the resource.
full_properties
A boolean indicating whether or not the resource properties in this object are the full set of resource properties.
manager
Subclass of
BaseManager
: Manager object for this resource (and for all resources of the same type in the scope of that manager).name
The name of the resource.
properties
The properties of this resource that are currently present in this Python object, as a dictionary.
properties_timestamp
The point in time of the last update of the resource properties cached in this object, as Unix time (an integer that is the number of seconds since the Unix epoch).
uri
The canonical URI path of the resource.
- delete()[source]
Delete this HBA.
Authorization requirements:
Object-access permission to the Partition containing this HBA.
Task permission to the “Partition Details” task.
- Raises:
- update_properties(properties)[source]
Update writeable properties of this HBA.
This method serializes with other methods that access or change properties on the same Python object.
Authorization requirements:
Object-access permission to the Partition containing this HBA.
TBD: Verify: Object-access permission to the backing Adapter for this HBA.
Task permission to the “Partition Details” task.
- reassign_port(port)[source]
Reassign this HBA to a new underlying FCP port.
This method performs the HMC operation “Reassign Storage Adapter Port”.
Authorization requirements:
Object-access permission to the Partition containing this HBA.
Object-access permission to the Adapter with the new Port.
Task permission to the “Partition Details” task.
5.10. Virtual Functions
A Virtual Function is a logical entity that provides a Partition with access to Accelerator Adapters.
Virtual Function resources are contained in Partition resources.
Virtual Functions only exist in CPCs that are in DPM mode.
- class zhmcclient.VirtualFunctionManager(partition)[source]
Manager providing access to the Virtual Functions in a particular Partition.
Derived from
BaseManager
; see there for common methods and attributes.Objects of this class are not directly created by the user; they are accessible via the following instance variable of a
Partition
object (in DPM mode):Attributes:
Partition defining the scope for this manager.
case_insensitive_names
bool
: Indicates whether the names of the resources are treated case insensitively.class_name
The resource class name
parent
Subclass of
BaseResource
: Parent resource defining the scope for this manager.resource_class
The Python class of the parent resource of this manager.
session
Session
: Session with the HMC.Methods:
list
([full_properties, filter_args])List the Virtual Functions of this Partition.
create
(properties)Create a Virtual Function in this Partition.
__repr__
()Return a string with the state of this manager object, for debug purposes.
dump
()Dump the resources of this resource manager as a resource definition.
find
(**filter_args)Find exactly one resource in scope of this manager, by matching resource properties against the specified filter arguments, and return its Python resource object (e.g.
find_by_name
(name)Find a resource by name (i.e.
find_local
(name, uri[, properties])Return a local resource object without fetching it from the HMC.
findall
(**filter_args)Find zero or more resources in scope of this manager, by matching resource properties against the specified filter arguments, and return a list of their Python resource objects (e.g.
flush
()Invalidate the Name-URI cache of this manager.
invalidate_cache
()Invalidate the Name-URI cache of this manager.
resource_object
(uri_or_oid[, props])Return a minimalistic Python resource object for this resource class, that is scoped to this manager.
- list(full_properties=False, filter_args=None)[source]
List the Virtual Functions of this Partition.
Authorization requirements:
Object-access permission to this Partition.
- Parameters:
full_properties (bool) – Controls whether the full set of resource properties should be retrieved, vs. only the short set as returned by the list operation.
filter_args (dict) –
Filter arguments that narrow the list of returned resources to those that match the specified filter arguments. For details, see Filtering.
None causes no filtering to happen, i.e. all resources are returned.
- Returns:
A list of
VirtualFunction
objects.- Raises:
- create(properties)[source]
Create a Virtual Function in this Partition.
Authorization requirements:
Object-access permission to this Partition.
Object-access permission to the backing accelerator Adapter.
Task permission for the “Partition Details” task.
- Parameters:
properties (dict) – Initial property values. Allowable properties are defined in section ‘Request body contents’ in section ‘Create Virtual Function’ in the HMC API book.
- Returns:
The resource object for the new Virtual Function. The object will have its ‘element-uri’ property set as returned by the HMC, and will also have the input properties set.
- Return type:
- Raises:
- class zhmcclient.VirtualFunction(manager, uri, name=None, properties=None)[source]
Representation of a Virtual Function.
Derived from
BaseResource
; see there for common methods and attributes.For the properties of a Virtual Function, see section ‘Data model - Virtual Function Element Object’ in section ‘Partition object’ in the HMC API book.
Objects of this class are not directly created by the user; they are returned from creation or list functions on their manager object (in this case,
VirtualFunctionManager
).Methods:
delete
()Delete this Virtual Function.
update_properties
(properties)Update writeable properties of this Virtual Function.
__repr__
()Return a string with the state of this resource, for debug purposes.
__str__
()Return a human readable string representation of this resource.
auto_update_enabled
()Return whether auto-update is currently enabled for the resource object.
cease_existence_local
()Update this Python object to indicate that the corresponding HMC object no longer exists.
disable_auto_update
()Disable auto-update for this resource object, if currently enabled.
dump
()Dump this resource with its properties and child resources (recursively) as a resource definition.
enable_auto_update
()Enable auto-update for this resource object, if currently disabled.
get_properties_local
(names[, defaults])Return the values of a set of resource properties, using default values for those that are not present in this Python object, without retrieving them from the HMC.
get_property
(name)Return the value of a resource property.
prop
(name[, default])Return the value of a resource property, applying a default if it does not exist.
pull_full_properties
()Retrieve the full set of resource properties and cache them in this object.
update_properties_local
(properties)Update the values of a set of resource properties on this Python object without propagating the updates the HMC.
Attributes:
ceased_existence
Indicates that the corresponding object on the HMC no longer exists, if auto-update is enabled for the resource.
full_properties
A boolean indicating whether or not the resource properties in this object are the full set of resource properties.
manager
Subclass of
BaseManager
: Manager object for this resource (and for all resources of the same type in the scope of that manager).name
The name of the resource.
properties
The properties of this resource that are currently present in this Python object, as a dictionary.
properties_timestamp
The point in time of the last update of the resource properties cached in this object, as Unix time (an integer that is the number of seconds since the Unix epoch).
uri
The canonical URI path of the resource.
- delete()[source]
Delete this Virtual Function.
Authorization requirements:
Object-access permission to the Partition of this Virtual Function.
Task permission for the “Partition Details” task.
- Raises:
- update_properties(properties)[source]
Update writeable properties of this Virtual Function.
This method serializes with other methods that access or change properties on the same Python object.
Authorization requirements:
Object-access permission to the Partition of this Virtual Function.
When updating the “adapter-uri” property, object-access permission to the Adapter identified in that URI.
Task permission for the “Partition Details” task.
5.11. Virtual Switches
A Virtual Switch is a virtualized networking switch connecting NICs with a Network Port.
Virtual Switches are generated automatically every time a new Network Adapter is detected and configured.
Virtual Switch resources are contained in CPC resources.
Virtual Switches only exist in CPCs that are in DPM mode.
- class zhmcclient.VirtualSwitchManager(cpc)[source]
Manager providing access to the Virtual Switches in a particular CPC.
Derived from
BaseManager
; see there for common methods and attributes.Objects of this class are not directly created by the user; they are accessible via the following instance variable of a
Cpc
object (in DPM mode):Attributes:
CPC defining the scope for this manager.
case_insensitive_names
bool
: Indicates whether the names of the resources are treated case insensitively.class_name
The resource class name
parent
Subclass of
BaseResource
: Parent resource defining the scope for this manager.resource_class
The Python class of the parent resource of this manager.
session
Session
: Session with the HMC.Methods:
list
([full_properties, filter_args])List the Virtual Switches in this CPC.
__repr__
()Return a string with the state of this manager object, for debug purposes.
dump
()Dump the resources of this resource manager as a resource definition.
find
(**filter_args)Find exactly one resource in scope of this manager, by matching resource properties against the specified filter arguments, and return its Python resource object (e.g.
find_by_name
(name)Find a resource by name (i.e.
find_local
(name, uri[, properties])Return a local resource object without fetching it from the HMC.
findall
(**filter_args)Find zero or more resources in scope of this manager, by matching resource properties against the specified filter arguments, and return a list of their Python resource objects (e.g.
flush
()Invalidate the Name-URI cache of this manager.
invalidate_cache
()Invalidate the Name-URI cache of this manager.
resource_object
(uri_or_oid[, props])Return a minimalistic Python resource object for this resource class, that is scoped to this manager.
- list(full_properties=False, filter_args=None)[source]
List the Virtual Switches in this CPC.
Authorization requirements:
Object-access permission to this CPC.
Object-access permission to the backing Adapters of any Virtual Switches to be included in the result.
- Parameters:
full_properties (bool) – Controls whether the full set of resource properties should be retrieved, vs. only the short set as returned by the list operation.
filter_args (dict) –
Filter arguments that narrow the list of returned resources to those that match the specified filter arguments. For details, see Filtering.
None causes no filtering to happen, i.e. all resources are returned.
- Returns:
A list of
VirtualSwitch
objects.- Raises:
- class zhmcclient.VirtualSwitch(manager, uri, name=None, properties=None)[source]
Representation of a Virtual Switch.
Derived from
BaseResource
; see there for common methods and attributes.For the properties of a Virtual Switch, see section ‘Data model’ in section ‘Virtual Switch object’ in the HMC API book.
Objects of this class are not directly created by the user; they are returned from creation or list functions on their manager object (in this case,
VirtualSwitchManager
).Methods:
List the NICs connected to this Virtual Switch.
update_properties
(properties)Update writeable properties of this Virtual Switch.
__repr__
()Return a string with the state of this resource, for debug purposes.
__str__
()Return a human readable string representation of this resource.
auto_update_enabled
()Return whether auto-update is currently enabled for the resource object.
cease_existence_local
()Update this Python object to indicate that the corresponding HMC object no longer exists.
disable_auto_update
()Disable auto-update for this resource object, if currently enabled.
dump
()Dump this resource with its properties and child resources (recursively) as a resource definition.
enable_auto_update
()Enable auto-update for this resource object, if currently disabled.
get_properties_local
(names[, defaults])Return the values of a set of resource properties, using default values for those that are not present in this Python object, without retrieving them from the HMC.
get_property
(name)Return the value of a resource property.
prop
(name[, default])Return the value of a resource property, applying a default if it does not exist.
pull_full_properties
()Retrieve the full set of resource properties and cache them in this object.
update_properties_local
(properties)Update the values of a set of resource properties on this Python object without propagating the updates the HMC.
Attributes:
ceased_existence
Indicates that the corresponding object on the HMC no longer exists, if auto-update is enabled for the resource.
full_properties
A boolean indicating whether or not the resource properties in this object are the full set of resource properties.
manager
Subclass of
BaseManager
: Manager object for this resource (and for all resources of the same type in the scope of that manager).name
The name of the resource.
properties
The properties of this resource that are currently present in this Python object, as a dictionary.
properties_timestamp
The point in time of the last update of the resource properties cached in this object, as Unix time (an integer that is the number of seconds since the Unix epoch).
uri
The canonical URI path of the resource.
- get_connected_nics()[source]
List the NICs connected to this Virtual Switch.
This method performs the “Get Connected VNICs of a Virtual Switch” HMC operation.
Authorization requirements:
Object-access permission to this CPC.
Object-access permission to the backing Adapter of this Virtual Switch.
- update_properties(properties)[source]
Update writeable properties of this Virtual Switch.
This method serializes with other methods that access or change properties on the same Python object.
Authorization requirements:
Object-access permission to the backing Adapter of this Virtual Switch.
Task permission for the “Manage Adapters” task.
5.12. Storage Groups
Starting with the z14-ZR1 and LinuxONE Rockhopper II machine generations, the “dpm-storage-management” firmware feature has been introduced to support a simpler management of FCP and FICON (=ECKD) storage for DPM mode. If machines of these generations are in DPM mode, the feature is always enabled and cannot be disabled.
When the “dpm-storage-management” feature is enabled, storage group and storage volume resources can be defined on the HMC, and can cause fulfillment requests to be sent via email to storage administrators. Once these requests are satisfied on the actual storage subsystem and possibly SAN switches, the changes are automatically discovered by DPM and reflected in the state of these resources. Thus, the allocation of actual storage volumes on the storage subsystem is not performed by DPM.
The sending of email is optional, and if the changes are done by some automation tool, they will also be discovered automatically. That way, the whole process of allocating and attaching volumes can be fully automated, if so desired.
The top level resource objects are storage groups.
Storage groups are defined globally at the HMC level, and are associated with a
CPC. They can only be associated with one CPC at a time. In the zhmcclient, the
StorageGroup
objects are accessible via the
storage_groups
property.
Storage groups are a grouping mechanism for storage volumes. An FCP-type storage group can contain only FCP type storage volumes, and a FICON-type storage group can contain only FICON/ECKD type storage volumes.
Attachment and detachment of volumes to a partition happens at the level of storage groups, and always applies to all volumes defined in the storage group.
The storage-related z/Architecture devices that are visible to a partition are different for the two storage architectures: For FCP, the virtualized HBA is visible as a device, and the storage volumes (LUNs) are not represented as devices. For FICON, each ECKD volume is visible as a device, but the virtualized FICON adapter port is not represented as a device. When the “dpm-storage-management” feature is enabled, each storage-related z/Architecture device that is visible to a partition is represented as a virtual storage resource object. The virtual storage resource objects are instantiated automatically when a storage group is attached to a partition. The HBA resource objects known from DPM mode before the introduction of the “dpm-storage-management” feature are not exposed anymore (their equivalent are now the virtual storage resource objects).
Single storage volumes cannot be attached to partitions, only entire storage groups can be. In fact, storage volume objects do not even exist outside the scope of storage groups. A particular storage volume can be contained in only one storage group.
Storage groups can be listed, created, deleted, and updated, and their storage volumes can also be listed, created, deleted, and updated.
Storage groups can be attached to zero or more partitions. Attachment to multiple partitions at the same time is possible for storage groups that are defined to be shareable. In case of multiple attachments of a storage group, it contains the storage volume objects only once for all attachments, but the virtual storage resource objects are instantiated separately for each attachment.
Storage groups can only be associated with CPCs that have the “dpm-storage-management” feature enabled.
- class zhmcclient.StorageGroupManager(console)[source]
Manager providing access to the storage groups of the HMC.
Derived from
BaseManager
; see there for common methods and attributes.Objects of this class are not directly created by the user; they are accessible via the following instance variable:
storage_groups
of aConsole
object.
Attributes:
The Console object representing the HMC.
case_insensitive_names
bool
: Indicates whether the names of the resources are treated case insensitively.class_name
The resource class name
parent
Subclass of
BaseResource
: Parent resource defining the scope for this manager.resource_class
The Python class of the parent resource of this manager.
session
Session
: Session with the HMC.Methods:
list
([full_properties, filter_args])List the storage groups defined in the HMC.
create
([properties, template])Create and configure a storage group either from input properties or from a storage group template.
__repr__
()Return a string with the state of this manager object, for debug purposes.
dump
()Dump the resources of this resource manager as a resource definition.
find
(**filter_args)Find exactly one resource in scope of this manager, by matching resource properties against the specified filter arguments, and return its Python resource object (e.g.
find_by_name
(name)Find a resource by name (i.e.
find_local
(name, uri[, properties])Return a local resource object without fetching it from the HMC.
findall
(**filter_args)Find zero or more resources in scope of this manager, by matching resource properties against the specified filter arguments, and return a list of their Python resource objects (e.g.
flush
()Invalidate the Name-URI cache of this manager.
invalidate_cache
()Invalidate the Name-URI cache of this manager.
resource_object
(uri_or_oid[, props])Return a minimalistic Python resource object for this resource class, that is scoped to this manager.
- list(full_properties=False, filter_args=None)[source]
List the storage groups defined in the HMC.
Storage groups for which the authenticated user does not have object-access permission are not included.
Authorization requirements:
Object-access permission to any storage groups to be included in the result.
- Parameters:
full_properties (bool) – Controls that the full set of resource properties for each returned storage volume is being retrieved, vs. only the following short set: “object-uri”, “cpc-uri”, “name”, “fulfillment-state”, and “type”.
filter_args (dict) –
Filter arguments that narrow the list of returned resources to those that match the specified filter arguments. For details, see Filtering.
None causes no filtering to happen.
- Returns:
A list of
StorageGroup
objects.- Raises:
- create(properties=None, template=None)[source]
Create and configure a storage group either from input properties or from a storage group template.
The input properties may specify initial storage volumes for the new storage group via the storage-volumes property. Additional storage volumes can be added with
update_properties()
.A storage group template can also specify initial storage volumes for the new storage group. For details, see
StorageGroupTemplate
.The new storage group will be associated with the CPC identified by the cpc-uri input property.
Authorization requirements:
Object-access permission to the CPC that will be associated with the new storage group.
Task permission to the “Configure Storage - System Programmer” task.
- Parameters:
properties (dict) –
Initial property values. Allowable properties are defined in section ‘Request body contents’ in section ‘Create Storage Group’ in the HMC API book.
The ‘cpc-uri’ property identifies the CPC to which the new storage group will be associated, and is required to be specified in this parameter.
The ‘template-uri’ property is not allowed. If you want to create a storage group from a storage group template, specify the template parameter.
The properties and template parameters are mutually exclusive.
template (
StorageGroupTemplate
) – storage group template defining the initial property values for the storage group, including its initial storage volumes.
- Returns:
The resource object for the new storage group. The object will have its ‘object-uri’ property set as returned by the HMC, and will also have the input properties set.
- Return type:
- Raises:
- class zhmcclient.StorageGroup(manager, uri, name=None, properties=None)[source]
Representation of a storage group.
Derived from
BaseResource
; see there for common methods and attributes.Objects of this class are not directly created by the user; they are returned from creation or list functions on their manager object (in this case,
StorageGroupManager
).Attributes:
Access to the storage volumes in this storage group.
Access to the virtual storage resources in this storage group.
The CPC to which this storage group is associated.
ceased_existence
Indicates that the corresponding object on the HMC no longer exists, if auto-update is enabled for the resource.
full_properties
A boolean indicating whether or not the resource properties in this object are the full set of resource properties.
manager
Subclass of
BaseManager
: Manager object for this resource (and for all resources of the same type in the scope of that manager).name
The name of the resource.
properties
The properties of this resource that are currently present in this Python object, as a dictionary.
properties_timestamp
The point in time of the last update of the resource properties cached in this object, as Unix time (an integer that is the number of seconds since the Unix epoch).
uri
The canonical URI path of the resource.
Methods:
list_attached_partitions
([name, status])Return the partitions to which this storage group is currently attached, optionally filtered by partition name and status.
delete
([email_to_addresses, ...])Delete this storage group and its storage volume resources on the HMC, and optionally send emails to storage administrators requesting deletion of the storage volumes on the storage subsystem and cleanup of any resources related to the storage group (e.g.
update_properties
(properties)Update writeable properties of this storage group.
add_candidate_adapter_ports
(ports)Add a list of storage adapter ports to this storage group's candidate adapter ports list.
Remove a list of storage adapter ports from this storage group's candidate adapter ports list.
list_candidate_adapter_ports
([full_properties])Return the current candidate storage adapter port list of this storage group.
discover_fcp
([force_restart, ...])Perform Logical Unit Number (LUN) discovery for this FCP storage group.
Get the latest connection report for this storage group.
dump
()Dump this StorageGroup resource with its properties and child resources (recursively) as a resource definition.
__repr__
()Return a string with the state of this resource, for debug purposes.
__str__
()Return a human readable string representation of this resource.
auto_update_enabled
()Return whether auto-update is currently enabled for the resource object.
cease_existence_local
()Update this Python object to indicate that the corresponding HMC object no longer exists.
disable_auto_update
()Disable auto-update for this resource object, if currently enabled.
enable_auto_update
()Enable auto-update for this resource object, if currently disabled.
get_properties_local
(names[, defaults])Return the values of a set of resource properties, using default values for those that are not present in this Python object, without retrieving them from the HMC.
get_property
(name)Return the value of a resource property.
prop
(name[, default])Return the value of a resource property, applying a default if it does not exist.
pull_full_properties
()Retrieve the full set of resource properties and cache them in this object.
update_properties_local
(properties)Update the values of a set of resource properties on this Python object without propagating the updates the HMC.
- property storage_volumes
Access to the storage volumes in this storage group.
- Type:
- property virtual_storage_resources
Access to the virtual storage resources in this storage group.
- property cpc
The CPC to which this storage group is associated.
The returned
Cpc
has only a minimal set of properties populated.- Type:
- list_attached_partitions(name=None, status=None)[source]
Return the partitions to which this storage group is currently attached, optionally filtered by partition name and status.
Authorization requirements:
Object-access permission to this storage group.
Task permission to the “Configure Storage - System Programmer” task.
- Parameters:
name (string) – Filter pattern (regular expression) to limit returned partitions to those that have a matching name. If None, no filtering for the partition name takes place.
status (string) – Filter string to limit returned partitions to those that have a matching status. The value must be a valid partition status property value. If None, no filtering for the partition status takes place.
- Returns:
List of
Partition
objects representing the partitions to whivch this storage group is currently attached, with a minimal set of properties (‘object-id’, ‘name’, ‘status’).- Raises:
- delete(email_to_addresses=None, email_cc_addresses=None, email_insert=None)[source]
Delete this storage group and its storage volume resources on the HMC, and optionally send emails to storage administrators requesting deletion of the storage volumes on the storage subsystem and cleanup of any resources related to the storage group (e.g. zones on a SAN switch, or host objects on a storage subsystem).
Authorization requirements:
Object-access permission to this storage group.
Task permission to the “Configure Storage - System Programmer” task.
- Parameters:
email_to_addresses (iterable of string) – Email addresses of one or more storage administrator to be notified. If None or empty, no email will be sent.
email_cc_addresses (iterable of string) – Email addresses of one or more storage administrator to be copied on the notification email. If None or empty, nobody will be copied on the email. Must be None or empty if email_to_addresses is None or empty.
email_insert (string) – Additional text to be inserted in the notification email. The text can include HTML formatting tags. If None, no additional text will be inserted. Must be None or empty if email_to_addresses is None or empty.
- Raises:
ValueError – Incorrect input arguments
- update_properties(properties)[source]
Update writeable properties of this storage group.
This includes the storage-volumes property which contains requests for creations, deletions and updates of
StorageVolume
resources of this storage group. As an alternative to this bulk approach for managing storage volumes, eachStorageVolume
resource can individually be created, deleted and updated using the respective methods onstorage_volumes
.This method serializes with other methods that access or change properties on the same Python object.
Authorization requirements:
Object-access permission to this storage group.
Task permission to the “Configure Storage - System Programmer” task.
- Parameters:
properties (dict) – New values for the properties to be updated. Properties not to be updated are omitted. Allowable properties are listed for operation ‘Modify Storage Group Properties’ in section ‘Storage Group object’ in the HMC API book. This includes the email addresses of the storage administrators.
- Raises:
- add_candidate_adapter_ports(ports)[source]
Add a list of storage adapter ports to this storage group’s candidate adapter ports list.
This operation only applies to storage groups of type “fcp”.
These adapter ports become candidates for use as backing adapters when creating virtual storage resources when the storage group is attached to a partition. The adapter ports should have connectivity to the storage area network (SAN).
Candidate adapter ports may only be added before the CPC discovers a working communications path, indicated by a “verified” status on at least one of this storage group’s WWPNs. After that point, all adapter ports in the storage group are automatically detected and manually adding them is no longer possible.
Because the CPC discovers working communications paths automatically, candidate adapter ports do not need to be added by the user. Any ports that are added, are validated by the CPC during discovery, and may or may not actually be used.
Authorization requirements:
Object-access permission to this storage group.
Object-access permission to the adapter of each specified port.
Task permission to the “Configure Storage - System Programmer” task.
- remove_candidate_adapter_ports(ports)[source]
Remove a list of storage adapter ports from this storage group’s candidate adapter ports list.
This operation only applies to storage groups of type “fcp”.
Because the CPC discovers working communications paths automatically, candidate adapter ports do not need to be managed by the user. Any ports that are removed using this function, might actually be added again by the CPC dependent on the results of discovery.
Authorization requirements:
Object-access permission to this storage group.
Object-access permission to the adapter of each specified port.
Task permission to the “Configure Storage - System Programmer” task.
- list_candidate_adapter_ports(full_properties=False)[source]
Return the current candidate storage adapter port list of this storage group.
The result reflects the actual list of ports used by the CPC, including any changes that have been made during discovery. The source for this information is the ‘candidate-adapter-port-uris’ property of the storage group object.
- Parameters:
full_properties (bool) –
Controls that the full set of resource properties for each returned candidate storage adapter port is being retrieved, vs. only the following short set: “element-uri”, “element-id”, “class”, “parent”.
TODO: Verify short list of properties.
- Returns:
List of
Port
objects representing the current candidate storage adapter ports of this storage group.- Raises:
- discover_fcp(force_restart=False, wait_for_completion=True, operation_timeout=None)[source]
Perform Logical Unit Number (LUN) discovery for this FCP storage group. The corresponding HMC operation is “Start FCP Storage Discovery”.
This operation only applies to storage groups of type “fcp”.
The HMC performs the LUN discovery in an asynchronous job. This method supports waiting for completion of the job and thus the LUN discovery, or returning immediately after the HMC has started the asynchronous job.
When the LUN discovery is completed, a connection report will have been created that reflects the results of the discovery. The connection report can be retrieved with
get_connection_report()
. It is recommended to retrieve the connection report and verify that it reports correct volumes.Authorization requirements:
Object-access permission to this storage group.
Task permission to the “Configure Storage - System Programmer” task or to the “Configure Storage - Storage Administrator” task.
- Parameters:
force_restart (bool) – Indicates if there is an in-progress discovery operation for the specified storage group, it should be terminated and started again. If False or there is no in-progress discovery operation for the specified storage group, a new one is started.
wait_for_completion (bool) – Boolean controlling whether this method should wait for completion of the asynchronous job performing the LUN discovery.
operation_timeout (number) – Timeout in seconds, for waiting for completion of the asynchronous job performing the LUN discovery. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a
OperationTimeout
is raised.
- Returns:
If wait_for_completion is True, returns nothing.
If wait_for_completion is False, returns a
Job
object representing the asynchronously executing job on the HMC.- Return type:
None or
Job
- Raises:
OperationTimeout – The timeout expired while waiting for completion of the operation.
- get_connection_report()[source]
Get the latest connection report for this storage group.
The corresponding HMC operation is “Get Connection Report”.
The connection report is updated when LUN discovery is performed. LUN discovery for FCP storage groups is performed automatically based on certain triggers, and regularly every 10 minutes, and can additionally be triggered with
discover_fcp()
.To verify that the correct volumes are reported for an FCP storage group, verify that the property volumes-configuration-status has a value of “correct-volumes” for all WWPNs in all FCP subsystems:
report = storage_group.get_connection_report() for subsys in report['fcp-storage-subsystems']: for config in subsys['storage-configurations']: if config['volumes-configuration-status'] != "correct-volumes": # report incorrect volumes
Authorization requirements:
Object-access permission to this storage group.
Task permission to the “Configure Storage - System Programmer” task or to the “Configure Storage - Storage Administrator” task.
- Returns:
A JSON object with the connection report. For details about the items in the JSON object, see section ‘Response body contents’ in section ‘Get Connection Report’ in the HMC API book.
- Return type:
- Raises:
- dump()[source]
Dump this StorageGroup resource with its properties and child resources (recursively) as a resource definition.
The returned resource definition has the following format:
{ # Resource properties: "properties": {...}, # Child resources: "storage_volumes": [...], }
- Returns:
Resource definition of this resource.
- Return type:
5.13. Storage Volumes
A StorageVolume
object represents an FCP or FICON (ECKD)
storage volume that is defined in a storage group.
Storage volume objects can be created, but what is created is the definition of a storage volume in the HMC and CPC. This does not include the act of actually allocating the volume on a storage subsystem. That is performed by a storage administrator who fulfills the volumes.
In order to represent that, storage volume objects have a fulfillment state that is available in their ‘fulfillment-state’ property.
When a storage group is attached to a partition, the group’s storage volumes are attached to the partition and any virtual storage resource objects are instantiated.
Storage volumes are contained in storage groups.
You can create as many storage volumes as you want in a storage group.
Storage groups and storage volumes only can be defined in CPCs that are in DPM mode and that have the “dpm-storage-management” feature enabled.
- class zhmcclient.StorageVolumeManager(storage_group)[source]
Manager providing access to the storage volumes in a particular storage group.
Derived from
BaseManager
; see there for common methods and attributes.Objects of this class are not directly created by the user; they are accessible via the following instance variable of a
StorageGroup
object:Attributes:
Storage group defining the scope for this manager.
case_insensitive_names
bool
: Indicates whether the names of the resources are treated case insensitively.class_name
The resource class name
parent
Subclass of
BaseResource
: Parent resource defining the scope for this manager.resource_class
The Python class of the parent resource of this manager.
session
Session
: Session with the HMC.Methods:
list
([full_properties, filter_args])List the storage volumes in this storage group.
create
(properties[, email_to_addresses, ...])Create a storage volume in this storage group on the HMC, and optionally send emails to storage administrators requesting creation of the storage volume on the storage subsystem and setup of any resources related to the storage volume (e.g.
__repr__
()Return a string with the state of this manager object, for debug purposes.
dump
()Dump the resources of this resource manager as a resource definition.
find
(**filter_args)Find exactly one resource in scope of this manager, by matching resource properties against the specified filter arguments, and return its Python resource object (e.g.
find_by_name
(name)Find a resource by name (i.e.
find_local
(name, uri[, properties])Return a local resource object without fetching it from the HMC.
findall
(**filter_args)Find zero or more resources in scope of this manager, by matching resource properties against the specified filter arguments, and return a list of their Python resource objects (e.g.
flush
()Invalidate the Name-URI cache of this manager.
invalidate_cache
()Invalidate the Name-URI cache of this manager.
resource_object
(uri_or_oid[, props])Return a minimalistic Python resource object for this resource class, that is scoped to this manager.
- property storage_group
Storage group defining the scope for this manager.
- Type:
- list(full_properties=False, filter_args=None)[source]
List the storage volumes in this storage group.
Authorization requirements:
Object-access permission to this storage group.
- Parameters:
full_properties (bool) – Controls that the full set of resource properties for each returned storage volume is being retrieved, vs. only the following short set: “element-uri”, “name”, “fulfillment-state”, “size”, and “usage”.
filter_args (dict) –
Filter arguments that narrow the list of returned resources to those that match the specified filter arguments. For details, see Filtering.
None causes no filtering to happen, i.e. all resources are returned.
- Returns:
A list of
StorageVolume
objects.- Raises:
- create(properties, email_to_addresses=None, email_cc_addresses=None, email_insert=None)[source]
Create a storage volume in this storage group on the HMC, and optionally send emails to storage administrators requesting creation of the storage volume on the storage subsystem and setup of any resources related to the storage volume (e.g. LUN mask definition on the storage subsystem).
This method performs the “Modify Storage Group Properties” operation, requesting creation of the volume.
Authorization requirements:
Object-access permission to this storage group.
Task permission to the “Configure Storage - System Programmer” task.
- Parameters:
properties (dict) –
Initial property values for the new volume.
Allowable properties are the fields defined in the “storage-volume-request-info” nested object described for operation “Modify Storage Group Properties” in the HMC API book. The valid fields are those for the “create” operation. The operation field must not be provided; it is set automatically to the value “create”.
The properties provided in this parameter will be copied and then amended with the operation=”create” field, and then used as a single array item for the storage-volumes field in the request body of the “Modify Storage Group Properties” operation.
Note that for storage volumes, the HMC does auto-generate a value for the “name” property, but that auto-generated name is not unique within the parent storage group. If you depend on a unique name, you need to specify a “name” property accordingly.
email_to_addresses (iterable of string) – Email addresses of one or more storage administrator to be notified. If None or empty, no email will be sent.
email_cc_addresses (iterable of string) – Email addresses of one or more storage administrator to be copied on the notification email. If None or empty, nobody will be copied on the email. Must be None or empty if email_to_addresses is None or empty.
email_insert (string) – Additional text to be inserted in the notification email. The text can include HTML formatting tags. If None, no additional text will be inserted. Must be None or empty if email_to_addresses is None or empty.
- Returns:
The resource object for the new storage volume. The object will have the following properties set:
’element-uri’ as returned by the HMC
’element-id’ as determined from the ‘element-uri’ property
’class’ and ‘parent’
additional properties as specified in the input properties
- Return type:
- Raises:
Example:
stovol1 = fcp_stogrp.storage_volumes.create( properties=dict( name='vol1', size=30, # GiB ))
- class zhmcclient.StorageVolume(manager, uri, name=None, properties=None)[source]
Representation of a storage volume.
Derived from
BaseResource
; see there for common methods and attributes.Objects of this class are not directly created by the user; they are returned from creation or list functions on their manager object (in this case,
StorageVolumeManager
).Attributes:
term unicode string: The object ID of this storage volume.
ceased_existence
Indicates that the corresponding object on the HMC no longer exists, if auto-update is enabled for the resource.
full_properties
A boolean indicating whether or not the resource properties in this object are the full set of resource properties.
manager
Subclass of
BaseManager
: Manager object for this resource (and for all resources of the same type in the scope of that manager).name
The name of the resource.
properties
The properties of this resource that are currently present in this Python object, as a dictionary.
properties_timestamp
The point in time of the last update of the resource properties cached in this object, as Unix time (an integer that is the number of seconds since the Unix epoch).
uri
The canonical URI path of the resource.
Methods:
delete
([email_to_addresses, ...])Delete this storage volume on the HMC, and optionally send emails to storage administrators requesting deletion of the storage volume on the storage subsystem and cleanup of any resources related to the storage volume (e.g.
update_properties
(properties[, ...])Update writeable properties of this storage volume on the HMC, and optionally send emails to storage administrators requesting modification of the storage volume on the storage subsystem and of any resources related to the storage volume.
indicate_fulfillment_ficon
(control_unit, ...)TODO: Add ControlUnit objects etc for FICON support.
indicate_fulfillment_fcp
(wwpn, lun, host_port)Indicate completion of fulfillment for this FCP storage volume and provide identifying information (WWPN and LUN) about the actual storage volume on the storage subsystem.
__repr__
()Return a string with the state of this resource, for debug purposes.
__str__
()Return a human readable string representation of this resource.
auto_update_enabled
()Return whether auto-update is currently enabled for the resource object.
cease_existence_local
()Update this Python object to indicate that the corresponding HMC object no longer exists.
disable_auto_update
()Disable auto-update for this resource object, if currently enabled.
dump
()Dump this resource with its properties and child resources (recursively) as a resource definition.
enable_auto_update
()Enable auto-update for this resource object, if currently disabled.
get_properties_local
(names[, defaults])Return the values of a set of resource properties, using default values for those that are not present in this Python object, without retrieving them from the HMC.
get_property
(name)Return the value of a resource property.
prop
(name[, default])Return the value of a resource property, applying a default if it does not exist.
pull_full_properties
()Retrieve the full set of resource properties and cache them in this object.
update_properties_local
(properties)Update the values of a set of resource properties on this Python object without propagating the updates the HMC.
- property oid
term unicode string: The object ID of this storage volume. The object ID is unique within the parent storage group.
Note that for storage volumes, the ‘name’ property is not unique and therefore cannot be used to identify a storage volume. Therefore, storage volumes provide easy access to the object ID, as a means to identify the storage volume in CLIs and other string-based tooling.
- delete(email_to_addresses=None, email_cc_addresses=None, email_insert=None)[source]
Delete this storage volume on the HMC, and optionally send emails to storage administrators requesting deletion of the storage volume on the storage subsystem and cleanup of any resources related to the storage volume (e.g. LUN mask definitions on a storage subsystem).
This method performs the “Modify Storage Group Properties” operation, requesting deletion of the volume.
Authorization requirements:
Object-access permission to the storage group owning this storage volume.
Task permission to the “Configure Storage - System Programmer” task.
- Parameters:
email_to_addresses (iterable of string) – Email addresses of one or more storage administrator to be notified. If None or empty, no email will be sent.
email_cc_addresses (iterable of string) – Email addresses of one or more storage administrator to be copied on the notification email. If None or empty, nobody will be copied on the email. Must be None or empty if email_to_addresses is None or empty.
email_insert (string) – Additional text to be inserted in the notification email. The text can include HTML formatting tags. If None, no additional text will be inserted. Must be None or empty if email_to_addresses is None or empty.
- Raises:
- update_properties(properties, email_to_addresses=None, email_cc_addresses=None, email_insert=None)[source]
Update writeable properties of this storage volume on the HMC, and optionally send emails to storage administrators requesting modification of the storage volume on the storage subsystem and of any resources related to the storage volume.
This method performs the “Modify Storage Group Properties” operation, requesting modification of the volume.
This method serializes with other methods that access or change properties on the same Python object.
Authorization requirements:
Object-access permission to the storage group owning this storage volume.
Task permission to the “Configure Storage - System Programmer” task.
- Parameters:
properties (dict) –
New property values for the volume. Allowable properties are the fields defined in the “storage-volume-request-info” nested object for the “modify” operation. That nested object is described in section “Request body contents” for operation “Modify Storage Group Properties” in the HMC API book.
The properties provided in this parameter will be copied and then amended with the operation=”modify” and element-uri properties, and then used as a single array item for the storage-volumes field in the request body of the “Modify Storage Group Properties” operation.
email_to_addresses (iterable of string) – Email addresses of one or more storage administrator to be notified. If None or empty, no email will be sent.
email_cc_addresses (iterable of string) – Email addresses of one or more storage administrator to be copied on the notification email. If None or empty, nobody will be copied on the email. Must be None or empty if email_to_addresses is None or empty.
email_insert (string) – Additional text to be inserted in the notification email. The text can include HTML formatting tags. If None, no additional text will be inserted. Must be None or empty if email_to_addresses is None or empty.
- Raises:
- indicate_fulfillment_ficon(control_unit, unit_address)[source]
TODO: Add ControlUnit objects etc for FICON support.
Indicate completion of fulfillment for this ECKD (=FICON) storage volume and provide identifying information (control unit and unit address) about the actual storage volume on the storage subsystem.
Manually indicating fulfillment is required for all ECKD volumes, because they are not auto-discovered by the CPC.
This method performs the “Fulfill FICON Storage Volume” HMC operation.
Upon successful completion of this operation, the “fulfillment-state” property of this storage volume object will have been set to “complete”. That is necessary for the CPC to be able to address and connect to the volume.
If the “fulfillment-state” properties of all storage volumes in the owning storage group are “complete”, the owning storage group’s “fulfillment-state” property will also be set to “complete”.
- Parameters:
control_unit (
ControlUnit
) – Logical control unit (LCU) in which the backing ECKD volume is defined.unit_address (string) – Unit address of the backing ECKD volume within its logical control unit, as a hexadecimal number of up to 2 characters in any lexical case.
Authorization requirements:
Object-access permission to the storage group owning this storage volume.
Task permission to the “Configure Storage - Storage Administrator” task.
- Raises:
- indicate_fulfillment_fcp(wwpn, lun, host_port)[source]
Indicate completion of fulfillment for this FCP storage volume and provide identifying information (WWPN and LUN) about the actual storage volume on the storage subsystem.
Manually indicating fulfillment is required for storage volumes that will be used as boot devices for a partition. The specified host port will be used to access the storage volume during boot of the partition.
Because the CPC discovers storage volumes automatically, the fulfillment of non-boot volumes does not need to be manually indicated using this function (it may be indicated though before the CPC discovers a working communications path to the volume, but the role of the specified host port is not clear in this case).
This method performs the “Fulfill FCP Storage Volume” HMC operation.
Upon successful completion of this operation, the “fulfillment-state” property of this storage volume object will have been set to “complete”. That is necessary for the CPC to be able to address and connect to the volume.
If the “fulfillment-state” properties of all storage volumes in the owning storage group are “complete”, the owning storage group’s “fulfillment-state” property will also be set to “complete”.
- Parameters:
wwpn (string) – World wide port name (WWPN) of the FCP storage subsystem containing the storage volume, as a hexadecimal number of up to 16 characters in any lexical case.
lun (string) – Logical Unit Number (LUN) of the storage volume within its FCP storage subsystem, as a hexadecimal number of up to 16 characters in any lexical case.
host_port (
Port
) – Storage port on the CPC that will be used to boot from.
Authorization requirements:
Object-access permission to the storage group owning this storage volume.
Task permission to the “Configure Storage - Storage Administrator” task.
- Raises:
5.14. Virtual Storage Resources
A virtual storage resource object represents a storage-related z/Architecture device that is visible to a partition and that provides access for that partition to a storage volume.
The storage-related z/Architecture devices that are visible to a partition are different for the two storage architectures: For FCP, the virtualized HBA is visible as a device, and the storage volumes (LUNs) are not represented as devices. For FICON, each ECKD volume is visible as a device, but the virtualized FICON adapter port is not represented as a device.
What the virtual storage resource objects represent, therefore depends on the storage architecture of the storage volume they are used for:
For FCP, a virtual storage resource object represents the virtualized HBA in the partition that is used to access the LUN. However, each usage of the virtual HBA in context of a storage group has its own virtual storage resource object.
For FICON, a virtual storage resource object represents the ECKD volume.
Virtual storage resource objects are instantiated automatically when a storage group is attached to a partition, and are removed automatically upon detachment.
The HBA resource objects known from DPM mode before introduction of the “dpm-storage-management” feature are no longer exposed.
Virtual storage resource objects are contained in storage group objects.
Storage groups and storage volumes only can be defined in CPCs that are in DPM mode and that have the “dpm-storage-management” feature enabled.
- class zhmcclient.VirtualStorageResourceManager(storage_group)[source]
Manager providing access to the virtual storage resources in a particular storage group.
Derived from
BaseManager
; see there for common methods and attributes.Objects of this class are not directly created by the user; they are accessible via the following instance variable of a
StorageGroup
object:Attributes:
Storage group defining the scope for this manager.
case_insensitive_names
bool
: Indicates whether the names of the resources are treated case insensitively.class_name
The resource class name
parent
Subclass of
BaseResource
: Parent resource defining the scope for this manager.resource_class
The Python class of the parent resource of this manager.
session
Session
: Session with the HMC.Methods:
list
([full_properties, filter_args])List the virtual storage resources in this storage group.
__repr__
()Return a string with the state of this manager object, for debug purposes.
dump
()Dump the resources of this resource manager as a resource definition.
find
(**filter_args)Find exactly one resource in scope of this manager, by matching resource properties against the specified filter arguments, and return its Python resource object (e.g.
find_by_name
(name)Find a resource by name (i.e.
find_local
(name, uri[, properties])Return a local resource object without fetching it from the HMC.
findall
(**filter_args)Find zero or more resources in scope of this manager, by matching resource properties against the specified filter arguments, and return a list of their Python resource objects (e.g.
flush
()Invalidate the Name-URI cache of this manager.
invalidate_cache
()Invalidate the Name-URI cache of this manager.
resource_object
(uri_or_oid[, props])Return a minimalistic Python resource object for this resource class, that is scoped to this manager.
- property storage_group
Storage group defining the scope for this manager.
- Type:
- list(full_properties=False, filter_args=None)[source]
List the virtual storage resources in this storage group.
Authorization requirements:
Object-access permission to this storage group.
- Parameters:
full_properties (bool) – Controls that the full set of resource properties for each returned storage volume is being retrieved, vs. only the following short set: “element-uri”, “name”, “device-number”, “adapter-port-uri”, and “partition-uri”.
filter_args (dict) –
Filter arguments that narrow the list of returned resources to those that match the specified filter arguments. For details, see Filtering.
None causes no filtering to happen, i.e. all resources are returned.
- Returns:
A list of
VirtualStorageResource
objects.- Raises:
- class zhmcclient.VirtualStorageResource(manager, uri, name=None, properties=None)[source]
Representation of a virtual storage resource.
Derived from
BaseResource
; see there for common methods and attributes.Objects of this class are not directly created by the user; they are returned from creation or list functions on their manager object (in this case,
VirtualStorageResourceManager
).Attributes:
The partition to which this virtual storage resource is attached.
The storage adapter port associated with this virtual storage resource, once discovery has determined which port to use for this virtual storage resource.
ceased_existence
Indicates that the corresponding object on the HMC no longer exists, if auto-update is enabled for the resource.
full_properties
A boolean indicating whether or not the resource properties in this object are the full set of resource properties.
manager
Subclass of
BaseManager
: Manager object for this resource (and for all resources of the same type in the scope of that manager).name
The name of the resource.
properties
The properties of this resource that are currently present in this Python object, as a dictionary.
properties_timestamp
The point in time of the last update of the resource properties cached in this object, as Unix time (an integer that is the number of seconds since the Unix epoch).
uri
The canonical URI path of the resource.
Methods:
update_properties
(properties)Update writeable properties of this virtual storage resource.
__repr__
()Return a string with the state of this resource, for debug purposes.
__str__
()Return a human readable string representation of this resource.
auto_update_enabled
()Return whether auto-update is currently enabled for the resource object.
cease_existence_local
()Update this Python object to indicate that the corresponding HMC object no longer exists.
disable_auto_update
()Disable auto-update for this resource object, if currently enabled.
dump
()Dump this resource with its properties and child resources (recursively) as a resource definition.
enable_auto_update
()Enable auto-update for this resource object, if currently disabled.
get_properties_local
(names[, defaults])Return the values of a set of resource properties, using default values for those that are not present in this Python object, without retrieving them from the HMC.
get_property
(name)Return the value of a resource property.
prop
(name[, default])Return the value of a resource property, applying a default if it does not exist.
pull_full_properties
()Retrieve the full set of resource properties and cache them in this object.
update_properties_local
(properties)Update the values of a set of resource properties on this Python object without propagating the updates the HMC.
- property attached_partition
The partition to which this virtual storage resource is attached.
The returned partition object has only a minimal set of properties set (‘object-id’, ‘object-uri’, ‘class’, ‘parent’).
Note that a virtual storage resource is always attached to a partition, as long as it exists.
Authorization requirements:
Object-access permission to the storage group owning this virtual storage resource.
- Raises:
- Type:
- property adapter_port
The storage adapter port associated with this virtual storage resource, once discovery has determined which port to use for this virtual storage resource.
This applies to both, FCP and FICON/ECKD typed storage groups.
The returned adapter port object has only a minimal set of properties set (‘object-id’, ‘object-uri’, ‘class’, ‘parent’).
Authorization requirements:
Object-access permission to the storage group owning this virtual storage resource.
Object-access permission to the CPC of the storage adapter.
Object-access permission to the storage adapter.
- Raises:
- Type:
- update_properties(properties)[source]
Update writeable properties of this virtual storage resource.
This method serializes with other methods that access or change properties on the same Python object.
Authorization requirements:
Object-access permission to the storage group owning this virtual storage resource.
Task permission to the “Configure Storage - System Programmer” task.
5.15. Storage Group Templates
A StorageGroupTemplate
object represents a
storage group template object and can be used to create
storage group objects with the properties of the template, including an
initial set of storage volumes, using the
zhmcclient.StorageGroupTemplateManager.create()
method.
Storage group template objects can be created, updated and deleted.
Storage group template objects can only be defined in CPCs that are in DPM mode and that have the “dpm-storage-management” feature enabled.
- class zhmcclient.StorageGroupTemplateManager(console)[source]
Manager providing access to the storage group templates of the HMC.
Derived from
BaseManager
; see there for common methods and attributes.Objects of this class are not directly created by the user; they are accessible via the following instance variable:
storage_group_templates
of aConsole
object.
Attributes:
The Console object representing the HMC.
case_insensitive_names
bool
: Indicates whether the names of the resources are treated case insensitively.class_name
The resource class name
parent
Subclass of
BaseResource
: Parent resource defining the scope for this manager.resource_class
The Python class of the parent resource of this manager.
session
Session
: Session with the HMC.Methods:
list
([full_properties, filter_args])List the storage group templates defined in the HMC.
create
(properties)Create a storage group template.
__repr__
()Return a string with the state of this manager object, for debug purposes.
dump
()Dump the resources of this resource manager as a resource definition.
find
(**filter_args)Find exactly one resource in scope of this manager, by matching resource properties against the specified filter arguments, and return its Python resource object (e.g.
find_by_name
(name)Find a resource by name (i.e.
find_local
(name, uri[, properties])Return a local resource object without fetching it from the HMC.
findall
(**filter_args)Find zero or more resources in scope of this manager, by matching resource properties against the specified filter arguments, and return a list of their Python resource objects (e.g.
flush
()Invalidate the Name-URI cache of this manager.
invalidate_cache
()Invalidate the Name-URI cache of this manager.
resource_object
(uri_or_oid[, props])Return a minimalistic Python resource object for this resource class, that is scoped to this manager.
- list(full_properties=False, filter_args=None)[source]
List the storage group templates defined in the HMC.
Storage group templates for which the authenticated user does not have object-access permission are not included.
Authorization requirements:
Object-access permission to any storage group templates to be included in the result.
- Parameters:
full_properties (bool) – Controls that the full set of resource properties for each returned storage group template is being retrieved, vs. only the following short set: “object-uri”, “cpc-uri”, “name”, and “type”.
filter_args (dict) –
Filter arguments that narrow the list of returned resources to those that match the specified filter arguments. For details, see Filtering.
None causes no filtering to happen.
- Returns:
A list of
StorageGroupTemplate
objects.- Raises:
- create(properties)[source]
Create a storage group template.
The new storage group will be associated with the CPC identified by the cpc-uri input property.
Authorization requirements:
Object-access permission to the CPC that will be associated with the new storage group template.
Task permission to the “Configure Storage - System Programmer” task.
- Parameters:
properties (dict) –
Initial property values. Allowable properties are defined in section ‘Request body contents’ in section ‘Create Storage Template’ in the HMC API book.
The ‘cpc-uri’ property identifies the CPC to which the new storage group template will be associated, and is required to be specified in this parameter.
- Returns:
The resource object for the new storage group template. The object will have its ‘object-uri’ property set as returned by the HMC, and will also have the input properties set.
- Return type:
- Raises:
- class zhmcclient.StorageGroupTemplate(manager, uri, name=None, properties=None)[source]
Representation of a storage group template.
Derived from
BaseResource
; see there for common methods and attributes.Objects of this class are not directly created by the user; they are returned from creation or list functions on their manager object (in this case,
StorageGroupTemplateManager
).Attributes:
Access to the storage volumes in this storage group.
The CPC to which this storage group template is associated.
ceased_existence
Indicates that the corresponding object on the HMC no longer exists, if auto-update is enabled for the resource.
full_properties
A boolean indicating whether or not the resource properties in this object are the full set of resource properties.
manager
Subclass of
BaseManager
: Manager object for this resource (and for all resources of the same type in the scope of that manager).name
The name of the resource.
properties
The properties of this resource that are currently present in this Python object, as a dictionary.
properties_timestamp
The point in time of the last update of the resource properties cached in this object, as Unix time (an integer that is the number of seconds since the Unix epoch).
uri
The canonical URI path of the resource.
Methods:
delete
()Delete this storage group template and its storage volume template resources on the HMC.
update_properties
(properties)Update writeable properties of this storage group template.
__repr__
()Return a string with the state of this resource, for debug purposes.
__str__
()Return a human readable string representation of this resource.
auto_update_enabled
()Return whether auto-update is currently enabled for the resource object.
cease_existence_local
()Update this Python object to indicate that the corresponding HMC object no longer exists.
disable_auto_update
()Disable auto-update for this resource object, if currently enabled.
dump
()Dump this resource with its properties and child resources (recursively) as a resource definition.
enable_auto_update
()Enable auto-update for this resource object, if currently disabled.
get_properties_local
(names[, defaults])Return the values of a set of resource properties, using default values for those that are not present in this Python object, without retrieving them from the HMC.
get_property
(name)Return the value of a resource property.
prop
(name[, default])Return the value of a resource property, applying a default if it does not exist.
pull_full_properties
()Retrieve the full set of resource properties and cache them in this object.
update_properties_local
(properties)Update the values of a set of resource properties on this Python object without propagating the updates the HMC.
- property storage_volume_templates
Access to the storage volumes in this storage group.
- Type:
- property cpc
The CPC to which this storage group template is associated.
The returned
Cpc
has only a minimal set of properties populated.- Type:
- delete()[source]
Delete this storage group template and its storage volume template resources on the HMC.
Storage groups and their volumes that have been created from the template that is deleted, are not affected.
Authorization requirements:
Object-access permission to this storage group template.
Task permission to the “Configure Storage - System Programmer” task.
- Raises:
- update_properties(properties)[source]
Update writeable properties of this storage group template.
This includes the storage-template-volumes property which contains requests for creations, deletions and updates of
StorageVolumeTemplate
resources of this storage group template.As an alternative to this bulk approach for managing storage volume templates, each
StorageVolumeTemplate
resource can individually be created, deleted and updated using the respective methods onstorage_volume_templates
.This method serializes with other methods that access or change properties on the same Python object.
Authorization requirements:
Object-access permission to this storage group template.
Task permission to the “Configure Storage - System Programmer” task.
5.16. Storage Volume Templates
A StorageVolumeTemplate
object represents a
storage volume template for FCP or FICON (ECKD) that is defined in a
storage group template.
Storage volume template objects can be created, updated and deleted.
Storage volume templates are contained in storage group templates.
You can create as many storage volume templates as you want in a storage group template. When creating a storage group from the storage group template, each storage volume template will cause a storage volume to be created in the new storage group.
Storage group templates and storage volume templates only can be defined in CPCs that are in DPM mode and that have the “dpm-storage-management” feature enabled.
- class zhmcclient.StorageVolumeTemplateManager(storage_group_template)[source]
Manager providing access to the storage volume templates in a particular storage group template.
Derived from
BaseManager
; see there for common methods and attributes.Objects of this class are not directly created by the user; they are accessible via the following instance variable of a
StorageGroupTemplate
object:Attributes:
StorageGroupTemplate
: Storage group template defining the scope for this manager.case_insensitive_names
bool
: Indicates whether the names of the resources are treated case insensitively.class_name
The resource class name
parent
Subclass of
BaseResource
: Parent resource defining the scope for this manager.resource_class
The Python class of the parent resource of this manager.
session
Session
: Session with the HMC.Methods:
list
([full_properties, filter_args])List the storage volume templates in this storage group template.
create
(properties)Create a storage volume template in this storage group template on the HMC.
__repr__
()Return a string with the state of this manager object, for debug purposes.
dump
()Dump the resources of this resource manager as a resource definition.
find
(**filter_args)Find exactly one resource in scope of this manager, by matching resource properties against the specified filter arguments, and return its Python resource object (e.g.
find_by_name
(name)Find a resource by name (i.e.
find_local
(name, uri[, properties])Return a local resource object without fetching it from the HMC.
findall
(**filter_args)Find zero or more resources in scope of this manager, by matching resource properties against the specified filter arguments, and return a list of their Python resource objects (e.g.
flush
()Invalidate the Name-URI cache of this manager.
invalidate_cache
()Invalidate the Name-URI cache of this manager.
resource_object
(uri_or_oid[, props])Return a minimalistic Python resource object for this resource class, that is scoped to this manager.
- property storage_group_template
StorageGroupTemplate
: Storage group template defining the scope for this manager.
- list(full_properties=False, filter_args=None)[source]
List the storage volume templates in this storage group template.
Authorization requirements:
Object-access permission to this storage group template.
- Parameters:
full_properties (bool) – Controls that the full set of resource properties for each returned storage volume template is being retrieved, vs. only the following short set: “element-uri”, “name”, “size”, and “usage”.
filter_args (dict) –
Filter arguments that narrow the list of returned resources to those that match the specified filter arguments. For details, see Filtering.
None causes no filtering to happen, i.e. all resources are returned.
- Returns:
A list of
StorageVolumeTemplate
objects.- Raises:
- create(properties)[source]
Create a storage volume template in this storage group template on the HMC.
This method performs the “Modify Storage Template Properties” operation, requesting creation of the volume.
Authorization requirements:
Object-access permission to this storage group template.
Task permission to the “Configure Storage - System Programmer” task.
- Parameters:
properties (dict) –
Initial property values for the new volume template.
Allowable properties are the fields defined in the “storage-template-volume-request-info” nested object described for operation “Modify Storage Template Properties” in the HMC API book. The valid fields are those for the “create” operation. The operation field must not be provided; it is set automatically to the value “create”.
The properties provided in this parameter will be copied and then amended with the operation=”create” field, and then used as a single array item for the storage-template-volumes field in the request body of the “Modify Storage Template Properties” operation.
- Returns:
The resource object for the new storage volume template. The object will have the following properties set:
’element-uri’ as returned by the HMC
’element-id’ as determined from the ‘element-uri’ property
’class’ and ‘parent’
additional properties as specified in the input properties
- Return type:
- Raises:
Example:
stovol1 = fcp_stogrp.storage_volume_templates.create( properties=dict( name='vol1', size=30, # GiB ))
- class zhmcclient.StorageVolumeTemplate(manager, uri, name=None, properties=None)[source]
Representation of a storage volume template.
Derived from
BaseResource
; see there for common methods and attributes.Objects of this class are not directly created by the user; they are returned from creation or list functions on their manager object (in this case,
StorageVolumeTemplateManager
).Methods:
delete
()Delete this storage volume template on the HMC.
update_properties
(properties)Update writeable properties of this storage volume template on the HMC.
__repr__
()Return a string with the state of this resource, for debug purposes.
__str__
()Return a human readable string representation of this resource.
auto_update_enabled
()Return whether auto-update is currently enabled for the resource object.
cease_existence_local
()Update this Python object to indicate that the corresponding HMC object no longer exists.
disable_auto_update
()Disable auto-update for this resource object, if currently enabled.
dump
()Dump this resource with its properties and child resources (recursively) as a resource definition.
enable_auto_update
()Enable auto-update for this resource object, if currently disabled.
get_properties_local
(names[, defaults])Return the values of a set of resource properties, using default values for those that are not present in this Python object, without retrieving them from the HMC.
get_property
(name)Return the value of a resource property.
prop
(name[, default])Return the value of a resource property, applying a default if it does not exist.
pull_full_properties
()Retrieve the full set of resource properties and cache them in this object.
update_properties_local
(properties)Update the values of a set of resource properties on this Python object without propagating the updates the HMC.
Attributes:
ceased_existence
Indicates that the corresponding object on the HMC no longer exists, if auto-update is enabled for the resource.
full_properties
A boolean indicating whether or not the resource properties in this object are the full set of resource properties.
manager
Subclass of
BaseManager
: Manager object for this resource (and for all resources of the same type in the scope of that manager).name
The name of the resource.
properties
The properties of this resource that are currently present in this Python object, as a dictionary.
properties_timestamp
The point in time of the last update of the resource properties cached in this object, as Unix time (an integer that is the number of seconds since the Unix epoch).
uri
The canonical URI path of the resource.
- delete()[source]
Delete this storage volume template on the HMC.
This method performs the “Modify Storage Template Properties” operation, requesting deletion of the volume template.
Authorization requirements:
Object-access permission to the storage group template owning this storage volume template.
Task permission to the “Configure Storage - System Programmer” task.
- Raises:
- update_properties(properties)[source]
Update writeable properties of this storage volume template on the HMC.
This method performs the “Modify Storage Template Properties” operation, requesting modification of the volume.
This method serializes with other methods that access or change properties on the same Python object.
Authorization requirements:
Object-access permission to the storage group template owning this storage volume template.
Task permission to the “Configure Storage - System Programmer” task.
- Parameters:
properties (dict) –
New property values for the volume. Allowable properties are the fields defined in the “storage-template-volume-request-info” nested object for the “modify” operation. That nested object is described in operation “Modify Storage Template Properties” in the HMC API book.
The properties provided in this parameter will be copied and then amended with the operation=”modify” and element-uri properties, and then used as a single array item for the storage-template-volumes field in the request body of the “Modify Storage Template Properties” operation.
- Raises:
5.17. Capacity Groups
A Capacity Group is a group of partitions that allows defining a capping for the total amount of physical processors consumed by the Partitions in the group. The Partitions must be defined with shared processors, and a Partition can be a member of at most one Capacity Group.
Capacity Group resources are contained in CPC resources.
Capacity Groups only exist in CPCs that are in DPM mode.
- class zhmcclient.CapacityGroupManager(cpc)[source]
Manager providing access to the Capacity Groups in a particular CPC.
Derived from
BaseManager
; see there for common methods and attributes.Objects of this class are not directly created by the user; they are accessible via the following instance variable of a
Cpc
object (in DPM mode):Attributes:
CPC defining the scope for this manager.
case_insensitive_names
bool
: Indicates whether the names of the resources are treated case insensitively.class_name
The resource class name
parent
Subclass of
BaseResource
: Parent resource defining the scope for this manager.resource_class
The Python class of the parent resource of this manager.
session
Session
: Session with the HMC.Methods:
list
([full_properties, filter_args])List the Capacity Groups in this CPC.
create
(properties)Create a Capacity Group in this CPC.
__repr__
()Return a string with the state of this manager object, for debug purposes.
dump
()Dump the resources of this resource manager as a resource definition.
find
(**filter_args)Find exactly one resource in scope of this manager, by matching resource properties against the specified filter arguments, and return its Python resource object (e.g.
find_by_name
(name)Find a resource by name (i.e.
find_local
(name, uri[, properties])Return a local resource object without fetching it from the HMC.
findall
(**filter_args)Find zero or more resources in scope of this manager, by matching resource properties against the specified filter arguments, and return a list of their Python resource objects (e.g.
flush
()Invalidate the Name-URI cache of this manager.
invalidate_cache
()Invalidate the Name-URI cache of this manager.
resource_object
(uri_or_oid[, props])Return a minimalistic Python resource object for this resource class, that is scoped to this manager.
- list(full_properties=False, filter_args=None)[source]
List the Capacity Groups in this CPC.
Authorization requirements:
Object-access permission to this CPC.
- Parameters:
full_properties (bool) – Controls whether the full set of resource properties should be retrieved, vs. only the short set as returned by the list operation.
filter_args (dict) –
Filter arguments that narrow the list of returned resources to those that match the specified filter arguments. For details, see Filtering.
None causes no filtering to happen, i.e. all resources are returned.
- Returns:
A list of
CapacityGroup
objects.- Raises:
- create(properties)[source]
Create a Capacity Group in this CPC.
The new Capacity Group initially has no partitions.
Authorization requirements:
Object-access permission to this CPC.
Task permission to the “Manage Processor Sharing” task.
- Parameters:
properties (dict) – Initial property values. Allowable properties are defined in section ‘Request body contents’ in section ‘Create Capacity Group’ in the HMC API book.
- Returns:
The resource object for the new Capacity Group. The object will have its ‘element-uri’ property set as returned by the HMC, and will also have the input properties set.
- Return type:
- Raises:
- class zhmcclient.CapacityGroup(manager, uri, name=None, properties=None)[source]
Representation of a Capacity Group.
Derived from
BaseResource
; see there for common methods and attributes.For the properties of a Capacity Group resource, see section ‘Data model’ in section ‘Capacity Group element object’ in