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 bool
Byte, Integer, Long, Short integer
Float float
String, String Enum unicode string
timestamp integer
Array list
Object dict

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:

Methods

find 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 Find a resource by name (i.e.
findall 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.
list List the CPCs managed by the HMC this client is connected to.
resource_object Return a minimalistic Python resource object for this resource class, that is scoped to this manager.

Attributes

class_name The resource class name
client The client defining the scope for this manager.
console The Console representing the HMC this CPC is managed by.
parent Parent resource defining the scope for this manager.
resource_class The Python class of the parent resource of this manager.
session Session with the HMC.

Details

client

The client defining the scope for this manager.

Type:Client
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() or prop() to access any properties regardless of whether they are already set or first need to be retrieved.

Type:Console
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).

Methods

add_temporary_capacity Add temporary processors to the CPC or increase temporary model capacity of the CPC.
export_profiles Export activation profiles and/or system activity profiles from this CPC to the SE hard drive using the HMC operation “Export Profiles”.
feature_enabled Indicates whether the specified feature is enabled for this CPC.
feature_info Returns information about the features available for this CPC.
get_energy_management_properties Return the energy management properties of the CPC.
get_free_crypto_domains Return a list of crypto domains that are free for usage on a list of crypto adapters in this CPC.
get_property Return the value of a resource property.
get_wwpns Return the WWPNs of the host ports (of the HBAs) of the specified Partitions of this CPC.
import_profiles 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”.
list_associated_storage_groups Return the storage groups that are associated to this CPC.
prop 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.
remove_temporary_capacity Remove temporary processors from the CPC or decrease temporary model capacity of the CPC.
set_power_capping Set the power capping settings of this CPC.
set_power_save Set the power save setting of this CPC.
start Start this CPC, using the HMC operation “Start CPC”.
stop Stop this CPC, using the HMC operation “Stop CPC”.
update_properties Update writeable properties of this CPC.
validate_lun_path 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.

Attributes

adapters Access to the Adapters in this CPC.
dpm_enabled Indicates whether this CPC is currently in DPM mode (Dynamic Partition Manager mode).
full_properties A boolean indicating whether or not the resource properties in this object are the full set of resource properties.
image_activation_profiles Access to the Image Activation Profiles in this CPC.
load_activation_profiles Access to the Load Activation Profiles in this CPC.
lpars Access to the LPARs in this CPC.
manager Manager object for this resource (and for all resources of the same type in the scope of that manager).
maximum_active_partitions The maximum number of active logical partitions or partitions of this CPC.
name The name of the resource.
partitions Access to the Partitions in this CPC.
properties The properties of this resource that are currently present in this
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).
reset_activation_profiles Access to the Reset Activation Profiles in this CPC.
uri The canonical URI path of the resource.
virtual_switches Access to the Virtual Switches in this CPC.
vswitches Access to the Virtual Switches in this CPC.

Details

lpars

Access to the LPARs in this CPC.

Type:LparManager
partitions

Access to the Partitions in this CPC.

Type:PartitionManager
adapters

Access to the Adapters in this CPC.

Type:AdapterManager
virtual_switches

Access to the Virtual Switches in this CPC.

Type:VirtualSwitchManager
vswitches

Access to the Virtual Switches in this CPC.

Deprecated: This attribute is deprecated and using it will cause a exceptions.DeprecationWarning to be issued. Use virtual_switches instead.

Type:VirtualSwitchManager
reset_activation_profiles

Access to the Reset Activation Profiles in this CPC.

Type:ActivationProfileManager
image_activation_profiles

Access to the Image Activation Profiles in this CPC.

Type:ActivationProfileManager
load_activation_profiles

Access to the Load Activation Profiles in this CPC.

Type:ActivationProfileManager
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:

bool

maximum_active_partitions

The maximum number of active logical partitions or partitions of this CPC.

The following table shows the maximum number of active logical partitions or partitions by machine generations supported at the HMC API:

Machine generation Maximum partitions
z196 60
z114 30
zEC12 60
zBC12 30
z13 / Emperor 85
z13s / Rockhopper 40
z14 / Emperor II 85
z14-ZR1 / -LR1 40
z15-T01 / -LT1 / -GT2 85
z15-T02 / -LT2 40
Raises:
Type:

Integer

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:

bool

Raises:
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:

iterable

Raises:
update_properties(properties)[source]

Update writeable properties of this CPC.

Authorization requirements:

  • Object-access permission to this CPC.
  • Task permission for the “CPC Details” 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 ‘CPC’ in the HMC API book.

Raises:
start(wait_for_completion=True, operation_timeout=None)[source]

Start this CPC, using the HMC operation “Start CPC”.

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:
stop(wait_for_completion=True, operation_timeout=None)[source]

Stop this CPC, using the HMC operation “Stop CPC”.

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:
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:
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:
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 if crypto_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:
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:
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:

dict

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.
  • AuthError
  • ConnectionError
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:
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 its reason 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:

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:

Methods

find 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 Find a resource by name (i.e.
findall 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.
list List the unmanaged CPCs exposed by the HMC this client is connected to.
resource_object Return a minimalistic Python resource object for this resource class, that is scoped to this manager.

Attributes

class_name The resource class name
console Console defining the scope for this manager.
parent Parent resource defining the scope for this manager.
resource_class The Python class of the parent resource of this manager.
session Session with the HMC.

Details

console

Console defining the scope for this manager.

Type:Console
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

get_property Return the value of a resource property.
prop 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.

Attributes

full_properties A boolean indicating whether or not the resource properties in this object are the full set of resource properties.
manager 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
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.

Details

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:

  1. 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.
  2. 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.
  3. 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):

Methods

find 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 Find a resource by name (i.e.
findall 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.
list List the Activation Profiles of this CPC, of the profile type managed by this object.
resource_object Return a minimalistic Python resource object for this resource class, that is scoped to this manager.

Attributes

class_name The resource class name
cpc CPC defining the scope for this manager.
parent Parent resource defining the scope for this manager.
profile_type Type of the Activation Profiles managed by this object:
resource_class The Python class of the parent resource of this manager.
session Session with the HMC.

Details

cpc

CPC defining the scope for this manager.

Type:Cpc
profile_type

Type of the Activation Profiles managed by this object:

  • 'reset' - Reset Activation Profiles
  • 'image' - Image Activation Profiles
  • 'load' - Load Activation Profiles
Type:string
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

get_property Return the value of a resource property.
prop 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 Update writeable properties of this Activation Profile.

Attributes

full_properties A boolean indicating whether or not the resource properties in this object are the full set of resource properties.
manager 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
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.

Details

update_properties(properties)[source]

Update writeable properties of this Activation Profile.

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):

Methods

find 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 Find a resource by name (i.e.
findall 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.
list List the LPARs in this CPC.
resource_object Return a minimalistic Python resource object for this resource class, that is scoped to this manager.

Attributes

class_name The resource class name
cpc CPC defining the scope for this manager.
parent Parent resource defining the scope for this manager.
resource_class The Python class of the parent resource of this manager.
session Session with the HMC.

Details

cpc

CPC defining the scope for this manager.

Type:Cpc
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

activate Activate (start) this LPAR, using the HMC operation “Activate Logical Partition”.
deactivate De-activate (stop) this LPAR, using the HMC operation “Deactivate Logical Partition”.
get_property Return the value of a resource property.
load Load (boot) this LPAR from a load address (boot device), using the HMC operation “Load Logical Partition”.
open_os_message_channel Open a JMS message channel to this LPAR’s operating system, returning the string “topic” representing the message channel.
prop Return the value of a resource property, applying a default if it does not exist.
psw_restart Restart this LPAR, using the HMC operation “PSW Restart”.
pull_full_properties Retrieve the full set of resource properties and cache them in this object.
reset_clear Initialize this LPAR by clearing its pending interruptions, resetting its channel subsystem, and resetting its processors, using the HMC operation “Reset Clear”.
scsi_dump Load a standalone dump program from a designated SCSI device in this LPAR, using the HMC operation “SCSI Dump”.
scsi_load Load (boot) this LPAR from a designated SCSI device, using the HMC operation “SCSI Load”.
send_os_command Send a command to the operating system running in this LPAR.
stop Stop this LPAR, using the HMC operation “Stop Logical Partition”.
update_properties Update writeable properties of this LPAR.
wait_for_status Wait until the status of this LPAR has a desired value.

Attributes

full_properties A boolean indicating whether or not the resource properties in this object are the full set of resource properties.
manager 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
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.

Details

update_properties(properties)[source]

Update writeable properties of this LPAR.

Authorization requirements:

  • Object-access permission to this LPAR.
  • Task permission for the “Change Object Definition” task.
  • Object-access permission to the CPC of this LPAR.
  • For an LPAR whose activation-mode is “zaware”, task permission for the “Firmware Details” 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 ‘Logical Partition object’ in the HMC API book.

Raises:
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 if allow_status_exceptions was set additionally in the state “exceptions”.

Authorization requirements:

  • Object-access permission to the CPC containing this LPAR.
  • Object-access permission to 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 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:
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 the CPC containing this LPAR.
  • Object-access permission to 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:
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)[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 the CPC containing this LPAR.
  • Object-access permission to 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.
  • 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.
  • operating_system_specific_load_parameters (string) – Optional operating system specific load parameters to be used for the SCSI Load.
  • boot_record_logical_block_address (string) – Optional hexadecimal boot record logical block address to be used for the SCSI Load.
  • force (bool) – Boolean controlling whether this operation is permitted when the LPAR is in the “operating” status. The default value is True.
  • 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:
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)[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 the CPC containing this LPAR.
  • Object-access permission to 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 Load.
  • load_parameter (string) – Optional load control string. If empty string or None, it is not passed to the HMC.
  • 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.
  • operating_system_specific_load_parameters (string) – Optional operating system specific load parameters to be used for the SCSI Load.
  • boot_record_logical_block_address (string) – Optional hexadecimal boot record logical block address to be used for the SCSI Load.
  • os_ipl_token (string) – Optional hexadecimal value to be used for the SCSI dump.
  • 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:
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 the CPC containing this LPAR.
  • Object-access permission to 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.
  • 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:
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 “operating”, or if allow_status_exceptions was set additionally in the state “exceptions”.

Authorization requirements:

  • Object-access permission to the CPC containing this LPAR.
  • Object-access permission to 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 “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:
reset_clear(force=False, wait_for_completion=True, operation_timeout=None, status_timeout=None, allow_status_exceptions=False)[source]

Initialize this LPAR by clearing its pending interruptions, resetting its channel subsystem, and resetting its processors, 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 the CPC containing this LPAR.
  • Object-access permission to 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.
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:
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.

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:

string

Raises:
send_os_command(os_command_text, is_priority=False)[source]

Send a command to the operating system running in this LPAR.

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 the CPC containing this LPAR.
  • Object-access permission to 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:
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:

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):

Methods

create Create and configure a Partition in this CPC.
find 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 Find a resource by name (i.e.
findall 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.
list List the Partitions in this CPC.
resource_object Return a minimalistic Python resource object for this resource class, that is scoped to this manager.

Attributes

class_name The resource class name
cpc CPC defining the scope for this manager.
parent Parent resource defining the scope for this manager.
resource_class The Python class of the parent resource of this manager.
session Session with the HMC.

Details

cpc

CPC defining the scope for this manager.

Type:Cpc
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:

Partition

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).

Methods

attach_storage_group Attach a storage group to this partition.
change_crypto_domain_config Change the access mode for a crypto domain that is currently included in the crypto configuration of this partition.
decrease_crypto_config Remove crypto adapters and/or crypto domains from the crypto configuration of this partition.
delete Delete this Partition.
detach_storage_group Detach a storage group from this partition.
dump_partition Dump this Partition, by loading a standalone dump program from a SCSI device and starting its execution, using the HMC operation ‘Dump Partition’.
feature_enabled Indicates whether the specified feature is enabled for the CPC of this partition.
feature_info Returns information about the features available for the CPC of this partition.
get_property Return the value of a resource property.
increase_crypto_config Add crypto adapters and/or crypto domains to the crypto configuration of this partition.
list_attached_storage_groups Return the storage groups that are attached to this partition.
mount_iso_image Upload an ISO image and associate it to this Partition using the HMC operation ‘Mount 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.
prop Return the value of a resource property, applying a default if it does not exist.
psw_restart Initiates a PSW restart for this Partition, using the HMC operation ‘Perform PSW Restart’.
pull_full_properties Retrieve the full set of resource properties and cache them in this object.
send_os_command Send a command to the operating system running in this partition.
start Start (activate) this Partition, using the HMC operation “Start Partition”.
stop Stop (deactivate) this Partition, using the HMC operation “Stop Partition”.
unmount_iso_image Unmount the currently mounted ISO from this Partition using the HMC operation ‘Unmount ISO Image’.
update_properties Update writeable properties of this Partition.
wait_for_status Wait until the status of this partition has a desired value.
zeroize_crypto_domain Zeroize a single crypto domain on a crypto adapter.

Attributes

full_properties A boolean indicating whether or not the resource properties in this object are the full set of resource properties.
hbas Access to the HBAs in this Partition.
manager 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.
nics Access to the NICs in this Partition.
properties The properties of this resource that are currently present in this
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.
virtual_functions Access to the Virtual Functions in this Partition.

Details

nics

Access to the NICs in this Partition.

Type:NicManager
hbas

Access to the HBAs in this Partition.

If the “dpm-storage-management” feature is enabled, this property is None.

Type:HbaManager
virtual_functions

Access to the Virtual Functions in this Partition.

Type:VirtualFunctionManager
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:

bool

Raises:
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:

iterable

Raises:
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.
  • Object-access permission to the CPC containing 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:

dict or Job

Raises:
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:

dict or Job

Raises:
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.

Authorization requirements:

  • Object-access permission to this Partition.
  • Task permission to the “Partition Details” 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 ‘Partition object’ in the HMC API book.

Raises:
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’.

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:

dict or Job

Raises:
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:

dict or Job

Raises:
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.

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:

string

Raises:
send_os_command(os_command_text, is_priority=False)[source]

Send a command to the operating system running in this partition.

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:
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.
  • 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.
  • 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:
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 and to the Crypto Adapter.
  • Task permission to the “Zeroize Crypto Domain” task.
Parameters:
  • crypto_adapter (Adapter) – Crypto adapter with the crypto domain to be zeroized.
  • crypto_domain_index (integer) – Domain index of the crypto domain to be zeroized.
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.
  • Task permission to the “Partition Details” task.
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:

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:

  1. 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.
  2. 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.
  3. 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.
  4. 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):

Methods

create_hipersocket Create and configure a HiperSockets Adapter in this CPC.
find 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 Find a resource by name (i.e.
findall 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.
list List the Adapters in this CPC.
resource_object Return a minimalistic Python resource object for this resource class, that is scoped to this manager.

Attributes

class_name The resource class name
cpc CPC defining the scope for this manager.
parent Parent resource defining the scope for this manager.
resource_class The Python class of the parent resource of this manager.
session Session with the HMC.

Details

cpc

CPC defining the scope for this manager.

Type:Cpc
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:

Adapter

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).

Methods

change_adapter_type Reconfigures an adapter from one type to another, or to ungonfigured.
change_crypto_type Reconfigures a cryptographic adapter to a different crypto type.
delete Delete this Adapter.
get_property Return the value of a resource property.
prop 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 Update writeable properties of this Adapter.

Attributes

full_properties A boolean indicating whether or not the resource properties in this object are the full set of resource properties.
manager Manager object for this resource (and for all resources of the same type in the scope of that manager).
maximum_crypto_domains The maximum number of crypto domains on this crypto adapter.
name The name of the resource.
port_type_by_family
port_uri_segment Adapter type specific URI segment for adapter port URIs, or the empty string (‘’) for adapters without ports.
port_uri_segment_by_family
port_uris_prop Name of adapter property that specifies the adapter port URIs, or the empty string (‘’) for adapters without ports.
port_uris_prop_by_family
ports Access to the Ports of this Adapter.
properties The properties of this resource that are currently present in this
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.

Details

ports

Access to the Ports of this Adapter.

Type:PortManager
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:string
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:string
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 z14 (3) / z13 (1) 85
Crypto Express 5S z14-ZR1 (4) / z13s (2) 40
Crypto Express 6S z14 (3) 85
Crypto Express 6S z14-ZR1 (4) 40

Notes:

  1. Supported for z13 and LinuxONE Emperor
  2. Supported for z13s and LinuxONE Rockhopper
  3. Supported for z14 and LinuxONE Emperor II
  4. Supported for z14-ZR1 and LinuxONE Rockhopper II

If this adapter is not a crypto adapter, None is returned.

If the crypto adapter card type is not known, ValueError is raised.

Raises:
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.

Authorization requirements:

  • Object-access permission to the Adapter.
  • Task permission for the “Adapter Details” 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 ‘Adapter object’ in the HMC API book.

Raises:
__repr__()[source]

Return a string with the state of this Adapter, for debug purposes.

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:

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).

Methods

find 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 Find a resource by name (i.e.
findall 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.
list List the Ports of this Adapter.
resource_object Return a minimalistic Python resource object for this resource class, that is scoped to this manager.

Attributes

adapter Adapter defining the scope for this manager.
class_name The resource class name
parent Parent resource defining the scope for this manager.
port_type Type of the Ports managed by this object:
resource_class The Python class of the parent resource of this manager.
session Session with the HMC.

Details

adapter

Adapter defining the scope for this manager.

Type:Adapter
port_type

Type of the Ports managed by this object:

  • 'network' - Ports of a network adapter
  • 'storage' - Ports of a storage adapter
  • None - Adapter family without ports
Type:string
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

get_property Return the value of a resource property.
prop 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 Update writeable properties of this Port.

Attributes

full_properties A boolean indicating whether or not the resource properties in this object are the full set of resource properties.
manager 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
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.

Details

update_properties(properties)[source]

Update writeable properties of this Port.

Authorization requirements:

  • Object-access permission to the Adapter of this Port.
  • Task permission to the “Adapter Details” 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 - Port Element Object’ in the HMC API book.

Raises:

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):

Methods

create Create and configure a NIC in this Partition.
find 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 Find a resource by name (i.e.
findall 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.
list List the NICs in this Partition.
resource_object Return a minimalistic Python resource object for this resource class, that is scoped to this manager.

Attributes

class_name The resource class name
parent Parent resource defining the scope for this manager.
partition Partition defining the scope for this manager.
resource_class The Python class of the parent resource of this manager.
session Session with the HMC.

Details

partition

Partition defining the scope for this manager.

Type:Partition
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:

Nic

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.
get_property Return the value of a resource property.
prop 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 Update writeable properties of this NIC.

Attributes

full_properties A boolean indicating whether or not the resource properties in this object are the full set of resource properties.
manager 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
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.

Details

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.

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.
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 - NIC Element Object’ in the HMC API book.

Raises:

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.

Methods

create Create and configure an HBA in this Partition.
find 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 Find a resource by name (i.e.
findall 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.
list List the HBAs in this Partition.
resource_object Return a minimalistic Python resource object for this resource class, that is scoped to this manager.

Attributes

class_name The resource class name
parent Parent resource defining the scope for this manager.
partition Partition defining the scope for this manager.
resource_class The Python class of the parent resource of this manager.
session Session with the HMC.

Details

partition

Partition defining the scope for this manager.

Type:Partition
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:

Hba

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.
get_property Return the value of a resource property.
prop 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.
reassign_port Reassign this HBA to a new underlying FCP port.
update_properties Update writeable properties of this HBA.

Attributes

full_properties A boolean indicating whether or not the resource properties in this object are the full set of resource properties.
manager 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
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.

Details

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.

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.
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 - HBA Element Object’ in the HMC API book.

Raises:
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.
Parameters:

port (Port) – FCP port to be used.

Raises:

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):

Methods

create Create a Virtual Function in this Partition.
find 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 Find a resource by name (i.e.
findall 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.
list List the Virtual Functions of this Partition.
resource_object Return a minimalistic Python resource object for this resource class, that is scoped to this manager.

Attributes

class_name The resource class name
parent Parent resource defining the scope for this manager.
partition Partition defining the scope for this manager.
resource_class The Python class of the parent resource of this manager.
session Session with the HMC.

Details

partition

Partition defining the scope for this manager.

Type:Partition
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:

VirtualFunction

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.
get_property Return the value of a resource property.
prop 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 Update writeable properties of this Virtual Function.

Attributes

full_properties A boolean indicating whether or not the resource properties in this object are the full set of resource properties.
manager 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
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.

Details

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.

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.
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 - Virtual Function element object’ in the HMC API book.

Raises:

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):

Methods

find 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 Find a resource by name (i.e.
findall 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.
list List the Virtual Switches in this CPC.
resource_object Return a minimalistic Python resource object for this resource class, that is scoped to this manager.

Attributes

class_name The resource class name
cpc CPC defining the scope for this manager.
parent Parent resource defining the scope for this manager.
resource_class The Python class of the parent resource of this manager.
session Session with the HMC.

Details

cpc

CPC defining the scope for this manager.

Type:Cpc
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

get_connected_nics List the NICs connected to this Virtual Switch.
get_property Return the value of a resource property.
prop 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 Update writeable properties of this Virtual Switch.

Attributes

full_properties A boolean indicating whether or not the resource properties in this object are the full set of resource properties.
manager 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
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.

Details

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.
Returns:

A list of Nic objects. These objects will be connected in the resource tree (i.e. have a parent Partition object, etc.) and will have the following properties set:

  • element-uri
  • element-id
  • parent
  • class

Raises:
update_properties(properties)[source]

Update writeable properties of this Virtual Switch.

Authorization requirements:

  • Object-access permission to the backing Adapter of this Virtual Switch.
  • Task permission for the “Manage Adapters” 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 ‘Virtual Switch object’ in the HMC API book.

Raises:

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:

console

The Console object representing the HMC.

Type:Console
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 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:

StorageGroup

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).

storage_volumes

Access to the storage volumes in this storage group.

Type:StorageVolumeManager
virtual_storage_resources

Access to the virtual storage resources in this storage group.

Type:VirtualStorageResourceManager
cpc

The CPC to which this storage group is associated.

The returned Cpc has only a minimal set of properties populated.

Type:Cpc
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:
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, each StorageVolume resource can individually be created, deleted and updated using the respective methods on storage_volumes.

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.
Parameters:

ports (list) – List of Port objects representing the ports to be added. All specified ports must not already be members of this storage group’s candidate adapter ports list.

Raises:
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.
Parameters:

ports (list) – List of Port objects representing the ports to be removed. All specified ports must currently be members of this storage group’s candidate adapter ports list and must not be referenced by any of the group’s virtual storage resources.

Raises:
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:
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:

json object

Raises:

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:

storage_group

Storage group defining the scope for this manager.

Type:StorageGroup
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:

StorageVolume

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).

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.

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:

storage_group

Storage group defining the scope for this manager.

Type:StorageGroup
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).

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:

Partition

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:

Port

update_properties(properties)[source]

Update writeable properties of this virtual storage resource.

Authorization requirements:

  • Object-access permission to the storage group owning this virtual storage resource.
  • 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 the properties with qualifier (w) in section ‘Data model’ in section ‘Virtual Storage Resource object’ in the HMC API book.

Raises:

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:

console

The Console object representing the HMC.

Type:Console
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:

StorageGroupTemplate

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).

storage_volume_templates

Access to the storage volumes in this storage group.

Type:StorageVolumeManager
cpc

The CPC to which this storage group template is associated.

The returned Cpc has only a minimal set of properties populated.

Type:Cpc
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 on storage_volume_templates.

Authorization requirements:

  • Object-access permission to this storage group template.
  • 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 Template Properties’ in the HMC API book.

Raises:

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:

storage_group_template

Storage group template defining the scope for this manager.

Type:StorageGroupTemplate
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:

StorageVolumeTemplate

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).

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.

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. Console

A Console resource represents an HMC.

In a paired setup with primary and alternate HMC, each HMC is represented as a separate Console resource.

class zhmcclient.ConsoleManager(client)[source]

Manager providing access to the Console representing the HMC this client is connected to.

In a paired setup with primary and alternate HMC, each HMC is represented as a separate Console resource.

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:

Methods

find 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 Find a resource by name (i.e.
findall 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.
list List the (one) Console representing the HMC this client is connected to.
resource_object Return a minimalistic Python resource object for this resource class, that is scoped to this manager.

Attributes

class_name The resource class name
client The client defining the scope for this manager.
console The Console representing the HMC this client is connected to.
parent Parent resource defining the scope for this manager.
resource_class The Python class of the parent resource of this manager.
session Session with the HMC.

Details

client

The client defining the scope for this manager.

Type:Client
console

The Console representing the HMC this client is connected to.

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() or prop() to access any properties regardless of whether they are already set or first need to be retrieved.

Type:Console
list(full_properties=True, filter_args=None)[source]

List the (one) Console representing the HMC this client is connected to.

Authorization requirements:

  • None
Parameters:
  • full_properties (bool) – Controls whether the full set of resource properties should be retrieved, vs. only a short set consisting of ‘object-uri’.
  • filter_args (dict) – This parameter exists for consistency with other list() methods and will be ignored.
Returns:

A list of Console objects, containing the one Console representing the HMC this client is connected to.

Raises:
class zhmcclient.Console(manager, uri, name=None, properties=None)[source]

Representation of a Console.

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, ConsoleManager).

Methods

get_audit_log Return the console audit log entries, optionally filtered by their creation time.
get_property Return the value of a resource property.
get_security_log Return the console security log entries, optionally filtered by their creation time.
list_unmanaged_cpcs List the unmanaged CPCs of this HMC.
make_primary Change the role of the alternate HMC represented by this Console object to become the primary HMC.
prop 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.
restart Restart the HMC represented by this Console object.
shutdown Shut down and power off the HMC represented by this Console object.

Attributes

full_properties A boolean indicating whether or not the resource properties in this object are the full set of resource properties.
ldap_server_definitions Access to the LDAP Server Definitions in this Console.
manager 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.
password_rules Access to the Password Rules in this Console.
properties The properties of this resource that are currently present in this
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).
storage_group_templates Manager object for the Storage Group Templates in scope of this Console.
storage_groups Manager object for the Storage Groups in scope of this Console.
tasks Access to the Tasks in this Console.
unmanaged_cpcs Access to the unmanaged CPCs in this Console.
uri The canonical URI path of the resource.
user_patterns Access to the User Patterns in this Console.
user_roles Access to the User Roles in this Console.
users Access to the Users in this Console.

Details

storage_groups

Manager object for the Storage Groups in scope of this Console.

Type:StorageGroupManager
storage_group_templates

Manager object for the Storage Group Templates in scope of this Console.

Type:StorageGroupTemplateManager
users

Access to the Users in this Console.

Type:UserManager
user_roles

Access to the User Roles in this Console.

Type:UserRoleManager
user_patterns

Access to the User Patterns in this Console.

Type:UserPatternManager
password_rules

Access to the Password Rules in this Console.

Type:PasswordRuleManager
tasks

Access to the Tasks in this Console.

Type:TaskManager
ldap_server_definitions

Access to the LDAP Server Definitions in this Console.

Type:LdapServerDefinitionManager
unmanaged_cpcs

Access to the unmanaged CPCs in this Console.

Type:UnmanagedCpcManager
restart(force=False, wait_for_available=True, operation_timeout=None)[source]

Restart the HMC represented by this Console object.

Once the HMC is online again, this Console object, as well as any other resource objects accessed through this HMC, can continue to be used. An automatic re-logon will be performed under the covers, because the HMC restart invalidates the currently used HMC session.

Authorization requirements:

  • Task permission for the “Shutdown/Restart” task.
  • “Remote Restart” must be enabled on the HMC.
Parameters:
  • force (bool) – Boolean controlling whether the restart operation is processed when users are connected (True) or not (False). Users in this sense are local or remote GUI users. HMC WS API clients do not count as users for this purpose.
  • wait_for_available (bool) –

    Boolean controlling whether this method should wait for the HMC to become available again after the restart, as follows:

    • If True, this method will wait until the HMC has restarted and is available again. The query_api_version() method will be used to check for availability of the HMC.
    • If False, this method will return immediately once the HMC has accepted the request to be restarted.
  • operation_timeout (number) – Timeout in seconds, for waiting for HMC availability after the restart. 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_available=True, a OperationTimeout is raised.
Raises:
shutdown(force=False)[source]

Shut down and power off the HMC represented by this Console object.

While the HMC is powered off, any Python resource objects retrieved from this HMC may raise exceptions upon further use.

In order to continue using Python resource objects retrieved from this HMC, the HMC needs to be started again (e.g. by powering it on locally). Once the HMC is available again, Python resource objects retrieved from that HMC can continue to be used. An automatic re-logon will be performed under the covers, because the HMC startup invalidates the currently used HMC session.

Authorization requirements:

  • Task permission for the “Shutdown/Restart” task.
  • “Remote Shutdown” must be enabled on the HMC.
Parameters:

force (bool) – Boolean controlling whether the shutdown operation is processed when users are connected (True) or not (False). Users in this sense are local or remote GUI users. HMC WS API clients do not count as users for this purpose.

Raises:
make_primary()[source]

Change the role of the alternate HMC represented by this Console object to become the primary HMC.

If that HMC is already the primary HMC, this method does not change its rols and succeeds.

The HMC represented by this Console object must participate in a {primary, alternate} pairing.

Authorization requirements:

  • Task permission for the “Manage Alternate HMC” task.
Raises:
get_audit_log(begin_time=None, end_time=None)[source]

Return the console audit log entries, optionally filtered by their creation time.

Authorization requirements:

  • Task permission to the “Audit and Log Management” task.
Parameters:
  • begin_time (datetime) –

    Begin time for filtering. Log entries with a creation time older than the begin time will be omitted from the results.

    If None, no such filtering is performed (and the oldest available log entries will be included).

  • end_time (datetime) –

    End time for filtering. Log entries with a creation time newer than the end time will be omitted from the results.

    If None, no such filtering is performed (and the newest available log entries will be included).

Returns:

A JSON object with the log entries, as described in section ‘Response body contents’ of operation ‘Get Console Audit Log’ in the HMC API book.

Return type:

json object

Raises:
get_security_log(begin_time=None, end_time=None)[source]

Return the console security log entries, optionally filtered by their creation time.

Authorization requirements:

  • Task permission to the “View Security Logs” task.
Parameters:
  • begin_time (datetime) –

    Begin time for filtering. Log entries with a creation time older than the begin time will be omitted from the results.

    If None, no such filtering is performed (and the oldest available log entries will be included).

  • end_time (datetime) –

    End time for filtering. Log entries with a creation time newer than the end time will be omitted from the results.

    If None, no such filtering is performed (and the newest available log entries will be included).

Returns:

A JSON object with the log entries, as described in section ‘Response body contents’ of operation ‘Get Console Security Log’ in the HMC API book.

Return type:

json object

Raises:
list_unmanaged_cpcs(name=None)[source]

List the unmanaged CPCs of this HMC.

For details, see list().

Authorization requirements:

  • None
Parameters:

name (string) –

Regular expression pattern for the CPC name, as a filter that narrows the list of returned CPCs to those whose name property matches the specified pattern.

None causes no filtering to happen, i.e. all unmanaged CPCs discovered by the HMC are returned.

Returns:

A list of UnmanagedCpc objects.

Raises:

5.18. User

A User resource represents a user configured in the HMC.

class zhmcclient.UserManager(console)[source]

Manager providing access to the User resources of a 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:

Methods

create Create a new User in this HMC.
find 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 Find a resource by name (i.e.
findall 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.
list List the User resources representing the users defined in this HMC.
resource_object Return a minimalistic Python resource object for this resource class, that is scoped to this manager.

Attributes

class_name The resource class name
console Console defining the scope for this manager.
parent Parent resource defining the scope for this manager.
resource_class The Python class of the parent resource of this manager.
session Session with the HMC.

Details

console

Console defining the scope for this manager.

Type:Console
list(full_properties=True, filter_args=None)[source]

List the User resources representing the users defined in this HMC.

Authorization requirements:

  • User-related-access permission to the User object included in the result, or, depending on the type of User object, task permission to the “Manage Users” task or the “Manage User Templates” task.
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 User objects.

Raises:
create(properties)[source]

Create a new User in this HMC.

Authorization requirements:

  • Task permission to the “Manage Users” task to create a standard user or the “Manage User Templates” task to create a template user.
Parameters:

properties (dict) – Initial property values. Allowable properties are defined in section ‘Request body contents’ in section ‘Create User’ in the HMC API book.

Returns:

The resource object for the new User. The object will have its ‘object-uri’ property set as returned by the HMC, and will also have the input properties set.

Return type:

User

Raises:
class zhmcclient.User(manager, uri, name=None, properties=None)[source]

Representation of a User.

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, UserManager).

Methods

add_user_role Add the specified User Role to this User.
delete Delete this User.
get_property Return the value of a resource property.
prop 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.
remove_user_role Remove the specified User Role from this User.
update_properties Update writeable properties of this User.

Attributes

full_properties A boolean indicating whether or not the resource properties in this object are the full set of resource properties.
manager 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
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.

Details

delete()[source]

Delete this User.

Authorization requirements:

  • Task permission to the “Manage Users” task to delete a non-template user, or the “Manage User Templates” task to delete a template user.
Raises:
update_properties(properties)[source]

Update writeable properties of this User.

Authorization requirements:

  • Task permission to the “Manage Users” task to update a non-template user, or the “Manage User Templates” task to update a template user.
  • For a user to update their own password or default-group-uri property, user-related-access permission to the user represented by this User object, or task permission to the “Manage Users” task is required.
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 ‘User object’ in the HMC API book.

Raises:
add_user_role(user_role)[source]

Add the specified User Role to this User.

This User must not be a system-defined or pattern-based user.

Authorization requirements:

  • Task permission to the “Manage Users” task to modify a standard user or the “Manage User Templates” task to modify a template user.
Parameters:

user_role (UserRole) – User Role to be added. Must not be None.

Raises:
remove_user_role(user_role)[source]

Remove the specified User Role from this User.

This User must not be a system-defined or pattern-based user.

Authorization requirements:

  • Task permission to the “Manage Users” task to modify a standard user or the “Manage User Templates” task to modify a template user.
Parameters:

user_role (UserRole) – User Role to be removed. Must not be None.

Raises:

5.19. User Role

A User Role resource represents an authority role which can be assigned to one or more HMC users.

A User Role may allow access to specific managed objects, classes of managed objects, groups and/or tasks. There are two types of User Roles: user-defined and system-defined. User-defined User Roles are created by an HMC user, whereas the system-defined User Roles are pre-defined, standard User Roles supplied with the HMC.

class zhmcclient.UserRoleManager(console)[source]

Manager providing access to the User Role resources of a 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:

Methods

create Create a new (user-defined) User Role in this HMC.
find 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 Find a resource by name (i.e.
findall 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.
list List the User Role resources representing the user roles defined in this HMC.
resource_object Return a minimalistic Python resource object for this resource class, that is scoped to this manager.

Attributes

class_name The resource class name
console Console defining the scope for this manager.
parent Parent resource defining the scope for this manager.
resource_class The Python class of the parent resource of this manager.
session Session with the HMC.

Details

console

Console defining the scope for this manager.

Type:Console
list(full_properties=True, filter_args=None)[source]

List the User Role resources representing the user roles defined in this HMC.

Authorization requirements:

  • User-related-access permission to the User Role objects included in the result, or task permission to the “Manage User Roles” task.
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 UserRole objects.

Raises:
create(properties)[source]

Create a new (user-defined) User Role in this HMC.

Authorization requirements:

  • Task permission to the “Manage User Roles” task.
Parameters:

properties (dict) – Initial property values. Allowable properties are defined in section ‘Request body contents’ in section ‘Create User Role’ in the HMC API book.

Returns:

The resource object for the new User Role. The object will have its ‘object-uri’ property set as returned by the HMC, and will also have the input properties set.

Return type:

UserRole

Raises:
class zhmcclient.UserRole(manager, uri, name=None, properties=None)[source]

Representation of a User Role.

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, UserRoleManager).

Methods

add_permission Add permission for the specified permitted object(s) to this User Role, thereby granting that permission to all users that have this User Role.
delete Delete this User Role.
get_property Return the value of a resource property.
prop 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.
remove_permission Remove permission for the specified permitted object(s) from this User Role, thereby no longer granting that permission to all users that have this User Role.
update_properties Update writeable properties of this User Role.

Attributes

full_properties A boolean indicating whether or not the resource properties in this object are the full set of resource properties.
manager 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
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.

Details

delete()[source]

Delete this User Role.

The User Role must be user-defined. System-defined User Roles cannot be deleted.

Authorization requirements:

  • Task permission to the “Manage User Roles” task.
Raises:
update_properties(properties)[source]

Update writeable properties of this User Role.

The User Role must be user-defined. System-defined User Roles cannot be updated.

Authorization requirements:

  • Task permission to the “Manage User Roles” 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 ‘User Role object’ in the HMC API book.

Raises:
add_permission(permitted_object, include_members=False, view_only=True)[source]

Add permission for the specified permitted object(s) to this User Role, thereby granting that permission to all users that have this User Role.

The granted permission depends on the resource class of the permitted object(s):

  • For Task resources, the granted permission is task permission for that task.
  • For Group resources, the granted permission is object access permission for the group resource, and optionally also for the group members.
  • For any other resources, the granted permission is object access permission for these resources.

The User Role must be user-defined.

Authorization requirements:

  • Task permission to the “Manage User Roles” task.
Parameters:
  • permitted_object (BaseResource or string) –

    Permitted object(s), either as a Python resource object (e.g. Partition), or as a resource class string (e.g. ‘partition’).

    Must not be None.

  • include_members (bool) –

    Controls whether for Group resources, the operation applies additionally to its group member resources.

    This parameter will be ignored when the permitted object does not specify Group resources.

  • view_only (bool) –

    Controls whether for Task resources, the operation aplies to the view-only version of the task (if True), or to the full version of the task (if False). Only certain tasks support a view-only version.

    This parameter will be ignored when the permitted object does not specify Task resources.

Raises:
remove_permission(permitted_object, include_members=False, view_only=True)[source]

Remove permission for the specified permitted object(s) from this User Role, thereby no longer granting that permission to all users that have this User Role.

The granted permission depends on the resource class of the permitted object(s):

  • For Task resources, the granted permission is task permission for that task.
  • For Group resources, the granted permission is object access permission for the group resource, and optionally also for the group members.
  • For any other resources, the granted permission is object access permission for these resources.

The User Role must be user-defined.

Authorization requirements:

  • Task permission to the “Manage User Roles” task.
Parameters:
  • permitted_object (BaseResource or string) –

    Permitted object(s), either as a Python resource object (e.g. Partition), or as a resource class string (e.g. ‘partition’).

    Must not be None.

  • include_members (bool) –

    Controls whether for Group resources, the operation applies additionally to its group member resources.

    This parameter will be ignored when the permitted object does not specify Group resources.

  • view_only (bool) –

    Controls whether for Task resources, the operation aplies to the view-only version of the task (if True), or to the full version of the task (if False). Only certain tasks support a view-only version.

    This parameter will be ignored when the permitted object does not specify Task resources.

Raises:

5.20. User Pattern

A User Pattern resource represents a pattern for HMC user IDs that are not defined on the HMC but can be verified by an LDAP server for user authentication.

User Patterns and user templates allow a system administrator to define a group of HMC users at once whose user IDs all match a certain pattern (for example, a regular expression) and who have a certain set of attributes. Each pattern identifies a template User object which defines many characteristics of such users. A successful logon with a user ID that matches a User Pattern results in the creation of a pattern-based user, with many of its attributes coming from the associated template.

User Patterns are searched in a defined order during logon processing. That order can be customized through the reorder() method.

class zhmcclient.UserPatternManager(console)[source]

Manager providing access to the User Pattern resources of a 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:

Methods

create Create a new User Pattern in this HMC.
find 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 Find a resource by name (i.e.
findall 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.
list List the User Pattern resources representing the user patterns defined in this HMC.
reorder Reorder the User Patterns of the HMC as specified.
resource_object Return a minimalistic Python resource object for this resource class, that is scoped to this manager.

Attributes

class_name The resource class name
console Console defining the scope for this manager.
parent Parent resource defining the scope for this manager.
resource_class The Python class of the parent resource of this manager.
session Session with the HMC.

Details

console

Console defining the scope for this manager.

Type:Console
list(full_properties=True, filter_args=None)[source]

List the User Pattern resources representing the user patterns defined in this HMC.

Authorization requirements:

  • User-related-access permission to the User Pattern objects included in the result, or task permission to the “Manage User Patterns” task.
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 UserPattern objects.

Raises:
create(properties)[source]

Create a new User Pattern in this HMC.

Authorization requirements:

  • Task permission to the “Manage User Patterns” task.
Parameters:

properties (dict) – Initial property values. Allowable properties are defined in section ‘Request body contents’ in section ‘Create User Pattern’ in the HMC API book.

Returns:

The resource object for the new User Pattern. The object will have its ‘element-uri’ property set as returned by the HMC, and will also have the input properties set.

Return type:

UserPattern

Raises:
reorder(user_patterns)[source]

Reorder the User Patterns of the HMC as specified.

The order of User Patterns determines the search order during logon processing.

Authorization requirements:

  • Task permission to the “Manage User Patterns” task.
Parameters:

user_patterns (list of UserPattern) –

The User Patterns in the desired order.

Must not be None.

Raises:
class zhmcclient.UserPattern(manager, uri, name=None, properties=None)[source]

Representation of a User Pattern.

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, UserPatternManager).

Methods

delete Delete this User Pattern.
get_property Return the value of a resource property.
prop 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 Update writeable properties of this UserPattern.

Attributes

full_properties A boolean indicating whether or not the resource properties in this object are the full set of resource properties.
manager 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
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.

Details

delete()[source]

Delete this User Pattern.

Authorization requirements:

  • Task permission to the “Manage User Patterns” task.
Raises:
update_properties(properties)[source]

Update writeable properties of this UserPattern.

Authorization requirements:

  • Task permission to the “Manage User Patterns” 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 ‘User Pattern object’ in the HMC API book.

Raises:

5.21. Password Rule

A Password Rule resource represents a rule which an HMC user must follow when creating a HMC logon password. Each HMC user using local authentication (i.e. not LDAP) is assigned a password rule. There are certain system-defined password rules available for use.

class zhmcclient.PasswordRuleManager(console)[source]

Manager providing access to the Password Rule resources of a 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:

Methods

create Create a new Password Rule in this HMC.
find 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 Find a resource by name (i.e.
findall 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.
list List the Password Rule resources representing the password rules defined in this HMC.
resource_object Return a minimalistic Python resource object for this resource class, that is scoped to this manager.

Attributes

class_name The resource class name
console Console defining the scope for this manager.
parent Parent resource defining the scope for this manager.
resource_class The Python class of the parent resource of this manager.
session Session with the HMC.

Details

console

Console defining the scope for this manager.

Type:Console
list(full_properties=True, filter_args=None)[source]

List the Password Rule resources representing the password rules defined in this HMC.

Authorization requirements:

  • User-related-access permission to the Password Rule objects included in the result, or task permission to the “Manage Password Rules” task.
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 PasswordRule objects.

Raises:
create(properties)[source]

Create a new Password Rule in this HMC.

Authorization requirements:

  • Task permission to the “Manage Password Rules” task.
Parameters:

properties (dict) – Initial property values. Allowable properties are defined in section ‘Request body contents’ in section ‘Create Password Rule’ in the HMC API book.

Returns:

The resource object for the new Password Rule. The object will have its ‘element-uri’ property set as returned by the HMC, and will also have the input properties set.

Return type:

PasswordRule

Raises:
class zhmcclient.PasswordRule(manager, uri, name=None, properties=None)[source]

Representation of a Password Rule.

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, PasswordRuleManager).

Methods

delete Delete this Password Rule.
get_property Return the value of a resource property.
prop 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 Update writeable properties of this PasswordRule.

Attributes

full_properties A boolean indicating whether or not the resource properties in this object are the full set of resource properties.
manager 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
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.

Details

delete()[source]

Delete this Password Rule.

The Password Rule must be user-defined. System-defined Password Rules cannot be deleted.

Authorization requirements:

  • Task permission to the “Manage Password Rules” task.
Raises:
update_properties(properties)[source]

Update writeable properties of this PasswordRule.

The Password Rule must be user-defined. System-defined Password Rules cannot be updated.

Authorization requirements:

  • Task permission to the “Manage Password Rules” 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 ‘Password Rule object’ in the HMC API book.

Raises:

5.22. Task

A Task resource represents an action that an HMC user with appropriate authority can perform. These actions could be available via the HMC’s graphical user interface, the Web Services APIs or both.

Tasks are predefined by the HMC and cannot be created, modified or deleted.

class zhmcclient.TaskManager(console)[source]

Manager providing access to the Task resources of a 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:

Methods

find 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 Find a resource by name (i.e.
findall 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.
list List the Task resources representing the tasks defined in this HMC.
resource_object Return a minimalistic Python resource object for this resource class, that is scoped to this manager.

Attributes

class_name The resource class name
console Console defining the scope for this manager.
parent Parent resource defining the scope for this manager.
resource_class The Python class of the parent resource of this manager.
session Session with the HMC.

Details

console

Console defining the scope for this manager.

Type:Console
list(full_properties=True, filter_args=None)[source]

List the Task resources representing the tasks defined in this HMC.

Authorization requirements:

  • None
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 Task objects.

Raises:
class zhmcclient.Task(manager, uri, name=None, properties=None)[source]

Representation of a Task.

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, TaskManager).

Methods

get_property Return the value of a resource property.
prop 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.

Attributes

full_properties A boolean indicating whether or not the resource properties in this object are the full set of resource properties.
manager 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
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.

Details

5.23. LDAP Server Definition

A LDAP Server Definition resource represents a definition that contains information about an LDAP server that may be used for HMC user authentication purposes.

class zhmcclient.LdapServerDefinitionManager(console)[source]

Manager providing access to the LDAP Server Definition resources of a 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:

Methods

create Create a new LDAP Server Definition in this HMC.
find 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 Find a resource by name (i.e.
findall 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.
list List the LDAP Server Definition resources representing the definitions of LDAp servers in this HMC.
resource_object Return a minimalistic Python resource object for this resource class, that is scoped to this manager.

Attributes

class_name The resource class name
console Console defining the scope for this manager.
parent Parent resource defining the scope for this manager.
resource_class The Python class of the parent resource of this manager.
session Session with the HMC.

Details

console

Console defining the scope for this manager.

Type:Console
list(full_properties=True, filter_args=None)[source]

List the LDAP Server Definition resources representing the definitions of LDAp servers in this HMC.

Authorization requirements:

  • User-related-access permission to the LDAP Server Definition objects included in the result, or task permission to the “Manage LDAP Server Definitions” task.
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 LdapServerDefinition objects.

Raises:
create(properties)[source]

Create a new LDAP Server Definition in this HMC.

Authorization requirements:

  • Task permission to the “Manage LDAP Server Definitions” task.
Parameters:

properties (dict) – Initial property values. Allowable properties are defined in section ‘Request body contents’ in section ‘Create LDAP Server Definition’ in the HMC API book.

Returns:

The resource object for the new LDAP Server Definition. The object will have its ‘object-uri’ property set as returned by the HMC, and will also have the input properties set.

Return type:

LdapServerDefinition

Raises:
class zhmcclient.LdapServerDefinition(manager, uri, name=None, properties=None)[source]

Representation of a LDAP Server Definition.

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, LdapServerDefinitionManager).

Methods

delete Delete this LDAP Server Definition.
get_property Return the value of a resource property.
prop 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 Update writeable properties of this LDAP Server Definitions.

Attributes

full_properties A boolean indicating whether or not the resource properties in this object are the full set of resource properties.
manager 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
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.

Details

delete()[source]

Delete this LDAP Server Definition.

Authorization requirements:

  • Task permission to the “Manage LDAP Server Definitions” task.
Raises:
update_properties(properties)[source]

Update writeable properties of this LDAP Server Definitions.

Authorization requirements:

  • Task permission to the “Manage LDAP Server Definitions” 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 ‘LDAP Server Definition object’ in the HMC API book.

Raises: