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:

Attributes:

client

Client: The client defining the scope for this manager.

console

Console: The Console representing the HMC this CPC is managed by.

case_insensitive_names

bool: Indicates whether the names of the resources are treated case insensitively.

class_name

The resource class name

name_prop

The name of the resource property indicating the resource name

parent

Subclass of BaseResource: Parent resource defining the scope for this manager.

resource_class

The Python class of the parent resource of this manager.

session

Session: Session with the HMC.

supports_properties

bool: Indicates whether the "Get Properties" operation for this type of resource supports the 'properties' query parameter in the latest released version of the HMC.

uri

The canonical URI path of the manager.

Methods:

list([full_properties, filter_args])

List the CPCs managed by the HMC this client is connected to.

__repr__()

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

add_resources_local(resource_obj_list)

Add a resource object to the local auto-updated list of resources.

auto_update_enabled()

Return whether Auto-updating is currently enabled for the manager object.

auto_update_needs_pull()

Return whether there is a need to pull the resources from the HMC, in the list() method.

auto_update_trigger_pull()

Trigger the need to pull the resources from the HMC, in the list() method.

disable_auto_update()

Disable Auto-updating for this manager object, if currently enabled.

dump()

Dump the resources of this resource manager as a resource definition.

enable_auto_update()

Enable Auto-updating for this manager object, if currently disabled.

find(**filter_args)

Find exactly one resource in scope of this manager, by matching resource properties against the specified filter arguments, and return its Python resource object (e.g. for a CPC, a Cpc object is returned).

find_by_name(name)

Find a resource by name and return its Python resource object (e.g. for a CPC, a Cpc object is returned).

find_local(name, uri[, properties])

Return a local resource object without fetching it from the HMC.

findall(**filter_args)

Find zero or more resources in scope of this manager, by matching resource properties against the specified filter arguments, and return a list of their Python resource objects (e.g. for CPCs, a list of Cpc objects is returned).

flush()

Invalidate the Name-URI cache of this manager.

invalidate_cache()

Invalidate the Name-URI cache of this manager.

list_resources_local()

List the resource objects from the local auto-updated list of resources.

remove_resource_local(resource_uri)

Remove the resource object for a resource URI from the local auto-updated list of resources.

resource_object(uri_or_oid[, props])

Return a minimalistic Python resource object for this resource class, that is scoped to this manager.

property client

Client: The client defining the scope for this manager.

property console

Console: The Console representing the HMC this CPC is managed by.

The returned object is cached, so it is looked up only upon first access to this property.

The returned object has only the following properties set:

  • ‘object-uri’

Use get_property() or prop() to access any properties regardless of whether they are already set or first need to be retrieved.

list(full_properties=False, filter_args=None)[source]

List the CPCs managed by the HMC this client is connected to.

Any resource property may be specified in a filter argument. For details about filter arguments, see Filtering.

The listing of resources is handled in an optimized way:

  • If this manager is enabled for Auto-updating, a locally maintained resource list is used (which is automatically updated via inventory notifications from the HMC) and the provided filter arguments are applied.

  • Otherwise, if the filter arguments specify the resource name as a single filter argument with a straight match string (i.e. without regular expressions), an optimized lookup is performed based on a locally maintained name-URI cache.

  • Otherwise, the HMC List operation is performed with the subset of the provided filter arguments that can be handled on the HMC side and the remaining filter arguments are applied on the client side on the list result.

Authorization requirements:

  • Object-access permission to any CPC to be included in the result.

Parameters:
  • full_properties (bool) – Controls whether the full set of resource properties should be retrieved, vs. only the short set as returned by the list operation.

  • filter_args (dict) –

    Filter arguments that narrow the list of returned resources to those that match the specified filter arguments. For details, see Filtering.

    None causes no filtering to happen, i.e. all resources are returned.

Returns:

A list of Cpc objects.

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

Representation of a managed CPC.

Derived from BaseResource; see there for common methods and attributes.

Objects of this class are not directly created by the user; they are returned from creation or list functions on their manager object (in this case, CpcManager).

Attributes:

lpars

Access to the LPARs in this CPC.

partitions

Access to the Partitions in this CPC.

adapters

Access to the Adapters in this CPC.

virtual_switches

Access to the Virtual Switches in this CPC.

capacity_groups

Access to the Capacity Groups in this CPC.

vswitches

Access to the Virtual Switches in this CPC.

reset_activation_profiles

Access to the Reset Activation Profiles in this CPC.

image_activation_profiles

Access to the Image Activation Profiles in this CPC.

load_activation_profiles

Access to the Load Activation Profiles in this CPC.

dpm_enabled

Indicates whether this CPC is currently in DPM mode (Dynamic Partition Manager mode).

maximum_active_partitions

The maximum number of partitions of this CPC.

ceased_existence

Indicates that the corresponding object on the HMC no longer exists, if auto-update is enabled for the resource.

full_properties

A boolean indicating whether or not the resource properties in this object are the full set of resource properties.

manager

Subclass of BaseManager: Manager object for this resource (and for all resources of the same type in the scope of that manager).

name

The name of the resource.

properties

The properties of this resource that are currently present in this Python object, as a dictionary.

properties_timestamp

The point in time of the last update of the resource properties cached in this object, as Unix time (an integer that is the number of seconds since the Unix epoch).

uri

The canonical URI path of the resource.

Methods:

dump()

Dump this Cpc resource with its properties and child resources (recursively) as a resource definition.

feature_enabled(feature_name)

Indicates whether the specified feature is enabled for this CPC.

feature_info()

Returns information about the features available for this CPC.

update_properties(properties)

Update writeable properties of this CPC.

start([wait_for_completion, operation_timeout])

Start this CPC, using the HMC operation "Start CPC".

stop([wait_for_completion, operation_timeout])

Stop this DPM-mode CPC, using the HMC operation "Stop CPC".

activate(activation_profile_name[, force, ...])

Activate this classic-mode CPC, using the HMC operation "Activate CPC".

deactivate([force, wait_for_completion, ...])

Deactivate this CPC, using the HMC operation "Deactivate CPC".

import_profiles(profile_area)

Import activation profiles and/or system activity profiles for this CPC from the SE hard drive into the CPC using the HMC operation "Import Profiles".

export_profiles(profile_area)

Export activation profiles and/or system activity profiles from this CPC to the SE hard drive using the HMC operation "Export Profiles".

get_wwpns(partitions)

Return the WWPNs of the host ports (of the HBAs) of the specified Partitions of this CPC.

get_free_crypto_domains([crypto_adapters])

Return a list of crypto domains that are free for usage on a list of crypto adapters in this CPC.

set_power_save(power_saving[, ...])

Set the power save setting of this CPC.

set_power_capping(power_capping_state[, ...])

Set the power capping settings of this CPC.

get_energy_management_properties()

Return the energy management properties of the CPC.

list_associated_storage_groups([...])

Return the storage groups that are associated to this CPC.

validate_lun_path(host_wwpn, host_port, ...)

Validate if an FCP storage volume on an actual storage subsystem is reachable from this CPC, through a specified host port and using a specified host WWPN.

add_temporary_capacity(record_id[, ...])

Add temporary processors to the CPC or increase temporary model capacity of the CPC.

remove_temporary_capacity(record_id[, ...])

Remove temporary processors from the CPC or decrease temporary model capacity of the CPC.

set_auto_start_list(auto_start_list)

Set the auto-start list of partitions for this CPC.

import_dpm_configuration(dpm_configuration)

Import a DPM configuration into this CPC.

export_dpm_configuration([...])

Export a DPM configuration from this CPC and return it.

list_api_features([name])

Returns information about the Web Services API features (introduced with Web Services version 4.10) available on the CPC, see Feature enablement.

single_step_install([bundle_level, ...])

Upgrades the firmware on the Support Element (SE) of this CPC.

install_and_activate([bundle_level, ...])

Installs and activates firmware on the Support Element (SE) of this CPC.

delete_retrieved_internal_code([ec_levels, ...])

Deletes retrieved updates that have not been installed on the Support Element (SE) of this CPC.

swap_current_time_server(stp_id)

Makes this CPC the current time server of an STP-only Coordinated Timing Network (CTN).

set_stp_config(stp_id, new_stp_id, force, ...)

Sets the configuration of the STP-only Coordinated Timing Network (CTN) whose current time server is this CPC.

change_stp_id(stp_id)

Changes the STP identifier of the STP-only Coordinated Timing Network (CTN) whose current time server is this CPC.

join_ctn(stp_id)

Causes this CPC to join an STP-only Coordinated Timing Network (CTN).

leave_ctn()

Causes this CPC to leave its current STP-only Coordinated Timing Network (CTN).

__repr__()

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

__str__()

Return a human readable string representation of this resource.

auto_update_enabled()

Return whether Auto-updating is currently enabled for the resource object.

cease_existence_local()

Update this Python object to indicate that the corresponding HMC object no longer exists.

disable_auto_update()

Disable Auto-updating for this resource object, if currently enabled.

enable_auto_update()

Enable Auto-updating for this resource object, if currently disabled.

get_properties_local(names[, defaults])

Return the values of a set of resource properties, using default values for those that are not cached in this Python object, without retrieving them from the HMC.

get_properties_pulled(names)

Return a set of resource properties with the values they currently have on the HMC.

get_property(name)

Return the value of a resource property.

prop(name[, default])

Return the value of a resource property, applying a default if the resource does not have a property with that name.

pull_full_properties()

Retrieve the full set of resource properties from the HMC and cache them in this Python object.

pull_properties(properties)

Retrieve the specified set of resource properties from the HMC and cache them in this Python object.

update_properties_local(properties)

Update the values of a set of resource properties on this Python object without propagating the updates to the HMC.

property lpars

Access to the LPARs in this CPC.

Type:

LparManager

property partitions

Access to the Partitions in this CPC.

Type:

PartitionManager

property adapters

Access to the Adapters in this CPC.

Type:

AdapterManager

property virtual_switches

Access to the Virtual Switches in this CPC.

Type:

VirtualSwitchManager

property capacity_groups

Access to the Capacity Groups in this CPC.

Type:

CapacityGroupManager

property vswitches

Access to the Virtual Switches in this CPC.

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

Type:

VirtualSwitchManager

property reset_activation_profiles

Access to the Reset Activation Profiles in this CPC.

Type:

ActivationProfileManager

property image_activation_profiles

Access to the Image Activation Profiles in this CPC.

Type:

ActivationProfileManager

property load_activation_profiles

Access to the Load Activation Profiles in this CPC.

Type:

ActivationProfileManager

property dpm_enabled

Indicates whether this CPC is currently in DPM mode (Dynamic Partition Manager mode).

If the CPC is not currently in DPM mode, or if the CPC does not support DPM mode (i.e. before z13), False is returned.

Authorization requirements:

  • Object-access permission to this CPC.

Raises:
Type:

bool

property maximum_active_partitions

The maximum number of partitions of this CPC.

For CPCs in DPM mode, the number indicates the maximum number of partitions. For CPCs in classic mode, the number indicates the maximum number of logical partitions (LPARs) that can be active at the same time.

The following table shows the maximum number of partitions by machine generation:

Machine generation

Maximum partitions

z196

60

z114

30

zEC12

60

zBC12

30

z13 / Emperor

85

z13s / Rockhopper

40

z14 / Emperor II

85

z14-ZR1 / Rockhopper II

40

z15-T01 / LinuxOne III (-LT1)

85

z15-T02 / LinuxOne III (-LT2)

40

z15-GT2

85

z16-A01

85

Raises:
Type:

Integer

dump()[source]

Dump this Cpc resource with its properties and child resources (recursively) as a resource definition.

The returned resource definition has the following format:

{
    # Resource properties:
    "properties": {...},

    # Child resources for any CPC mode:
    "capacity_groups": [...],

    # Child resources for DPM mode:
    "partitions": [...],
    "adapters": [...],
    "virtual_switches": [...],

    # Child resources for classic mode:
    "lpars": [...],  # Faked Lpar children
    "reset_activation_profiles": [...],
    "image_activation_profiles": [...],
    "load_activation_profiles": [...],
}
Returns:

Resource definition of this resource.

Return type:

dict

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.

This method serializes with other methods that access or change properties on the same Python object.

Authorization requirements:

  • Object-access permission to this CPC.

  • Task permission for the “CPC Details” task.

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

This operation performs an orderly start of the CPC, including:

  • Turning CPC power on.

  • Performing a power-on reset, this includes allocating system resources to the CPC.

  • Starting partitions that are in the auto-start list of the CPC.

The CPC must be set for DPM operational mode (i.e. its ‘dpm-enabled’ property is True) and must currently be inactive.

Authorization requirements:

  • Object-access permission to this CPC.

  • Task permission for the “Start (start a single DPM system)” task.

Parameters:
  • wait_for_completion (bool) –

    Boolean controlling whether this method should wait for completion of the requested asynchronous HMC operation, as follows:

    • If True, this method will wait for completion of the asynchronous job performing the operation.

    • If False, this method will return immediately once the HMC has accepted the request to perform the operation.

  • operation_timeout (number) – Timeout in seconds, for waiting for completion of the asynchronous job performing the operation. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a OperationTimeout is raised.

Returns:

If wait_for_completion is True, returns None.

If wait_for_completion is False, returns a Job object representing the asynchronously executing job on the HMC.

This job supports cancellation. Note that it may no longer be possible to cancel the job after some point. The job status and reason codes will indicate whether the job was canceled or ran to completion.

Return type:

None or Job

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

Stop this DPM-mode CPC, using the HMC operation “Stop CPC”.

This operation performs an orderly shutdown of the CPC, including:

  • Stopping all partitions.

  • Ending hardware activity.

  • Clearing, releasing, and de-allocating hardware resources.

  • Turning off CPC power.

The CPC must be set for DPM operational mode (i.e. its ‘dpm-enabled’ property is True) and must currently be active.

Authorization requirements:

  • Object-access permission to this CPC.

  • Task permission for the “Stop (stop a single DPM system)” task.

Parameters:
  • wait_for_completion (bool) –

    Boolean controlling whether this method should wait for completion of the requested asynchronous HMC operation, as follows:

    • If True, this method will wait for completion of the asynchronous job performing the operation.

    • If False, this method will return immediately once the HMC has accepted the request to perform the operation.

  • operation_timeout (number) – Timeout in seconds, for waiting for completion of the asynchronous job performing the operation. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a OperationTimeout is raised.

Returns:

If wait_for_completion is True, returns None.

If wait_for_completion is False, returns a Job object representing the asynchronously executing job on the HMC. This job does not support cancellation.

Return type:

None or Job

Raises:
activate(activation_profile_name, force=False, wait_for_completion=True, operation_timeout=None)[source]

Activate this classic-mode CPC, using the HMC operation “Activate CPC”.

This operation performs an orderly start of the CPC, including:

  • Turning CPC power on.

  • Performing a power-on reset, this includes allocating system resources to the CPC as defined by the reset activation profile.

  • Activating LPARs that are in the auto-start list defined by the reset activation profile.

If the CPC is already active in classic mode, only the operations are performed that are needed to get into the state defined by the specified reset activation profile.

The CPC must be set for classic operational mode (i.e. its ‘dpm-enabled’ property is False).

Authorization requirements:

  • Object-access permission to this CPC.

  • Task permission for the “Activate” task.

Parameters:
  • activation_profile_name (string) – Name of the reset activation profile used to activate the CPC.

  • force (bool) – Boolean controlling whether the operation is permitted if the CPC is in ‘operating’ status.

  • wait_for_completion (bool) –

    Boolean controlling whether this method should wait for completion of the requested asynchronous HMC operation, as follows:

    • If True, this method will wait for completion of the asynchronous job performing the operation.

    • If False, this method will return immediately once the HMC has accepted the request to perform the operation.

  • operation_timeout (number) – Timeout in seconds, for waiting for completion of the asynchronous job performing the operation. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a OperationTimeout is raised.

Returns:

If wait_for_completion is True, returns None.

If wait_for_completion is False, returns a Job object representing the asynchronously executing job on the HMC. This job does not support cancellation.

Return type:

None or Job

Raises:
deactivate(force=False, wait_for_completion=True, operation_timeout=None)[source]

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

This operation performs an orderly shutdown of the CPC, including:

  • Stopping all LPARs.

  • Ending hardware activity.

  • Clearing, releasing, and de-allocating hardware resources.

  • Turning off CPC power.

The CPC must be set for classic operational mode (i.e. its ‘dpm-enabled’ property is False).

Authorization requirements:

  • Object-access permission to this CPC.

  • Task permission for the “Deactivate” task.

Parameters:
  • force (bool) – Boolean controlling whether the operation is permitted if the CPC is in ‘operating’ status.

  • wait_for_completion (bool) –

    Boolean controlling whether this method should wait for completion of the requested asynchronous HMC operation, as follows:

    • If True, this method will wait for completion of the asynchronous job performing the operation.

    • If False, this method will return immediately once the HMC has accepted the request to perform the operation.

  • operation_timeout (number) – Timeout in seconds, for waiting for completion of the asynchronous job performing the operation. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a OperationTimeout is raised.

Returns:

If wait_for_completion is True, returns None.

If wait_for_completion is False, returns a Job object representing the asynchronously executing job on the HMC. This job does not support cancellation.

Return type:

None or Job

Raises:
import_profiles(profile_area)[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.

Raises:
export_profiles(profile_area)[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.

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 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. This job does not support cancellation.

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 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. This job does not support cancellation.

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:
set_auto_start_list(auto_start_list)[source]

Set the auto-start list of partitions for this CPC.

The current auto-start list is replaced with this new list.

The auto-start list may contain named partition groups that are formed just for the purpose of auto-starting (they have nothing to do with Group objects on the HMC).

This method performs the “Set Auto-Start List” HMC operation.

This method requires the CPC to be in DPM mode.

Parameters:

auto_start_list (list) –

The auto-start list to be set.

Each list item is one of:

  • tuple(partition, post_start_delay)

  • tuple(partition_list, name, description, post_start_delay)

Where:

  • partition (Partition): The partition to be auto-started.

  • post_start_delay (int): Delay in seconds to wait after starting this partition or partition group, and before the next partition or partition group in the list is started.

  • partition_list (list of Partition): The partitions in the partition group to be auto-started.

  • name (string): Name of the partition group.

  • description (string): Description of the partition group.

Authorization requirements:

  • Object-access permission to this CPC.

  • Task permission to the “System Details” task.

  • Object-access permission to all partitions specified in the auto-start list.

Raises:
import_dpm_configuration(dpm_configuration)[source]

Import a DPM configuration into this CPC.

This includes settable CPC properties, settable properties of physical adapters, Hipersocket adapters, partitions with their child objects, virtual functions, virtual switches, capacity groups, storage related resources, storage ports, and network ports.

This method performs the “Import DPM Configuration” HMC operation.

This method requires the CPC to be in DPM mode.

Authorization requirements:

  • Object-access permission to this CPC.

  • Object-access permission to Secure Boot Certificate objects (only applies when the request body contains one or more secure boot Certificate objects to be assigned to Partitions).

  • Task permission for the “Import Secure Boot Certificates” task (only applies when the request body contains one or more Certificate objects).

  • Task permission to the “Import Dynamic Partition Manager Configuration” task.

Parameters:

dpm_configuration (dict) –

A DPM configuration, represented as a dictionary with the fields described for the “Import DPM Configuration” operation in the HMC API book.

Resource URIs are represented as URI strings in the fields of the DPM configuration, as described for the request body fields of the HMC operation. URIs of imported resource objects can be chosen to be preserved or newly allocated via the “preserve-uris” field.

Adapter PCHIDs may be different between the imported adapter objects and the actual adapters in this CPC and can be mapped via the “adapter-mapping” field.

Host WWPNs of FICON adapters can be chosen to be preserved or newly allocated via the “preserve-wwpns” field.

Returns:

If the complete input DPM configuration has been applied to the CPC, None is returned.

If only a part of the input DPM configuration has been applied, a list of dict objects is returned that describe what was not applied. For details, see the description of the response of the “Import DPM Configuration” operation in the HMC API book.

To verify that the complete input DPM configuration has been applied, the caller must verify the return value to be None and not just verify that no exceptions have been raised.

Return type:

list or None

Raises:
export_dpm_configuration(include_unused_adapters=False)[source]

Export a DPM configuration from this CPC and return it.

The DPM configuration includes settable CPC properties and all DPM specific objects of or associated with the CPC, such as adapters with their ports, virtual switches, partitions with their child objects, capacity groups, various storage and tape related resources, and certificate objects.

By default, only those adapters of the CPC are exported that are referenced by other DPM specific objects.

This method performs the “Get Inventory” HMC operation and extracts the relevant elements into the result.

This method requires the CPC to be in DPM mode.

Authorization requirements:

  • Object-access permission to this CPC.

  • Object-access permission to all Certificate objects associated to this CPC.

Parameters:

include_unused_adapters (bool) – Controls whether the full set of adapters should be returned, vs. only those that are referenced by other DPM objects that are part of the return data.

Returns:

A DPM configuration, represented as a dictionary with the fields described for the “Import DPM Configuration” operation in the HMC API book.

Resource URIs are represented as URI strings in the fields of the DPM configuration, as described for the request body fields of the HMC operation.

Empty fields are omitted from the returned configuration. This allows using newer versions of zhmcclient that may have added support for a feature of a new generation of Z systems with older generations of Z systems that did not yet have the feature.

The optional “preserve-uris”, “preserve-wwpns”, and “adapter-mapping” fields will not be in the returned dictionary, so their defaults will be used when importing this DPM configuration unchanged to a CPC.

The returned DPM configuration object can be passed to import_dpm_configuration() either unchanged, or after changing it, e.g. by adding the optional “preserve-uris”, “preserve-wwpns”, or “adapter-mapping” fields.

Return type:

dict

Raises:
list_api_features(name=None)[source]

Returns information about the Web Services API features (introduced with Web Services version 4.10) available on the CPC, see Feature enablement.

Parameters:

name – A regular expression used to limit returned objects to those that have a matching name field.

Authorization requirements:

  • None

Returns:

The list of API features that are available on this CPC. For API versions prior to 4.10, an empty list is returned.

Return type:

list of strings

single_step_install(bundle_level=None, accept_firmware=True, ftp_host=None, ftp_protocol=None, ftp_user=None, ftp_password=None, ftp_directory=None, wait_for_completion=True, operation_timeout=None)[source]

Upgrades the firmware on the Support Element (SE) of this CPC.

This is done by performing the “CPC Single Step Install” operation which performs the following steps:

  • A backup of the target CPC is performed to its SE hard drive.

  • If accept_firmware is True, the firmware currently installed on the SE of this CPC is accepted. Note that once firmware is accepted, it cannot be removed.

  • The new firmware identified by the bundle-level field is retrieved from the IBM support site or from an FTP server, and installed.

  • The newly installed firmware is activated, which includes rebooting the SE of this CPC.

If an error occurs when installing the upgrades for the different firmware components, any components that were successfully installed are rolled back.

If an error occurs after the firmware is accepted, the firmware remains accepted.

Note that it is not possible to downgrade the SE firmware with this operation.

Authorization requirements:

  • Object-access permission to this CPC.

  • Task permission to the “Single Step Internal Code Changes” task.

Parameters:
  • bundle_level (string) – Name of the bundle to be installed on the SE of this CPC (e.g. ‘S51’). If None, all locally available code changes, or in case of retrieving code changes from an FTP server, all code changes on the FTP server, will be installed.

  • accept_firmware (bool) – Accept the previous bundle level before installing the new level.

  • ftp_host (string) – The hostname for the FTP server from which the firmware will be retrieved, or None to retrieve it from the IBM support site.

  • ftp_protocol (string) – The protocol to connect to the FTP server, if the firmware will be retrieved from an FTP server, or None. Valid values are: “ftp”, “ftps”, “sftp”.

  • ftp_user (string) – The username for the FTP server login, if the firmware will be retrieved from an FTP server, or None.

  • ftp_password (string) – The password for the FTP server login, if the firmware will be retrieved from an FTP server, or None.

  • ftp_directory (string) – The path name of the directory on the FTP server with the firmware files, if the firmware will be retrieved from an FTP server, or None.

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

This job supports cancellation. Note there are only a few interruption points in the firmware install process, so it may be some time before the job is canceled, and after some point, will continue on to completion. The job status and reason codes will indicate whether the job was canceled or ran to completion. If the job is successfully canceled, any steps that were successfully completed will not be rolled back.

Return type:

None or Job

Raises:
install_and_activate(bundle_level=None, ec_levels=None, install_disruptive=False, wait_for_completion=True, operation_timeout=None)[source]

Installs and activates firmware on the Support Element (SE) of this CPC.

Brief summary of firmware levels:

The firmware is segmented into different subsystems called “Engineering Change” (EC), or sometimes “EC stream”. An EC stream is identified by an EC number (e.g. “P30719”).

Each EC stream is at a particular code level called “Microcode Level” (MCL), or sometimes “MCL level”. An MCL level for an EC stream is identified by an MCL number (e.g. “001”). MCL numbers are unique only within their EC stream and are consecutive numbers that increase towards newer MCL levels. Updates within an EC stream are installed sequentially, so if an EC stream has a particular MCL level installed, that implies that all earlier MCL levels within that EC stream are also installed.

A particular set of MCL numbers for each EC stream is collected into a “bundle level” for the SE (e.g. “S81”) or HMC (e.g. “H20”).

The firmware level for this method can be specified in three ways:

  • By specifying bundle_level: The updates for the specified bundle level will be installed.

  • By specifying ec_levels: Specific MCL levels for the specified EC streams will be installed.

  • By not specifying bundle_level and `ec_levels: All locally available updates will be installed.

In all cases, the updates to be installed must already be available on the SE; they are not automatically downloaded from the IBM support site or from an FTP server.

This method is implemented by performing the “CPC Install and Activate” operation which performs the following steps:

  • The specified updates are installed.

  • If all updates are installed successfully, they are activated, which includes rebooting the SE of this CPC.

If an error occurs when installing the updates, any updates that were successfully installed are rolled back.

Note that this operation does not perform a backup, an accept of previously activated updates, or an accept of the newly installed updates.

Note that this operation does not require that previously activated updates are first accepted before invoking this operation.

Note that it is not possible to downgrade the SE firmware with this operation.

Authorization requirements:

  • Object-access permission to this CPC.

  • Task permission to the “Change Internal Code” task.

Parameters:
  • bundle_level (string) –

    Name of the bundle to be installed on the SE of this CPC (e.g. ‘S51’).

    This parameter is mutually exclusive with ec_levels. If both are not provided, all locally available updates will be installed.

  • ec_levels (list of tuple(ec,mcl)) –

    Updates to be installed on the SE of this CPC, as a list of tuples (ec, mcl) where:

    • ec (string): EC number of the EC stream (e.g. “P30719”)

    • mcl (string): MCL number within the EC stream (e.g. “001”)

    This parameter is mutually exclusive with bundle_level. If both are not provided, all locally available updates will be installed.

  • install_disruptive (bool) –

    Install disruptive changes.

    • If True, all firmware will be installed regardless of whether it is disruptive to CPC operations.

    • If False and bundle_level or ec_levels is specified, the request will fail if the operation encounters a disruptive change.

    • If False and neither bundle_level or ec_levels are specified, all concurrent changes will be installed, and the disruptive ones will be left uninstalled.

  • 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 a string that is the ‘message’ field of the successfully completed job, or None if the successfully completed job has no message.

If wait_for_completion is False, returns a Job object representing the asynchronously executing job on the HMC. This job does not support cancellation. Once that job successfully completes, it may optionally have a ‘message’ field in its ‘job-results’ field.

In all cases, if a message is returned it may indicate that disruptive updates were not installed, or that updates are in pending state because some follow-up action is needed. In the latter case, the “View Internal Code Changes Summary” task on the HMC or SE GUI will provide a list of the additional actions that are required. It is not possible to query this information via the API.

Return type:

string or None or Job

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

Deletes retrieved updates that have not been installed on the Support Element (SE) of this CPC.

This is done by performing the “CPC Delete Retrieved Internal Code” operation which performs the following steps:

  • The specified retrieved and uninstalled firmware updates are deleted from the SE of this CPC.

If an error occurs when deleting the updates, then only the updates that were unsuccessfully deleted will remain on the system; any updates that were deleted before reaching an error will remain deleted upon completion of the operation.

Note that it is not possible to downgrade the SE firmware with this operation.

Authorization requirements:

  • Object-access permission to this CPC.

  • Task permission to the “Change Internal Code” task.

Parameters:
  • ec_levels (list of tuple(ec,mcl)) –

    The MCL levels of retrieved and uninstalled updates that will be deleted on the SE of this CPC, as a list of tuples (ec, mcl) where:

    • ec (string): EC number of the EC stream (e.g. “P30719”)

    • mcl (string): MCL number within the EC stream (e.g. “001”)

    Within each specified EC stream, only the one update for the specified MCL level will be deleted.

    If None, all retrieved and uninstalled updates are deleted on the SE of this CPC.

  • 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. This job does not support cancellation.

Return type:

None or Job

Raises:
swap_current_time_server(stp_id)[source]

Makes this CPC the current time server of an STP-only Coordinated Timing Network (CTN).

This is done by performing the “Swap Current Time Server” operation.

The CTN must be STP-only; mixed CTNs will be rejected.

Authorization requirements:

  • Object-access permission to this CPC.

  • Task permission to the “Manage System Time” and “Modify Assigned Server Roles” tasks.

Parameters:

stp_id (string) – STP identifier of the CTN.

Raises:
set_stp_config(stp_id, new_stp_id, force, preferred_time_server, backup_time_server, arbiter, current_time_server)[source]

Sets the configuration of the STP-only Coordinated Timing Network (CTN) whose current time server is this CPC.

This is done by performing the “Set STP Configuration” operation.

The CTN must be STP-only; mixed CTNs will be rejected.

Authorization requirements:

  • Object-access permission to this CPC.

  • Task permission to the “Manage System Time” and “Modify Assigned Server Roles” tasks.

Parameters:
  • stp_id (string) – Current STP identifier of the CTN to be updated. This CPC must be the current time server of the CTN.

  • new_stp_id (string) – The new STP identifier for the CTN. If None, the STP identifier of the CTN is not changed.

  • force (bool) – Required. Indicates whether a disruptive operation is allowed (True) or rejected (False). Must not be None.

  • preferred_time_server (zhmcclient.STPNode) – Identifies the CPC to be the preferred time server of the CTN. Must not be None.

  • backup_time_server (zhmcclient.STPNode) – Identifies the CPC to be the backup time server of the CTN. If None, the CTN will have no backup time server.

  • arbiter (zhmcclient.STPNode) – Identifies the CPC to be the arbiter for the CTN. If None, the CTN will have no arbiter.

  • current_time_server (string) –

    Identifies which time server takes on the role of the current time server. Must be one of:

    • ”preferred” - the preferred time server is the current time server

    • ”backup” - the backup time server is the current time server

    Must not be None.

Raises:
change_stp_id(stp_id)[source]

Changes the STP identifier of the STP-only Coordinated Timing Network (CTN) whose current time server is this CPC.

This is done by performing the “Change STP-only Coordinated Timing Network” operation.

The CTN must be STP-only; mixed CTNs will be rejected.

Authorization requirements:

  • Object-access permission to this CPC.

  • Task permission to the “Manage System Time” and “Rename CTN” tasks.

Parameters:

stp_id (string) – STP identifier of the CTN to be updated. This CPC must be the current time server of the CTN.

Raises:
join_ctn(stp_id)[source]

Causes this CPC to join an STP-only Coordinated Timing Network (CTN).

This is done by performing the “Join STP-only Coordinated Timing Network” operation.

If the CPC is already a member of a different CTN but not in the role of the current time server, it is removed from that CTN.

If the CPC object has an ETR ID, the ETR ID is removed.

The CPC must not be the current time server of a different CTN.

The CTN must be STP-only; mixed CTNs will be rejected.

Authorization requirements:

  • Object-access permission to this CPC.

  • Task permission to the “Manage System Time” and “Add Systems to CTN” tasks.

Parameters:

stp_id (string) – STP identifier of the CTN to be joined.

Raises:
leave_ctn()[source]

Causes this CPC to leave its current STP-only Coordinated Timing Network (CTN).

This is done by performing the “Leave STP-only Coordinated Timing Network” operation.

The CTN must be STP-only; mixed CTNs will be rejected.

The CPC must not be the current time server of its current CTN.

Authorization requirements:

  • Object-access permission to this CPC.

  • Task permission to the “Manage System Time” and “Remove Systems from CTN” tasks.

Raises:
class zhmcclient.STPNode(object_uri, type, model, manuf, po_manuf, seq_num, node_name)[source]

Data structure defining a CPC that is referenced by an STP configuration.

That CPC does not need to be managed by the HMC.

This object is used in the following methods:

Parameters:
  • object_uri (string) – The object-uri of the CPC, if the CPC is managed by the HMC. Otherwise, None.

  • type (string) – Machine type of the CPC (6 chars left padded with zeros), or an empty string.

  • model (string) – Machine model of the CPC (3 chars), or an empty string.

  • manuf (string) – Manufacturer of the CPC (3 chars), or an empty string.

  • po_manuf (string) – Plant code of the manufacturer of the CPC (2 chars), or an empty string.

  • seq_num (string) – Sequence number of the CPC (12 chars), or an empty string.

  • node_name (string) – Name of the CPC (1-8 chars).

Methods:

json()

Returns this data structure as a JSON string suitable for being used as an argument in methods that use this data structure.

json()[source]

Returns this data structure as a JSON string suitable for being used as an argument in methods that use this data structure.

5.2. Unmanaged CPCs

A CPC (Central Processor Complex) is a physical IBM Z or LinuxONE computer.

A particular HMC can manage multiple CPCs and can discover other CPCs that are not managed by that HMC. Such other CPCs are called “unmanaged CPCs” and they may or may not be managed by another HMC.

This section describes the interface for unmanaged CPCs using resource class UnmanagedCpc and the corresponding manager class UnmanagedCpcManager.

class zhmcclient.UnmanagedCpcManager(console)[source]

Manager providing access to the CPCs that have been discovered by the HMC this client is connected to, but are not managed by it. They may or may not be managed by another HMC.

Derived from BaseManager; see there for common methods and attributes.

Objects of this class are not directly created by the user; they are accessible via the following instance variable of a Console object:

Attributes:

console

Console defining the scope for this manager.

case_insensitive_names

bool: Indicates whether the names of the resources are treated case insensitively.

class_name

The resource class name

name_prop

The name of the resource property indicating the resource name

parent

Subclass of BaseResource: Parent resource defining the scope for this manager.

resource_class

The Python class of the parent resource of this manager.

session

Session: Session with the HMC.

supports_properties

bool: Indicates whether the "Get Properties" operation for this type of resource supports the 'properties' query parameter in the latest released version of the HMC.

uri

The canonical URI path of the manager.

Methods:

list([full_properties, filter_args])

List the unmanaged CPCs exposed by the HMC this client is connected to.

__repr__()

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

add_resources_local(resource_obj_list)

Add a resource object to the local auto-updated list of resources.

auto_update_enabled()

Return whether Auto-updating is currently enabled for the manager object.

auto_update_needs_pull()

Return whether there is a need to pull the resources from the HMC, in the list() method.

auto_update_trigger_pull()

Trigger the need to pull the resources from the HMC, in the list() method.

disable_auto_update()

Disable Auto-updating for this manager object, if currently enabled.

dump()

Dump the resources of this resource manager as a resource definition.

enable_auto_update()

Enable Auto-updating for this manager object, if currently disabled.

find(**filter_args)

Find exactly one resource in scope of this manager, by matching resource properties against the specified filter arguments, and return its Python resource object (e.g. for a CPC, a Cpc object is returned).

find_by_name(name)

Find a resource by name and return its Python resource object (e.g. for a CPC, a Cpc object is returned).

find_local(name, uri[, properties])

Return a local resource object without fetching it from the HMC.

findall(**filter_args)

Find zero or more resources in scope of this manager, by matching resource properties against the specified filter arguments, and return a list of their Python resource objects (e.g. for CPCs, a list of Cpc objects is returned).

flush()

Invalidate the Name-URI cache of this manager.

invalidate_cache()

Invalidate the Name-URI cache of this manager.

list_resources_local()

List the resource objects from the local auto-updated list of resources.

remove_resource_local(resource_uri)

Remove the resource object for a resource URI from the local auto-updated list of resources.

resource_object(uri_or_oid[, props])

Return a minimalistic Python resource object for this resource class, that is scoped to this manager.

property console

Console 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

Any resource property may be specified in a filter argument. For details about filter arguments, see Filtering.

The listing of resources is handled in an optimized way:

  • If this manager is enabled for Auto-updating, a locally maintained resource list is used (which is automatically updated via inventory notifications from the HMC) and the provided filter arguments are applied.

  • Otherwise, if the filter arguments specify the resource name as a single filter argument with a straight match string (i.e. without regular expressions), an optimized lookup is performed based on a locally maintained name-URI cache.

  • Otherwise, the HMC List operation is performed with the subset of the provided filter arguments that can be handled on the HMC side and the remaining filter arguments are applied on the client side on the list result.

Authorization requirements:

  • None

Parameters:
  • full_properties (bool) – Ignored (exists for consistency with other list() methods).

  • filter_args (dict) –

    Filter arguments that narrow the list of returned resources to those that match the specified filter arguments. For details, see Filtering.

    None causes no filtering to happen, i.e. all resources are returned.

Returns:

A list of UnmanagedCpc objects.

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

Representation of an unmanaged CPC.

Derived from BaseResource; see there for common methods and attributes.

Objects of this class are not directly created by the user; they are returned from creation or list functions on their manager object (in this case, UnmanagedCpcManager).

Methods:

__repr__()

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

__str__()

Return a human readable string representation of this resource.

auto_update_enabled()

Return whether Auto-updating is currently enabled for the resource object.

cease_existence_local()

Update this Python object to indicate that the corresponding HMC object no longer exists.

disable_auto_update()

Disable Auto-updating for this resource object, if currently enabled.

dump()

Dump this resource with its properties and child resources (recursively) as a resource definition.

enable_auto_update()

Enable Auto-updating for this resource object, if currently disabled.

get_properties_local(names[, defaults])

Return the values of a set of resource properties, using default values for those that are not cached in this Python object, without retrieving them from the HMC.

get_properties_pulled(names)

Return a set of resource properties with the values they currently have on the HMC.

get_property(name)

Return the value of a resource property.

prop(name[, default])

Return the value of a resource property, applying a default if the resource does not have a property with that name.

pull_full_properties()

Retrieve the full set of resource properties from the HMC and cache them in this Python object.

pull_properties(properties)

Retrieve the specified set of resource properties from the HMC and cache them in this Python object.

update_properties_local(properties)

Update the values of a set of resource properties on this Python object without propagating the updates to the HMC.

Attributes:

ceased_existence

Indicates that the corresponding object on the HMC no longer exists, if auto-update is enabled for the resource.

full_properties

A boolean indicating whether or not the resource properties in this object are the full set of resource properties.

manager

Subclass of BaseManager: Manager object for this resource (and for all resources of the same type in the scope of that manager).

name

The name of the resource.

properties

The properties of this resource that are currently present in this Python object, as a dictionary.

properties_timestamp

The point in time of the last update of the resource properties cached in this object, as Unix time (an integer that is the number of seconds since the Unix epoch).

uri

The canonical URI path of the resource.

5.3. Groups

A Group is a user-defined group of resources that are managed by the HMC.

Groups can be used for example in User Role permissions.

Groups can be one of two kinds:

  • pattern-matching groups: Membership is implicit and the result of pattern matching on the resource name. This is supported only for members that are CPCs, Logical Partitions (i.e. classic mode), or other Groups.

  • explicit groups: Each member is added and removed explicitly, using the Group.add_member() and Group.remove_member() methods.

class zhmcclient.GroupManager(console)[source]

Manager providing access to the Groups exposed by the HMC this client is connected to.

Derived from BaseManager; see there for common methods and attributes.

Attributes:

console

Console defining the scope for this manager.

case_insensitive_names

bool: Indicates whether the names of the resources are treated case insensitively.

class_name

The resource class name

name_prop

The name of the resource property indicating the resource name

parent

Subclass of BaseResource: Parent resource defining the scope for this manager.

resource_class

The Python class of the parent resource of this manager.

session

Session: Session with the HMC.

supports_properties

bool: Indicates whether the "Get Properties" operation for this type of resource supports the 'properties' query parameter in the latest released version of the HMC.

uri

The canonical URI path of the manager.

Methods:

list([full_properties, filter_args])

List the Groups managed by the HMC this client is connected to.

create(properties)

Create a Group in the HMC.

__repr__()

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

add_resources_local(resource_obj_list)

Add a resource object to the local auto-updated list of resources.

auto_update_enabled()

Return whether Auto-updating is currently enabled for the manager object.

auto_update_needs_pull()

Return whether there is a need to pull the resources from the HMC, in the list() method.

auto_update_trigger_pull()

Trigger the need to pull the resources from the HMC, in the list() method.

disable_auto_update()

Disable Auto-updating for this manager object, if currently enabled.

dump()

Dump the resources of this resource manager as a resource definition.

enable_auto_update()

Enable Auto-updating for this manager object, if currently disabled.

find(**filter_args)

Find exactly one resource in scope of this manager, by matching resource properties against the specified filter arguments, and return its Python resource object (e.g. for a CPC, a Cpc object is returned).

find_by_name(name)

Find a resource by name and return its Python resource object (e.g. for a CPC, a Cpc object is returned).

find_local(name, uri[, properties])

Return a local resource object without fetching it from the HMC.

findall(**filter_args)

Find zero or more resources in scope of this manager, by matching resource properties against the specified filter arguments, and return a list of their Python resource objects (e.g. for CPCs, a list of Cpc objects is returned).

flush()

Invalidate the Name-URI cache of this manager.

invalidate_cache()

Invalidate the Name-URI cache of this manager.

list_resources_local()

List the resource objects from the local auto-updated list of resources.

remove_resource_local(resource_uri)

Remove the resource object for a resource URI from the local auto-updated list of resources.

resource_object(uri_or_oid[, props])

Return a minimalistic Python resource object for this resource class, that is scoped to this manager.

property console

Console defining the scope for this manager.

Type:

Console

list(full_properties=False, filter_args=None)[source]

List the Groups managed by the HMC this client is connected to.

Authorization requirements:

  • Object-access permission to any Group 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 Group objects.

Raises:
create(properties)[source]

Create a Group in the HMC.

Authorization requirements:

  • Task permission to the “Grouping” task.

Parameters:

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

Returns:

The resource object for the new 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:

Group

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

Representation of a 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, GroupManager).

Note that Group objects do not have any writeable properties, so they do not have an update_properties() method.

Methods:

dump()

Dump this Group resource with its properties as a resource definition.

delete()

Delete this Group.

add_member(uri)

Add a resource as a new member to the Group.

remove_member(uri)

Remove a member resource from the Group.

list_members()

List Group members.

__repr__()

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

__str__()

Return a human readable string representation of this resource.

auto_update_enabled()

Return whether Auto-updating is currently enabled for the resource object.

cease_existence_local()

Update this Python object to indicate that the corresponding HMC object no longer exists.

disable_auto_update()

Disable Auto-updating for this resource object, if currently enabled.

enable_auto_update()

Enable Auto-updating for this resource object, if currently disabled.

get_properties_local(names[, defaults])

Return the values of a set of resource properties, using default values for those that are not cached in this Python object, without retrieving them from the HMC.

get_properties_pulled(names)

Return a set of resource properties with the values they currently have on the HMC.

get_property(name)

Return the value of a resource property.

prop(name[, default])

Return the value of a resource property, applying a default if the resource does not have a property with that name.

pull_full_properties()

Retrieve the full set of resource properties from the HMC and cache them in this Python object.

pull_properties(properties)

Retrieve the specified set of resource properties from the HMC and cache them in this Python object.

update_properties_local(properties)

Update the values of a set of resource properties on this Python object without propagating the updates to the HMC.

Attributes:

ceased_existence

Indicates that the corresponding object on the HMC no longer exists, if auto-update is enabled for the resource.

full_properties

A boolean indicating whether or not the resource properties in this object are the full set of resource properties.

manager

Subclass of BaseManager: Manager object for this resource (and for all resources of the same type in the scope of that manager).

name

The name of the resource.

properties

The properties of this resource that are currently present in this Python object, as a dictionary.

properties_timestamp

The point in time of the last update of the resource properties cached in this object, as Unix time (an integer that is the number of seconds since the Unix epoch).

uri

The canonical URI path of the resource.

dump()[source]

Dump this Group resource with its properties as a resource definition.

The returned resource definition has the following format:

{
    # Resource properties:
    "properties": {...},
}
Returns:

Resource definition of this resource.

Return type:

dict

delete()[source]

Delete this Group.

Authorization requirements:

  • Object-access permission to this Group.

  • Task permission to the “Grouping” task.

Raises:
add_member(uri)[source]

Add a resource as a new member to the Group.

The group must be defined without a pattern-matching specification. The member resource must not already be a member of this group.

Authorization requirements:

  • Object-access permission to this Group.

  • Object-access permission to the resource that is added as a member.

  • Task permission to the “Grouping” task.

Parameters:

uri (string) – URI of the resource to be added.

Raises:
remove_member(uri)[source]

Remove a member resource from the Group.

The group must be defined without a pattern-matching specification. The resource must be a member of this group.

Authorization requirements:

  • Object-access permission to this Group.

  • Object-access permission to the resource that is added as a member.

  • Task permission to the “Grouping” task.

Parameters:

uri (string) – URI of the resource to be removed.

Raises:
list_members()[source]

List Group members.

Authorization requirements:

  • Object-access permission to this Group.

  • Object-access permission to each member resource of the Group.

Returns:

List of members. Each list item is a dictionary with items: - “object-uri” (term:string): URI of the member resource. - “name” (term:string): Name of the member resource.

Return type:

list

Raises:

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

Attributes:

cpc

CPC defining the scope for this manager.

profile_type

Type of the Activation Profiles managed by this object:

case_insensitive_names

bool: Indicates whether the names of the resources are treated case insensitively.

class_name

The resource class name

name_prop

The name of the resource property indicating the resource name

parent

Subclass of BaseResource: Parent resource defining the scope for this manager.

resource_class

The Python class of the parent resource of this manager.

session

Session: Session with the HMC.

supports_properties

bool: Indicates whether the "Get Properties" operation for this type of resource supports the 'properties' query parameter in the latest released version of the HMC.

uri

The canonical URI path of the manager.

Methods:

list([full_properties, filter_args, ...])

List the Activation Profiles of this CPC, of the profile type managed by this object.

create(properties)

Create and configure an Activation Profiles on this CPC, of the profile type managed by this object.

__repr__()

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

add_resources_local(resource_obj_list)

Add a resource object to the local auto-updated list of resources.

auto_update_enabled()

Return whether Auto-updating is currently enabled for the manager object.

auto_update_needs_pull()

Return whether there is a need to pull the resources from the HMC, in the list() method.

auto_update_trigger_pull()

Trigger the need to pull the resources from the HMC, in the list() method.

disable_auto_update()

Disable Auto-updating for this manager object, if currently enabled.

dump()

Dump the resources of this resource manager as a resource definition.

enable_auto_update()

Enable Auto-updating for this manager object, if currently disabled.

find(**filter_args)

Find exactly one resource in scope of this manager, by matching resource properties against the specified filter arguments, and return its Python resource object (e.g. for a CPC, a Cpc object is returned).

find_by_name(name)

Find a resource by name and return its Python resource object (e.g. for a CPC, a Cpc object is returned).

find_local(name, uri[, properties])

Return a local resource object without fetching it from the HMC.

findall(**filter_args)

Find zero or more resources in scope of this manager, by matching resource properties against the specified filter arguments, and return a list of their Python resource objects (e.g. for CPCs, a list of Cpc objects is returned).

flush()

Invalidate the Name-URI cache of this manager.

invalidate_cache()

Invalidate the Name-URI cache of this manager.

list_resources_local()

List the resource objects from the local auto-updated list of resources.

remove_resource_local(resource_uri)

Remove the resource object for a resource URI from the local auto-updated list of resources.

resource_object(uri_or_oid[, props])

Return a minimalistic Python resource object for this resource class, that is scoped to this manager.

property cpc

CPC defining the scope for this manager.

Type:

Cpc

property profile_type

Type of the Activation Profiles managed by this object:

  • 'reset' - Reset Activation Profiles

  • 'image' - Image Activation Profiles

  • 'load' - Load Activation Profiles

Type:

string

list(full_properties=False, filter_args=None, additional_properties=None)[source]

List the Activation Profiles of this CPC, of the profile type managed by this object.

Any resource property may be specified in a filter argument. For details about filter arguments, see Filtering.

The listing of resources is handled in an optimized way:

  • If this manager is enabled for Auto-updating, a locally maintained resource list is used (which is automatically updated via inventory notifications from the HMC) and the provided filter arguments are applied.

  • Otherwise, if the filter arguments specify the resource name as a single filter argument with a straight match string (i.e. without regular expressions), an optimized lookup is performed based on a locally maintained name-URI cache.

  • Otherwise, the HMC List operation is performed with the subset of the provided filter arguments that can be handled on the HMC side and the remaining filter arguments are applied on the client side on the list result.

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.

  • additional_properties (list of string) –

    List of property names that are to be returned in addition to the default properties.

    This parameter requires HMC 2.16.0 or higher, and is supported only for image profiles.

Returns:

A list of ActivationProfile objects.

Raises:
create(properties)[source]

Create and configure an Activation Profiles on this CPC, of the profile type managed by this object.

Supported only on z16 and later CPCs.

Authorization requirements:

  • Object-access permission to this CPC.

  • Task permission to the “Customize/Delete Activation Profiles” task.

Parameters:

properties (dict) –

Initial property values. Allowable properties are defined in section ‘Request body contents’ in section ‘Create Reset/Image/Load Activation Profile’ in the HMC API book.

Note that the input profile name for creation must be provided in property ‘profile-name’, even though it shows up on the created resource in property ‘name’. This applies to all three types of activation profiles.

Returns:

The resource object for the new Activation Profile. The object will have its ‘element-uri’ property set, and will also have the input properties set.

Return type:

ActivationProfile

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:

delete()

Delete this Activation Profile.

update_properties(properties)

Update writeable properties of this Activation Profile.

assign_certificate(certificate)

Assigns a Certificate to this Image Activation Profile.

unassign_certificate(certificate)

Unassign a Certificate from this Image Activation Profile.

__repr__()

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

__str__()

Return a human readable string representation of this resource.

auto_update_enabled()

Return whether Auto-updating is currently enabled for the resource object.

cease_existence_local()

Update this Python object to indicate that the corresponding HMC object no longer exists.

disable_auto_update()

Disable Auto-updating for this resource object, if currently enabled.

dump()

Dump this resource with its properties and child resources (recursively) as a resource definition.

enable_auto_update()

Enable Auto-updating for this resource object, if currently disabled.

get_properties_local(names[, defaults])

Return the values of a set of resource properties, using default values for those that are not cached in this Python object, without retrieving them from the HMC.

get_properties_pulled(names)

Return a set of resource properties with the values they currently have on the HMC.

get_property(name)

Return the value of a resource property.

prop(name[, default])

Return the value of a resource property, applying a default if the resource does not have a property with that name.

pull_full_properties()

Retrieve the full set of resource properties from the HMC and cache them in this Python object.

pull_properties(properties)

Retrieve the specified set of resource properties from the HMC and cache them in this Python object.

update_properties_local(properties)

Update the values of a set of resource properties on this Python object without propagating the updates to the HMC.

Attributes:

ceased_existence

Indicates that the corresponding object on the HMC no longer exists, if auto-update is enabled for the resource.

full_properties

A boolean indicating whether or not the resource properties in this object are the full set of resource properties.

manager

Subclass of BaseManager: Manager object for this resource (and for all resources of the same type in the scope of that manager).

name

The name of the resource.

properties

The properties of this resource that are currently present in this Python object, as a dictionary.

properties_timestamp

The point in time of the last update of the resource properties cached in this object, as Unix time (an integer that is the number of seconds since the Unix epoch).

uri

The canonical URI path of the resource.

delete()[source]

Delete this Activation Profile.

Supported only on z16 and later CPCs.

Authorization requirements:

  • Task permission to the “Customize/Delete Activation Profiles” task.

Raises:
update_properties(properties)[source]

Update writeable properties of this Activation Profile.

This method serializes with other methods that access or change properties on the same Python object.

Authorization requirements:

  • Object-access permission to the CPC of this Activation Profile.

  • Task permission for the “Customize/Delete Activation Profiles” task.

Parameters:

properties (dict) – New values for the properties to be updated. Properties not to be updated are omitted. Allowable properties are the properties with qualifier (w) in section ‘Data model’ in section ‘<profile_type> activation profile’ in the HMC API book, where <profile_type> is the profile type of this object (e.g. Reset, Load, Image).

Raises:
assign_certificate(certificate)[source]

Assigns a Certificate to this Image Activation Profile.

Feature enablement requirements:

  • “secure-boot-with-certificates” must be available on HMC and CPC

Authorization requirements:

  • Object-access permission to this Activation Profile.

  • Object-access permission to the specified certificate.

  • Task permission to the “Assign Secure Boot Certificates” task.

Parameters:

certificate (Certificate) – Certificate to be assigned. The certificate must not currently be assigned to this LPAR.

Raises:
unassign_certificate(certificate)[source]

Unassign a Certificate from this Image Activation Profile.

Feature enablement requirements:

  • “secure-boot-with-certificates” must be available on HMC and CPC

Authorization requirements:

  • Object-access permission to this Image Activation Profile.

  • Object-access permission to the specified certificate.

  • Task permission to the “Assign Secure Boot Certificates” task.

Parameters:

certificate (Certificate) – Certificate to be unassigned. The certificate must currently be assigned to this LPAR.

Raises:

5.5. LPARs

A LPAR (Logical Partition) is a subset of the hardware resources of a CPC in classic mode (or ensemble mode), virtualized as a separate computer.

LPARs cannot be created or deleted by the user; they can only be listed.

LPAR resources are contained in CPC resources.

LPAR resources only exist in CPCs that are in classic mode (or ensemble mode). CPCs in DPM mode have Partition resources, instead.

class zhmcclient.LparManager(cpc)[source]

Manager providing access to the LPARs in a particular CPC.

Derived from BaseManager; see there for common methods and attributes.

Objects of this class are not directly created by the user; they are accessible via the following instance variable of a Cpc object (in DPM mode):

Attributes:

cpc

CPC defining the scope for this manager.

case_insensitive_names

bool: Indicates whether the names of the resources are treated case insensitively.

class_name

The resource class name

name_prop

The name of the resource property indicating the resource name

parent

Subclass of BaseResource: Parent resource defining the scope for this manager.

resource_class

The Python class of the parent resource of this manager.

session

Session: Session with the HMC.

supports_properties

bool: Indicates whether the "Get Properties" operation for this type of resource supports the 'properties' query parameter in the latest released version of the HMC.

uri

The canonical URI path of the manager.

Methods:

list([full_properties, filter_args])

List the LPARs in this CPC.

__repr__()

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

add_resources_local(resource_obj_list)

Add a resource object to the local auto-updated list of resources.

auto_update_enabled()

Return whether Auto-updating is currently enabled for the manager object.

auto_update_needs_pull()

Return whether there is a need to pull the resources from the HMC, in the list() method.

auto_update_trigger_pull()

Trigger the need to pull the resources from the HMC, in the list() method.

disable_auto_update()

Disable Auto-updating for this manager object, if currently enabled.

dump()

Dump the resources of this resource manager as a resource definition.

enable_auto_update()

Enable Auto-updating for this manager object, if currently disabled.

find(**filter_args)

Find exactly one resource in scope of this manager, by matching resource properties against the specified filter arguments, and return its Python resource object (e.g. for a CPC, a Cpc object is returned).

find_by_name(name)

Find a resource by name and return its Python resource object (e.g. for a CPC, a Cpc object is returned).

find_local(name, uri[, properties])

Return a local resource object without fetching it from the HMC.

findall(**filter_args)

Find zero or more resources in scope of this manager, by matching resource properties against the specified filter arguments, and return a list of their Python resource objects (e.g. for CPCs, a list of Cpc objects is returned).

flush()

Invalidate the Name-URI cache of this manager.

invalidate_cache()

Invalidate the Name-URI cache of this manager.

list_resources_local()

List the resource objects from the local auto-updated list of resources.

remove_resource_local(resource_uri)

Remove the resource object for a resource URI from the local auto-updated list of resources.

resource_object(uri_or_oid[, props])

Return a minimalistic Python resource object for this resource class, that is scoped to this manager.

property cpc

CPC defining the scope for this manager.

Type:

Cpc

list(full_properties=False, filter_args=None)[source]

List the LPARs in this CPC.

Any resource property may be specified in a filter argument. For details about filter arguments, see Filtering.

The listing of resources is handled in an optimized way:

  • If this manager is enabled for Auto-updating, a locally maintained resource list is used (which is automatically updated via inventory notifications from the HMC) and the provided filter arguments are applied.

  • Otherwise, if the filter arguments specify the resource name as a single filter argument with a straight match string (i.e. without regular expressions), an optimized lookup is performed based on a locally maintained name-URI cache.

  • Otherwise, the HMC List operation is performed with the subset of the provided filter arguments that can be handled on the HMC side and the remaining filter arguments are applied on the client side on the list result.

Authorization requirements:

  • Object-access permission to this CPC.

  • Object-access permission to any LPAR to be included in the result.

Parameters:
  • full_properties (bool) – Controls whether the full set of resource properties should be retrieved, vs. only the short set as returned by the list operation.

  • filter_args (dict) –

    Filter arguments that narrow the list of returned resources to those that match the specified filter arguments. For details, see Filtering.

    None causes no filtering to happen, i.e. all resources are returned.

Returns:

A list of Lpar objects.

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

Representation of an LPAR.

Derived from BaseResource; see there for common methods and attributes.

Objects of this class are not directly created by the user; they are returned from creation or list functions on their manager object (in this case, LparManager).

Methods:

update_properties(properties)

Update writeable properties of this LPAR.

activate([wait_for_completion, ...])

Activate (start) this LPAR, using the HMC operation "Activate Logical Partition".

deactivate([wait_for_completion, ...])

De-activate (stop) this LPAR, using the HMC operation "Deactivate Logical Partition".

scsi_load(load_address, wwpn, lun[, ...])

Load (boot) this LPAR from a designated SCSI device, using the HMC operation "SCSI Load".

scsi_dump(load_address, wwpn, lun[, ...])

Load a standalone dump program from a designated SCSI device in this LPAR, using the HMC operation "SCSI Dump".

nvme_load(load_address[, load_parameter, ...])

Load (boot) this LPAR from a designated NVMe device, using the HMC operation "NVMe Load".

nvme_dump(load_address[, load_parameter, ...])

Load a standalone dump program from a designated NVMe device in this LPAR, using the HMC operation "NVMe Dump".

load([load_address, load_parameter, ...])

Load (boot) this LPAR from a load address (boot device), using the HMC operation "Load Logical Partition".

load_from_ftp(host, username, password, ...)

Load (boot) this LPAR from an FTP server, using the HMC operation "Load Logical Partition from FTP".

stop([wait_for_completion, ...])

Stop this LPAR, using the HMC operation "Stop Logical Partition".

start([wait_for_completion, ...])

Start this LPAR, using the HMC operation "Start Logical Partition".

reset_clear([force, wait_for_completion, ...])

Reset this LPAR and clears its memory.

reset_normal([force, wait_for_completion, ...])

Reset this LPAR without clearing its memory.

open_os_message_channel([...])

Open a JMS message channel to this LPAR's operating system, returning the string "topic" representing the message channel.

send_os_command(os_command_text[, is_priority])

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

list_os_messages([begin, end, is_held, ...])

List all currently available operating system messages for this LPAR.

psw_restart([wait_for_completion, ...])

Restart this LPAR, using the HMC operation "PSW Restart".

wait_for_status(status[, status_timeout])

Wait until the status of this LPAR has a desired value.

assign_certificate(certificate)

Assigns a Certificate to this LPAR.

unassign_certificate(certificate)

Unassign a Certificate from this LPAR.

__repr__()

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

__str__()

Return a human readable string representation of this resource.

auto_update_enabled()

Return whether Auto-updating is currently enabled for the resource object.

cease_existence_local()

Update this Python object to indicate that the corresponding HMC object no longer exists.

disable_auto_update()

Disable Auto-updating for this resource object, if currently enabled.

dump()

Dump this resource with its properties and child resources (recursively) as a resource definition.

enable_auto_update()

Enable Auto-updating for this resource object, if currently disabled.

get_properties_local(names[, defaults])

Return the values of a set of resource properties, using default values for those that are not cached in this Python object, without retrieving them from the HMC.

get_properties_pulled(names)

Return a set of resource properties with the values they currently have on the HMC.

get_property(name)

Return the value of a resource property.

prop(name[, default])

Return the value of a resource property, applying a default if the resource does not have a property with that name.

pull_full_properties()

Retrieve the full set of resource properties from the HMC and cache them in this Python object.

pull_properties(properties)

Retrieve the specified set of resource properties from the HMC and cache them in this Python object.

update_properties_local(properties)

Update the values of a set of resource properties on this Python object without propagating the updates to the HMC.

Attributes:

ceased_existence

Indicates that the corresponding object on the HMC no longer exists, if auto-update is enabled for the resource.

full_properties

A boolean indicating whether or not the resource properties in this object are the full set of resource properties.

manager

Subclass of BaseManager: Manager object for this resource (and for all resources of the same type in the scope of that manager).

name

The name of the resource.

properties

The properties of this resource that are currently present in this Python object, as a dictionary.

properties_timestamp

The point in time of the last update of the resource properties cached in this object, as Unix time (an integer that is the number of seconds since the Unix epoch).

uri

The canonical URI path of the resource.

update_properties(properties)[source]

Update writeable properties of this LPAR.

This method serializes with other methods that access or change properties on the same Python object.

Authorization requirements:

  • Object-access permission to this LPAR.

  • Before HMC API version 3.6 in an update to HMC 2.15.0: Object-access permission to the CPC of this LPAR.

  • Task permission for the “Change Object Definition” task.

  • Since HMC 2.14.1: If the “next-activation-profile-name” property is to be updated, task permission for the “Change Object Options” task or the “Customize/Delete Activation Profiles” task.

  • Before HMC 2.15.0: For an LPAR whose activation-mode is “zaware”, task permission for the “Firmware Details” task.

  • Since HMC 2.15.0: If any of the “ssc-” or “zaware-” properties is to be updated, task permission for the “Firmware Details” task.

  • Since HMC 2.15.0: If any of the numbers of allocated or reserved cores is to be updated, task permission for the “Logical Processor Add” task.

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 may take a few seconds until the LPAR status has reached the desired value. If wait_for_completion=True, this method repeatedly checks the status of the LPAR after the HMC operation has completed, and waits until the status is in the desired state “not-operating” (which indicates that the LPAR is active but no operating system is running), or “operating”, or if allow_status_exceptions was set additionally in the state “exceptions”.

The following approach is used to determine the desired state to wait for if wait_for_completion=True:

  • if the ‘operating-mode’ property of the image profile is ‘ssc’ or ‘zaware’, the desired state is “operating”.

  • if the profile specified in activation_profile_name is not the LPAR’s image profile, it is assumed to be a load profile and the desired state is “operating”.

  • if the ‘load-at-activation’ property of the image profile is True, the desired state is “operating”.

  • else, the desired state is “not-operating”.

Authorization requirements:

  • Object-access permission to this LPAR.

  • Before HMC API version 3.6 in an update to HMC 2.15.0: Object-access permission to the CPC of this LPAR.

  • Task permission for the “Activate” task.

Parameters:
  • wait_for_completion (bool) –

    Boolean controlling whether this method should wait for completion of the requested asynchronous HMC operation, as follows:

    • If True, this method will wait for completion of the asynchronous job performing the operation, and for the status becoming “not-operating” or “operating” (or in addition “exceptions”, if allow_status_exceptions was set.

    • If False, this method will return immediately once the HMC has accepted the request to perform the operation.

  • operation_timeout (number) – Timeout in seconds, for waiting for completion of the asynchronous job performing the operation. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a OperationTimeout is raised.

  • status_timeout (number) – Timeout in seconds, for waiting that the status of the LPAR has reached the desired status, after the HMC operation has completed. The special value 0 means that no timeout is set. None means that the default status 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 load or image activation profile to be used instead of the one specified in the next-activation-profile-name property of the LPAR, or None.

    If this parameter specifies an image activation profile, its name must match the LPAR name. For non-SSC partitions, the image profile’s load-at-activation property determines whether the activation is followed by a load of the control program using the load-related parameters from the image profile. SSC partitions are always auto-loaded (regardless of the load-at-activation property).

    If this parameter specifies a load activation profile, the activation uses the image profile with the same name as the LPAR. The activation is always followed by a load of the control program (regardless of the image profile’s load-at-activation property) using the parameters from the load profile.

    If this parameter is None, the next-activation-profile-name property of the LPAR will be used. That property can again specify an image profile or a load profile which are treated as described above. If that property is None, the image profile with the same name as the LPAR is used and is treated as described above.

  • 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. This job does not support cancellation.

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 may take a few seconds until the LPAR status has reached the desired value. If wait_for_completion=True, this method repeatedly checks the status of the LPAR after the HMC operation has completed, and waits until the status is in the desired state “not-activated”, or if allow_status_exceptions was set additionally in the state “exceptions”.

Authorization requirements:

  • Object-access permission to this LPAR.

  • Before HMC API version 3.6 in an update to HMC 2.15.0: Object-access permission to the CPC of this LPAR.

  • Task permission for the “Deactivate” task.

Parameters:
  • wait_for_completion (bool) –

    Boolean controlling whether this method should wait for completion of the requested asynchronous HMC operation, as follows:

    • If True, this method will wait for completion of the asynchronous job performing the operation, and for the status becoming “not-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 status 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. This job does not support cancellation.

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, secure_boot=False, os_ipl_token=None, clear_indicator=True)[source]

Load (boot) this LPAR from a designated SCSI device, using the HMC operation “SCSI Load”.

This HMC operation has deferred status behavior: If the asynchronous job on the HMC is complete, it takes a few seconds until the LPAR status has reached the desired value. If wait_for_completion=True, this method repeatedly checks the status of the LPAR after the HMC operation has completed, and waits until the status is in the desired state “operating”, or if allow_status_exceptions was set additionally in the state “exceptions”.

Authorization requirements:

  • Object-access permission to this LPAR.

  • Before HMC API version 3.6 in an update to HMC 2.15.0: Object-access permission to the CPC of this LPAR.

  • Task permission for the “SCSI Load” task.

Parameters:
  • load_address (string) – Device number of the boot device.

  • wwpn (string) – Worldwide port name (WWPN) of the target SCSI device to be used for this operation, in hexadecimal.

  • lun (string) – Hexadecimal logical unit number (LUN) to be used for the SCSI load.

  • load_parameter (string) – Optional load control string. If empty string or None, it is not passed to the HMC, and the HMC default of an empty string will be used.

  • disk_partition_id (integer) – Optional disk-partition-id (also called the boot program selector) to be used for the SCSI load. If None, it is not passed to the HMC, and the HMC default of 0 will be used.

  • operating_system_specific_load_parameters (string) – Optional operating system specific load parameters to be used for the SCSI load. If empty string or None, it is not passed to the HMC, and the HMC default of an empty string will be used.

  • boot_record_logical_block_address (string) – Optional hexadecimal boot record logical block address to be used for the SCSI load. If None, it is not passed to the HMC, and the HMC default of “0” will be used.

  • force (bool) – Boolean controlling whether this operation is permitted when the LPAR is in the “operating” status.

  • wait_for_completion (bool) –

    Boolean controlling whether this method should wait for completion of the requested asynchronous HMC operation, as follows:

    • If True, this method will wait for completion of the asynchronous job performing the operation, and for the status becoming “operating” (or in addition “exceptions”, if allow_status_exceptions was set.

    • If False, this method will return immediately once the HMC has accepted the request to perform the operation.

  • operation_timeout (number) – Timeout in seconds, for waiting for completion of the asynchronous job performing the operation. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a OperationTimeout is raised.

  • status_timeout (number) – Timeout in seconds, for waiting that the status of the LPAR has reached the desired status, after the HMC operation has completed. The special value 0 means that no timeout is set. None means that the default status timeout of the session is used. If the timeout expires when wait_for_completion=True, a StatusTimeout is raised.

  • allow_status_exceptions (bool) – Boolean controlling whether LPAR status “exceptions” is considered an additional acceptable end status when wait_for_completion is set.

  • secure_boot (bool) – Boolean controlling whether the system checks the software signature of what is loaded against what the distributor signed it with. If False or None, it is not passed to the HMC, and the HMC default of False will be used. Requires the LPAR to be on a z15 or later.

  • os_ipl_token (string) – Optional hexadecimal value to be used for the SCSI load. If None, it is not passed to the HMC.

  • clear_indicator (bool) – Optional boolean controlling whether the memory should be cleared before performing the load or not cleared. If True or None, it is not passed to the HMC, and the HMC default of True will be used if the LPAR is on a z14 with SE version 2.14.1 or higher. Requires the LPAR to be on a z14 with SE version 2.14.1 or higher.

Returns:

If wait_for_completion is True, returns None.

If wait_for_completion is False, returns a Job object representing the asynchronously executing job on the HMC. This job does not support cancellation.

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, force=False, secure_boot=False)[source]

Load a standalone dump program from a designated SCSI device in this LPAR, using the HMC operation “SCSI Dump”.

This HMC operation has deferred status behavior: If the asynchronous job on the HMC is complete, it takes a few seconds until the LPAR status has reached the desired value. If wait_for_completion=True, this method repeatedly checks the status of the LPAR after the HMC operation has completed, and waits until the status is in the desired state “operating”, or if allow_status_exceptions was set additionally in the state “exceptions”.

Authorization requirements:

  • Object-access permission to this LPAR.

  • Before HMC API version 3.6 in an update to HMC 2.15.0: Object-access permission to the CPC of this LPAR.

  • Task permission for the “SCSI Dump” task.

Parameters:
  • load_address (string) – Device number of the boot device.

  • wwpn (string) – Worldwide port name (WWPN) of the target SCSI device to be used for this operation, in hexadecimal.

  • lun (string) – Hexadecimal logical unit number (LUN) to be used for the SCSI dump.

  • load_parameter (string) – Optional load control string. If empty string or None, it is not passed to the HMC, and the HMC default of an empty string will be used.

  • disk_partition_id (integer) – Optional disk-partition-id (also called the boot program selector) to be used for the SCSI dump. If None, it is not passed to the HMC, and the HMC default of 0 will be used.

  • operating_system_specific_load_parameters (string) – Optional operating system specific load parameters to be used for the SCSI dump. If empty string or None, it is not passed to the HMC, and the HMC default of an empty string will be used.

  • boot_record_logical_block_address (string) – Optional hexadecimal boot record logical block address to be used for the SCSI dump. If None, it is not passed to the HMC, and the HMC default of “0” will be used.

  • os_ipl_token (string) – Optional hexadecimal value to be used for the SCSI dump. If None, it is not passed to the HMC.

  • wait_for_completion (bool) –

    Boolean controlling whether this method should wait for completion of the requested asynchronous HMC operation, as follows:

    • If True, this method will wait for completion of the asynchronous job performing the operation, and for the status becoming “operating” (or in addition “exceptions”, if allow_status_exceptions was set.

    • If False, this method will return immediately once the HMC has accepted the request to perform the operation.

  • operation_timeout (number) – Timeout in seconds, for waiting for completion of the asynchronous job performing the operation. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a OperationTimeout is raised.

  • status_timeout (number) – Timeout in seconds, for waiting that the status of the LPAR has reached the desired status, after the HMC operation has completed. The special value 0 means that no timeout is set. None means that the default status timeout of the session is used. If the timeout expires when wait_for_completion=True, a StatusTimeout is raised.

  • allow_status_exceptions (bool) – Boolean controlling whether LPAR status “exceptions” is considered an additional acceptable end status when wait_for_completion is set.

  • force (bool) – Boolean controlling whether this operation is permitted when the LPAR is in the “operating” status.

  • secure_boot (bool) – Boolean controlling whether the system checks the software signature of what is loaded against what the distributor signed it with. If False or None, it is not passed to the HMC, and the HMC default of False will be used. Requires the LPAR to be on a z15 or later.

Returns:

If wait_for_completion is True, returns None.

If wait_for_completion is False, returns a Job object representing the asynchronously executing job on the HMC. This job does not support cancellation.

Return type:

None or Job

Raises:
nvme_load(load_address, load_parameter=None, secure_boot=False, clear_indicator=True, disk_partition_id=None, operating_system_specific_load_parameters=None, boot_record_logical_block_address=None, force=False, wait_for_completion=True, operation_timeout=None, status_timeout=None, allow_status_exceptions=False)[source]

Load (boot) this LPAR from a designated NVMe device, using the HMC operation “NVMe Load”.

This operation requires z15 or later.

This HMC operation has deferred status behavior: If the asynchronous job on the HMC is complete, it takes a few seconds until the LPAR status has reached the desired value. If wait_for_completion=True, this method repeatedly checks the status of the LPAR after the HMC operation has completed, and waits until the status is in the desired state “operating”, or if allow_status_exceptions was set additionally in the state “exceptions”.

Authorization requirements:

  • Object-access permission to this LPAR.

  • Task permission for the “Load” task.

Parameters:
  • load_address (string) – Device number of the boot device.

  • load_parameter (string) – Optional load control string. If empty string or None, it is not passed to the HMC, and the HMC default of an empty string will be used.

  • secure_boot (bool) – Boolean controlling whether the system checks the software signature of what is loaded against what the distributor signed it with. If False or None, it is not passed to the HMC, and the HMC default of False will be used. Requires the LPAR to be on a z15 or later.

  • clear_indicator (bool) – Optional boolean controlling whether the memory should be cleared before performing the load or not cleared. If True or None, it is not passed to the HMC, and the HMC default of True will be used if the LPAR is on a z14 with SE version 2.14.1 or higher. Requires the LPAR to be on a z14 with SE version 2.14.1 or higher.

  • disk_partition_id (integer) – Optional disk-partition-id (also called the boot program selector) to be used for the NVMe Load. If None, it is not passed to the HMC, and the HMC default of 0 will be used.

  • operating_system_specific_load_parameters (string) – Optional operating system specific load parameters to be used for the NVMe Load. If empty string or None, it is not passed to the HMC, and the HMC default of an empty string will be used.

  • boot_record_logical_block_address (string) – Optional hexadecimal boot record logical block address to be used for the NVMe Load. If None, it is not passed to the HMC, and the HMC default of “0” will be used.

  • force (bool) – Boolean controlling whether this operation is permitted when the LPAR is in the “operating” status.

  • wait_for_completion (bool) –

    Boolean controlling whether this method should wait for completion of the requested asynchronous HMC operation, as follows:

    • If True, this method will wait for completion of the asynchronous job performing the operation, and for the status becoming “operating” (or in addition “exceptions”, if allow_status_exceptions was set.

    • If False, this method will return immediately once the HMC has accepted the request to perform the operation.

  • operation_timeout (number) – Timeout in seconds, for waiting for completion of the asynchronous job performing the operation. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a OperationTimeout is raised.

  • status_timeout (number) – Timeout in seconds, for waiting that the status of the LPAR has reached the desired status, after the HMC operation has completed. The special value 0 means that no timeout is set. None means that the default status 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. This job does not support cancellation.

Return type:

None or Job

Raises:
nvme_dump(load_address, load_parameter=None, secure_boot=False, disk_partition_id=None, operating_system_specific_load_parameters=None, boot_record_logical_block_address=None, force=False, wait_for_completion=True, operation_timeout=None, status_timeout=None, allow_status_exceptions=False)[source]

Load a standalone dump program from a designated NVMe device in this LPAR, using the HMC operation “NVMe Dump”.

This operation requires z15 or later.

This HMC operation has deferred status behavior: If the asynchronous job on the HMC is complete, it takes a few seconds until the LPAR status has reached the desired value. If wait_for_completion=True, this method repeatedly checks the status of the LPAR after the HMC operation has completed, and waits until the status is in the desired state “operating”, or if allow_status_exceptions was set additionally in the state “exceptions”.

Authorization requirements:

  • Object-access permission to this LPAR.

  • Task permission for the “NVMe Dump” task.

Parameters:
  • load_address (string) – Device number of the boot device.

  • load_parameter (string) – Optional load control string. If empty string or None, it is not passed to the HMC, and the HMC default of an empty string will be used.

  • secure_boot (bool) – Boolean controlling whether the system checks the software signature of what is loaded against what the distributor signed it with. If False or None, it is not passed to the HMC, and the HMC default of False will be used. Requires the LPAR to be on a z15 or later.

  • disk_partition_id (integer) – Optional disk-partition-id (also called the boot program selector) to be used for the NVMe dump. If None, it is not passed to the HMC, and the HMC default of 0 will be used.

  • operating_system_specific_load_parameters (string) – Optional operating system specific load parameters to be used for the NVMe dump. If empty string or None, it is not passed to the HMC, and the HMC default of an empty string will be used.

  • boot_record_logical_block_address (string) – Optional hexadecimal boot record logical block address to be used for the NVMe dump. If None, it is not passed to the HMC, and the HMC default of “0” will be used.

  • force (bool) – Boolean controlling whether this operation is permitted when the LPAR is in the “operating” status.

  • wait_for_completion (bool) –

    Boolean controlling whether this method should wait for completion of the requested asynchronous HMC operation, as follows:

    • If True, this method will wait for completion of the asynchronous job performing the operation, and for the status becoming “operating” (or in addition “exceptions”, if allow_status_exceptions was set.

    • If False, this method will return immediately once the HMC has accepted the request to perform the operation.

  • operation_timeout (number) – Timeout in seconds, for waiting for completion of the asynchronous job performing the operation. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a OperationTimeout is raised.

  • status_timeout (number) – Timeout in seconds, for waiting that the status of the LPAR has reached the desired status, after the HMC operation has completed. The special value 0 means that no timeout is set. None means that the default status 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. This job does not support cancellation.

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 this LPAR.

  • Before HMC API version 3.6 in an update to HMC 2.15.0: Object-access permission to the CPC of this LPAR.

  • Task permission for the “Load” task.

Parameters:
  • load_address (string) – Device number of the boot device. Up to z13, this parameter is required. Starting with z14, this parameter is optional and defaults to the load address specified in the ‘last-used-load-address’ property of the Lpar.

  • load_parameter (string) – Optional load control string. If empty string or None, it is not passed to the HMC, and the HMC default of an empty string will be used.

  • clear_indicator (bool) – Optional boolean controlling whether the memory should be cleared before performing the load or not cleared. The default value is True.

  • store_status_indicator (bool) – Optional boolean controlling whether the status should be stored before performing the Load. The default value is False.

  • wait_for_completion (bool) –

    Boolean controlling whether this method should wait for completion of the requested asynchronous HMC operation, as follows:

    • If True, this method will wait for completion of the asynchronous job performing the operation, and for the status becoming “operating” (or in addition “exceptions”, if allow_status_exceptions was set.

    • If False, this method will return immediately once the HMC has accepted the request to perform the operation.

  • operation_timeout (number) – Timeout in seconds, for waiting for completion of the asynchronous job performing the operation. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a OperationTimeout is raised.

  • status_timeout (number) – Timeout in seconds, for waiting that the status of the LPAR has reached the desired status, after the HMC operation has completed. The special value 0 means that no timeout is set. None means that the default status 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. This job does not support cancellation.

Return type:

None or Job

Raises:
load_from_ftp(host, username, password, load_file, protocol='ftp', wait_for_completion=True, operation_timeout=None, status_timeout=None, allow_status_exceptions=False)[source]

Load (boot) this LPAR from an FTP server, using the HMC operation “Load Logical Partition from FTP”.

This operation is not permitted for an LPAR whose ‘activation-mode’ property is “zaware” or “ssc”.

This HMC operation has deferred status behavior: If the asynchronous job on the HMC is complete, it takes a few seconds until the LPAR status has reached the desired value. If wait_for_completion=True, this method repeatedly checks the status of the LPAR after the HMC operation has completed, and waits until the status is in the desired state “operating”, or if allow_status_exceptions was set additionally in the state “exceptions”.

Authorization requirements:

  • Object-access permission to this LPAR.

  • Before HMC API version 3.6 in an update to HMC 2.15.0: Object-access permission to the CPC of this LPAR.

  • Task permission for the “Load from Removable Media or Server” task.

Parameters:
  • host (string) – Host name or IP address of the FTP server.

  • username (string) – User name for the account on the FTP server.

  • password (string) – Password that is associated with the user name on the FTP server.

  • load_file (string) – Path name of the file to be read from the FTP server and loaded into the LPAR.

  • protocol (string) –

    Network protocol for transferring files. Must be one of:

    • ”ftp” - File Transfer Protocol

    • ”ftps” - FTP Secure

    • ”sftp” - SSH File Transfer Protocol

    Default: “ftp”

  • 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 status 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. This job does not support cancellation.

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 operation is not permitted for an LPAR whose ‘activation-mode’ property is “zaware” or “ssc”.

In order to succeed, the ‘status’ property of the LPAR must have one of the following values:

  • “not-operating”

  • “operating”

  • “exceptions”

Authorization requirements:

  • Object-access permission to this LPAR.

  • Before HMC API version 3.6 in an update to HMC 2.15.0: Object-access permission to the CPC of this LPAR.

  • Task permission for the “Stop” task.

Parameters:
  • wait_for_completion (bool) –

    Boolean controlling whether this method should wait for completion of the requested asynchronous HMC operation, as follows:

    • If True, this method will wait for completion of the asynchronous job performing the operation.

    • 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) – Deprecated: This property was used for handling deferred status behavior, which is not actually needed. Setting it to a non-default value will cause a DeprecationWarning to be issued.

  • allow_status_exceptions (bool) – Deprecated: This property was used for handling deferred status behavior, which is not actually needed. Setting it to a non-default value will cause a DeprecationWarning to be issued.

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. This job does not support cancellation.

Return type:

None or Job

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

Start this LPAR, using the HMC operation “Start Logical Partition”. The start operation starts the processors to process instructions.

This operation is not permitted for an LPAR whose ‘activation-mode’ property is “zaware” or “ssc”.

In order to succeed, the ‘status’ property of the LPAR must have one of the following values:

  • “not-operating”

  • “operating”

  • “exceptions”

Authorization requirements:

  • Object-access permission to this LPAR.

  • Before HMC API version 3.6 in an update to HMC 2.15.0: Object-access permission to the CPC of this LPAR.

  • Task permission for the “Start” 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) – Deprecated: This property was used for handling deferred status behavior, which is not actually needed. Setting it to a non-default value will cause a DeprecationWarning to be issued.

  • allow_status_exceptions (bool) – Deprecated: This property was used for handling deferred status behavior, which is not actually needed. Setting it to a non-default value will cause a DeprecationWarning to be issued.

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, os_ipl_token=None)[source]

Reset this LPAR and clears its memory.

This includes clearing its pending interruptions, resetting its channel subsystem and resetting its processors, and clearing its memory, using the HMC operation “Reset Clear”.

In order to succeed, the ‘status’ property of the LPAR must have one of the following values:

  • “not-operating”

  • “operating” - this requires setting the “force” flag

  • “exceptions” - this requires setting the “force” flag

Authorization requirements:

  • Object-access permission to this LPAR.

  • Before HMC API version 3.6 in an update to HMC 2.15.0: Object-access permission to the CPC of this LPAR.

  • Task permission for the “Reset Clear” task.

Parameters:
  • force (bool) – Boolean controlling whether this operation is permitted when the LPAR is in the “operating” status. The default is False.

  • wait_for_completion (bool) –

    Boolean controlling whether this method should wait for completion of the requested asynchronous HMC operation, as follows:

    • If True, this method will wait for completion of the asynchronous job performing the operation.

    • 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) – Deprecated: This property was used for handling deferred status behavior, which is not actually needed. Setting it to a non-default value will cause a DeprecationWarning to be issued.

  • allow_status_exceptions (bool) – Deprecated: This property was used for handling deferred status behavior, which is not actually needed. Setting it to a non-default value will cause a DeprecationWarning to be issued.

  • os_ipl_token (string) – Applicable only to z/OS, this parameter requests that this operation only be performed if the provided value matches the current value of the ‘os-ipl-token’ property of the LPAR.

Returns:

If wait_for_completion is True, returns None.

If wait_for_completion is False, returns a Job object representing the asynchronously executing job on the HMC. This job does not support cancellation.

Return type:

None or Job

Raises:
reset_normal(force=False, wait_for_completion=True, operation_timeout=None, status_timeout=None, allow_status_exceptions=False, os_ipl_token=None)[source]

Reset this LPAR without clearing its memory.

This includes clearing its pending interruptions, resetting its channel subsystem and resetting its processors, using the HMC operation “Reset Normal”.

In order to succeed, the ‘status’ property of the LPAR must have one of the following values:

  • “not-operating”

  • “operating” - this requires setting the “force” flag

  • “exceptions” - this requires setting the “force” flag

Authorization requirements:

  • Object-access permission to this LPAR.

  • Before HMC API version 3.6 in an update to HMC 2.15.0: Object-access permission to the CPC of this LPAR.

  • Task permission for the “Reset Clear” task.

Parameters:
  • force (bool) – Boolean controlling whether this operation is permitted when the LPAR is in the “operating” status. The default is False.

  • wait_for_completion (bool) –

    Boolean controlling whether this method should wait for completion of the requested asynchronous HMC operation, as follows:

    • If True, this method will wait for completion of the asynchronous job performing the operation.

    • 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) – Deprecated: This property was used for handling deferred status behavior, which is not actually needed. Setting it to a non-default value will cause a DeprecationWarning to be issued.

  • allow_status_exceptions (bool) – Deprecated: This property was used for handling deferred status behavior, which is not actually needed. Setting it to a non-default value will cause a DeprecationWarning to be issued.

  • os_ipl_token (string) – Applicable only to z/OS, this parameter requests that this operation only be performed if the provided value matches the current value of the ‘os-ipl-token’ property of the LPAR.

Returns:

If wait_for_completion is True, returns None.

If wait_for_completion is False, returns a Job object representing the asynchronously executing job on the HMC. This job does not support cancellation.

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.

Authorization requirements:

  • Object-access permission to this Partition.

  • Task permission to the “Operating System Messages” task at least in view-only mode.

Parameters:

include_refresh_messages (bool) –

Boolean controlling whether refresh operating systems messages should be sent, as follows:

  • If True, refresh messages will be recieved when the user connects to the topic. The default.

  • If False, refresh messages will not be recieved when the user connects to the topic.

Returns:

Returns a string representing the os-message-notification JMS topic. The user can connect to this topic to start the flow of operating system messages.

Return type:

string

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

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

Authorization requirements:

  • Object-access permission to this Partition.

  • Task permission to the “Operating System Messages” task in modification mode.

Parameters:
  • os_command_text (string) – The text of the operating system command.

  • is_priority (bool) –

    Boolean controlling whether this is a priority operating system command, as follows:

    • If True, this message is treated as a priority operating system command.

    • If False, this message is not treated as a priority operating system command. The default.

Returns:

None

Raises:
list_os_messages(begin=None, end=None, is_held=None, is_priority=None, max_messages=0)[source]

List all currently available operating system messages for this LPAR.

Only a certain amount of OS message data from each LPAR is preserved by the HMC for retrieval by this operation. If the OS produces more than that amount, the oldest non-held, non-priority OS messages are no longer available. A gap in the sequence numbers indicates a loss of messages. A loss may be due to that space limitation, or it may be due to the deletion of messages by a console user or the OS.

Authorization requirements:

  • Object-access permission to this LPAR.

  • Task permission to the “Operating System Messages” task (optionally in view-only mode).

Parameters:
  • begin (integer) – A message sequence number to limit returned messages. OS messages with a sequence number less than this are omitted from the results. If None, no such filtering is performed.

  • end (integer) – A message sequence number to limit returned messages. OS messages with a sequence number greater than this are omitted from the results. If None, no such filtering is performed.

  • is_held (bool) – Limit the returned messages to only held (if True) or only non-held (if False) messages. If None, no such filtering is performed.

  • is_priority (bool) – Limit the returned messages to only priority (if True) or non-priority (if False) messages. If None, no such filtering is performed.

  • max_messages (int) – Limits the returned messages to the specified maximum number, starting from the begin of the sequence numbers in the result that would otherwise be returned. If 0, no such filtering is performed.

Returns:

List of OS messages, where each OS message is a dict with the items defined for the “os-message-info” data structure in the HMC API book.

Return type:

list of dict

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

In order to succeed, the ‘status’ property of the LPAR must have one of the following values:

  • “not-operating”

  • “operating”

  • “exceptions”

Authorization requirements:

  • Object-access permission to this LPAR.

  • Before HMC API version 3.6 in an update to HMC 2.15.0: Object-access permission to the CPC of this LPAR.

  • Task permission for the “PSW Restart” task.

Parameters:
  • wait_for_completion (bool) –

    Boolean controlling whether this method should wait for completion of the requested asynchronous HMC operation, as follows:

    • If True, this method will wait for completion of the asynchronous job performing the operation.

    • 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) – Deprecated: This property was used for handling deferred status behavior, which is not actually needed. Setting it to a non-default value will cause a DeprecationWarning to be issued.

  • allow_status_exceptions (bool) – Deprecated: This property was used for handling deferred status behavior, which is not actually needed. Setting it to a non-default value will cause a DeprecationWarning to be issued.

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. This job does not support cancellation.

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:
assign_certificate(certificate)[source]

Assigns a Certificate to this LPAR.

Feature enablement requirements:

  • “secure-boot-with-certificates” must be available on HMC and CPC

Authorization requirements:

  • Object-access permission to this LPAR.

  • Object-access permission to the specified certificate.

  • Task permission to the “Assign Secure Boot Certificates” task.

Parameters:

certificate (Certificate) – Certificate to be assigned. The certificate must not currently be assigned to this LPAR.

Raises:
unassign_certificate(certificate)[source]

Unassign a Certificate from this LPAR.

Feature enablement requirements:

  • “secure-boot-with-certificates” must be available on HMC and CPC

Authorization requirements:

  • Object-access permission to this LPAR.

  • Object-access permission to the specified certificate.

  • Task permission to the “Assign Secure Boot Certificates” task.

Parameters:

certificate (Certificate) – Certificate to be unassigned. The certificate must currently be assigned to this LPAR.

Raises:

5.6. Partitions

A Partition is a subset of the hardware resources of a CPC in DPM mode, virtualized as a separate computer.

Partitions can be created and deleted dynamically, and their resources such as CPU, memory or I/O devices can be configured dynamically. You can create as many partition definitions as you want, but only a specific number of partitions can be active at any given time.

TODO: How can a user find out what the maximum is, before it is reached?

Partition resources are contained in CPC resources.

Partition resources only exist in CPCs that are in DPM mode. CPCs in classic mode (or ensemble mode) have LPAR resources, instead.

class zhmcclient.PartitionManager(cpc)[source]

Manager providing access to the Partitions in a particular CPC.

Derived from BaseManager; see there for common methods and attributes.

Objects of this class are not directly created by the user; they are accessible via the following instance variable of a Cpc object (in DPM mode):

Attributes:

cpc

CPC defining the scope for this manager.

case_insensitive_names

bool: Indicates whether the names of the resources are treated case insensitively.

class_name

The resource class name

name_prop

The name of the resource property indicating the resource name

parent

Subclass of BaseResource: Parent resource defining the scope for this manager.

resource_class

The Python class of the parent resource of this manager.

session

Session: Session with the HMC.

supports_properties

bool: Indicates whether the "Get Properties" operation for this type of resource supports the 'properties' query parameter in the latest released version of the HMC.

uri

The canonical URI path of the manager.

Methods:

list([full_properties, filter_args, ...])

List the Partitions in this CPC.

create(properties)

Create and configure a Partition in this CPC.

__repr__()

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

add_resources_local(resource_obj_list)

Add a resource object to the local auto-updated list of resources.

auto_update_enabled()

Return whether Auto-updating is currently enabled for the manager object.

auto_update_needs_pull()

Return whether there is a need to pull the resources from the HMC, in the list() method.

auto_update_trigger_pull()

Trigger the need to pull the resources from the HMC, in the list() method.

disable_auto_update()

Disable Auto-updating for this manager object, if currently enabled.

dump()

Dump the resources of this resource manager as a resource definition.

enable_auto_update()

Enable Auto-updating for this manager object, if currently disabled.

find(**filter_args)

Find exactly one resource in scope of this manager, by matching resource properties against the specified filter arguments, and return its Python resource object (e.g. for a CPC, a Cpc object is returned).

find_by_name(name)

Find a resource by name and return its Python resource object (e.g. for a CPC, a Cpc object is returned).

find_local(name, uri[, properties])

Return a local resource object without fetching it from the HMC.

findall(**filter_args)

Find zero or more resources in scope of this manager, by matching resource properties against the specified filter arguments, and return a list of their Python resource objects (e.g. for CPCs, a list of Cpc objects is returned).

flush()

Invalidate the Name-URI cache of this manager.

invalidate_cache()

Invalidate the Name-URI cache of this manager.

list_resources_local()

List the resource objects from the local auto-updated list of resources.

remove_resource_local(resource_uri)

Remove the resource object for a resource URI from the local auto-updated list of resources.

resource_object(uri_or_oid[, props])

Return a minimalistic Python resource object for this resource class, that is scoped to this manager.

property cpc

CPC defining the scope for this manager.

Type:

Cpc

list(full_properties=False, filter_args=None, additional_properties=None)[source]

List the Partitions in this CPC.

Any resource property may be specified in a filter argument. For details about filter arguments, see Filtering.

The listing of resources is handled in an optimized way:

  • If this manager is enabled for Auto-updating, a locally maintained resource list is used (which is automatically updated via inventory notifications from the HMC) and the provided filter arguments are applied.

  • Otherwise, if the filter arguments specify the resource name as a single filter argument with a straight match string (i.e. without regular expressions), an optimized lookup is performed based on a locally maintained name-URI cache.

  • Otherwise, the HMC List operation is performed with the subset of the provided filter arguments that can be handled on the HMC side and the remaining filter arguments are applied on the client side on the list result.

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.

  • additional_properties (list of string) –

    List of property names that are to be returned in addition to the default properties.

    This parameter requires HMC 2.16.0 or higher.

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

Attributes:

nics

Access to the NICs in this Partition.

hbas

Access to the HBAs in this Partition.

virtual_functions

Access to the Virtual Functions in this Partition.

ceased_existence

Indicates that the corresponding object on the HMC no longer exists, if auto-update is enabled for the resource.

full_properties

A boolean indicating whether or not the resource properties in this object are the full set of resource properties.

manager

Subclass of BaseManager: Manager object for this resource (and for all resources of the same type in the scope of that manager).

name

The name of the resource.

properties

The properties of this resource that are currently present in this Python object, as a dictionary.

properties_timestamp

The point in time of the last update of the resource properties cached in this object, as Unix time (an integer that is the number of seconds since the Unix epoch).

uri

The canonical URI path of the resource.

Methods:

feature_enabled(feature_name)

Indicates whether the specified feature is enabled for the CPC of this partition.

feature_info()

Returns information about the features available for the CPC of this partition.

start([wait_for_completion, ...])

Start (activate) this Partition, using the HMC operation "Start Partition".

stop([wait_for_completion, ...])

Stop (deactivate) this Partition, using the HMC operation "Stop Partition".

delete()

Delete this Partition.

update_properties(properties)

Update writeable properties of this Partition.

dump_partition(parameters[, ...])

Dump this Partition, by loading a standalone dump program from a SCSI device and starting its execution, using the HMC operation 'Dump Partition'.

start_dump_program(parameters[, ...])

Dump this Partition, by loading a standalone dump program from a storage volume and starting its execution, using the HMC operation 'Start Dump Program'.

psw_restart([wait_for_completion, ...])

Initiates a PSW restart for this Partition, using the HMC operation 'Perform PSW Restart'.

mount_iso_image(image, image_name, ins_file_name)

Upload an ISO image and associate it to this Partition using the HMC operation 'Mount ISO Image'.

unmount_iso_image()

Unmount the currently mounted ISO from this Partition using the HMC operation 'Unmount ISO Image'.

open_os_message_channel([...])

Open a JMS message channel to this partition's operating system, returning the string "topic" representing the message channel.

send_os_command(os_command_text[, is_priority])

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

list_os_messages([begin, end])

List all currently available operating system messages for this partition.

wait_for_status(status[, status_timeout])

Wait until the status of this partition has a desired value.

increase_crypto_config(crypto_adapters, ...)

Add crypto adapters and/or crypto domains to the crypto configuration of this partition.

decrease_crypto_config(crypto_adapters, ...)

Remove crypto adapters and/or crypto domains from the crypto configuration of this partition.

change_crypto_domain_config(...)

Change the access mode for a crypto domain that is currently included in the crypto configuration of this partition.

zeroize_crypto_domain(crypto_adapter, ...)

Zeroize a single crypto domain on a crypto adapter.

attach_storage_group(storage_group)

Attach a storage group to this partition.

detach_storage_group(storage_group)

Detach a storage group from this partition.

list_attached_storage_groups([full_properties])

Return the storage groups that are attached to this partition.

assign_certificate(certificate)

Assigns a Certificate to this partition.

unassign_certificate(certificate)

Unassign a Certificate from this partition.

dump()

Dump this Partition resource with its properties and child resources (recursively) as a resource definition.

__repr__()

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

__str__()

Return a human readable string representation of this resource.

auto_update_enabled()

Return whether Auto-updating is currently enabled for the resource object.

cease_existence_local()

Update this Python object to indicate that the corresponding HMC object no longer exists.

disable_auto_update()

Disable Auto-updating for this resource object, if currently enabled.

enable_auto_update()

Enable Auto-updating for this resource object, if currently disabled.

get_properties_local(names[, defaults])

Return the values of a set of resource properties, using default values for those that are not cached in this Python object, without retrieving them from the HMC.

get_properties_pulled(names)

Return a set of resource properties with the values they currently have on the HMC.

get_property(name)

Return the value of a resource property.

prop(name[, default])

Return the value of a resource property, applying a default if the resource does not have a property with that name.

pull_full_properties()

Retrieve the full set of resource properties from the HMC and cache them in this Python object.

pull_properties(properties)

Retrieve the specified set of resource properties from the HMC and cache them in this Python object.

update_properties_local(properties)

Update the values of a set of resource properties on this Python object without propagating the updates to the HMC.

property nics

Access to the NICs in this Partition.

Type:

NicManager

property hbas

Access to the HBAs in this Partition.

If the “dpm-storage-management” feature is enabled (i.e. starting with z14), the CPC will not have any HBA objects anymore (they are now Virtual Storage Resources), but this property still provides a manager object for consistency.

Type:

HbaManager

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

  • 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 status 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.

This job supports cancellation. Note that it may no longer be possible to cancel the job after some point. The job status and reason codes will indicate whether the job was canceled or ran to completion.

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

This job supports cancellation. Note that it may no longer be possible to cancel the job after some point. The job status and reason codes will indicate whether the job was canceled or ran to completion.

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.

This method serializes with other methods that access or change properties on the same Python object.

Authorization requirements:

  • Object-access permission to this Partition.

  • Task permission to the “Partition Details” task.

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

This operation requires that the CPC does not have the storage management feature (i.e. is a z13).

Authorization requirements:

  • Object-access permission to this Partition.

  • Task permission to the “Dump Partition” task.

Parameters:
  • parameters (dict) – Input parameters for the operation. Allowable input parameters are defined in section ‘Request body contents’ in section ‘Dump Partition’ in the HMC API book.

  • wait_for_completion (bool) –

    Boolean controlling whether this method should wait for completion of the requested asynchronous HMC operation, as follows:

    • If True, this method will wait for completion of the asynchronous job performing the operation.

    • If False, this method will return immediately once the HMC has accepted the request to perform the operation.

  • operation_timeout (number) – Timeout in seconds, for waiting for completion of the asynchronous job performing the operation. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a OperationTimeout is raised.

Returns:

If wait_for_completion is True, returns an empty dict object.

If wait_for_completion is False, returns a Job object representing the asynchronously executing job on the HMC. This job does not support cancellation.

Return type:

dict or Job

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

Dump this Partition, by loading a standalone dump program from a storage volume and starting its execution, using the HMC operation ‘Start Dump Program’.

This operation requires that the CPC has the storage management feature (i.e. is a z14 or later).

Authorization requirements:

  • Object-access permission to this Partition.

  • Task permission to the “Dump Partition” task.

Parameters:
  • parameters (dict) – Input parameters for the operation. Allowable input parameters are defined in section ‘Request body contents’ in section ‘Start Dump Program’ in the HMC API book.

  • wait_for_completion (bool) –

    Boolean controlling whether this method should wait for completion of the requested asynchronous HMC operation, as follows:

    • If True, this method will wait for completion of the asynchronous job performing the operation.

    • If False, this method will return immediately once the HMC has accepted the request to perform the operation.

  • operation_timeout (number) – Timeout in seconds, for waiting for completion of the asynchronous job performing the operation. The special value 0 means that no timeout is set. None means that the default async operation timeout of the session is used. If the timeout expires when wait_for_completion=True, a OperationTimeout is raised.

Returns:

If wait_for_completion is True, returns an empty dict object.

If wait_for_completion is False, returns a Job object representing the asynchronously executing job on the HMC. This job does not support cancellation.

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. This job does not support cancellation.

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.

Authorization requirements:

  • Object-access permission to this Partition.

  • Task permission to the “Operating System Messages” task at least in view-only mode.

Parameters:

include_refresh_messages (bool) –

Boolean controlling whether refresh operating systems messages should be sent, as follows:

  • If True, refresh messages will be recieved when the user connects to the topic. The default.

  • If False, refresh messages will not be recieved when the user connects to the topic.

Returns:

Returns a string representing the os-message-notification JMS topic. The user can connect to this topic to start the flow of operating system messages.

Return type:

string

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

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

Authorization requirements:

  • Object-access permission to this Partition.

  • Task permission to the “Operating System Messages” task in modification mode.

Parameters:
  • os_command_text (string) – The text of the operating system command.

  • is_priority (bool) –

    Boolean controlling whether this is a priority operating system command, as follows:

    • If True, this message is treated as a priority operating system command.

    • If False, this message is not treated as a priority operating system command. The default.

Returns:

None

Raises:
list_os_messages(begin=None, end=None)[source]

List all currently available operating system messages for this partition.

Only a certain amount of OS message data from each partition is preserved by the HMC for retrieval by this operation. If the OS produces more than that amount, the oldest non-held, non-priority OS messages are no longer available. A gap in the sequence numbers indicates a loss of messages. A loss may be due to that space limitation, or it may be due to the deletion of messages by a console user or the OS.

Authorization requirements:

  • Object-access permission to this Partition.

  • Task permission to the “Operating System Messages” task (optionally in view-only mode).

Parameters:
  • begin (integer) – A message sequence number to limit returned messages. OS messages with a sequence number less than this are omitted from the results. If None, no such filtering is performed.

  • end (integer) – A message sequence number to limit returned messages. OS messages with a sequence number greater than this are omitted from the results. If None, no such filtering is performed.

Returns:

List of OS messages, where each OS message is a dict with the items defined for the “os-message-info” data structure in the HMC API book.

Return type:

list of dict

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.

  • Object-access permission to the specified Crypto Adapter.

  • Task permission to the “Partition Details” task.

Parameters:
  • crypto_adapters (iterable of Adapter) – Crypto adapters that should be added to the crypto configuration of this partition.

  • crypto_domain_configurations (iterable of domain_config) –

    Crypto domain configurations that should be added to the crypto configuration of this partition.

    A crypto domain configuration (domain_config) is a dictionary with the following keys:

    • "domain-index" (integer): Domain index of the crypto domain.

      The domain index is a number in the range of 0 to a maximum that depends on the model of the crypto adapter and the CPC model. For the Crypto Express 5S adapter in a z13, the maximum domain index is 84.

    • "access-mode" (string): Access mode for the crypto domain.

      The access mode specifies the way the partition can use the crypto domain on the crypto adapter(s), using one of the following string values:

      • "control" - The partition can load cryptographic keys into the domain, but it may not use the domain to perform cryptographic operations.

      • "control-usage" - The partition can load cryptographic keys into the domain, and it can use the domain to perform cryptographic operations.

Raises:
decrease_crypto_config(crypto_adapters, crypto_domain_indexes)[source]

Remove crypto adapters and/or crypto domains from the crypto configuration of this partition.

For the general principle for maintaining crypto configurations of partitions, see increase_crypto_config().

Example: Assume that the current crypto configuration of a partition includes crypto adapters A, B and C and crypto domains 0, 1, and 2 (on each of the adapters). When this method is called to remove adapter C and domain 2, the resulting crypto configuration of the partition will include domains 0 and 1 on each of the adapters A and B.

Authorization requirements:

  • Object-access permission to this Partition.

  • Object-access permission to the specified Crypto Adapters.

  • Task permission to the “Partition Details” task.

Parameters:
  • crypto_adapters (iterable of Adapter) – Crypto adapters that should be removed from the crypto configuration of this partition.

  • crypto_domain_indexes (iterable of integer) – Domain indexes of the crypto domains that should be removed from the crypto configuration of this partition. For values, see increase_crypto_config().

Raises:
change_crypto_domain_config(crypto_domain_index, access_mode)[source]

Change the access mode for a crypto domain that is currently included in the crypto configuration of this partition.

The access mode will be changed for the specified crypto domain on all crypto adapters currently included in the crypto configuration of this partition.

For the general principle for maintaining crypto configurations of partitions, see increase_crypto_config().

Authorization requirements:

  • Object-access permission to this Partition.

  • Task permission to the “Partition Details” task.

Parameters:
Raises:
zeroize_crypto_domain(crypto_adapter, crypto_domain_index)[source]

Zeroize a single crypto domain on a crypto adapter.

Zeroizing a crypto domain clears the cryptographic keys and non-compliance mode settings in the crypto domain.

The crypto domain must be attached to this partition in “control-usage” access mode.

Supported CPC versions: z14 GA2 and above, and the corresponding LinuxOne systems.

Authorization requirements:

  • Object-access permission to this Partition.

  • Object-access permission to the specified Crypto Adapter.

  • Task permission to the “Zeroize Crypto Domain” task.

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

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:
assign_certificate(certificate)[source]

Assigns a Certificate to this partition.

Feature enablement requirements:

  • “secure-boot-with-certificates” must be available on HMC and CPC

Authorization requirements:

  • Object-access permission to this partition.

  • Object-access permission to the specified certificate.

  • Task permission to the “Assign Secure Boot Certificates” task.

Parameters:

certificate (Certificate) – Certificate to be assigned. The certificate must not currently be assigned to this partition.

Raises:
unassign_certificate(certificate)[source]

Unassign a Certificate from this partition.

Feature enablement requirements:

  • “secure-boot-with-certificates” must be available on HMC and CPC

Authorization requirements:

  • Object-access permission to this partition.

  • Object-access permission to the specified certificate.

  • Task permission to the “Assign Secure Boot Certificates” task.

Parameters:

certificate (Certificate) – Certificate to be unassigned. The certificate must currently be assigned to this partition.

Raises:
dump()[source]

Dump this Partition resource with its properties and child resources (recursively) as a resource definition.

The returned resource definition has the following format:

{
    # Resource properties:
    "properties": {...},

    # Child resources:
    "nics": [...],
    "hbas": [...],
    "virtual_functions": [...],
}
Returns:

Resource definition of this resource.

Return type:

dict

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

Attributes:

cpc

CPC defining the scope for this manager.

case_insensitive_names

bool: Indicates whether the names of the resources are treated case insensitively.

class_name

The resource class name

name_prop

The name of the resource property indicating the resource name

parent

Subclass of BaseResource: Parent resource defining the scope for this manager.

resource_class

The Python class of the parent resource of this manager.

session

Session: Session with the HMC.

supports_properties

bool: Indicates whether the "Get Properties" operation for this type of resource supports the 'properties' query parameter in the latest released version of the HMC.

uri

The canonical URI path of the manager.

Methods:

list([full_properties, filter_args, ...])

List the Adapters in this CPC.

create_hipersocket(properties)

Create and configure a HiperSockets Adapter in this CPC.

__repr__()

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

add_resources_local(resource_obj_list)

Add a resource object to the local auto-updated list of resources.

auto_update_enabled()

Return whether Auto-updating is currently enabled for the manager object.

auto_update_needs_pull()

Return whether there is a need to pull the resources from the HMC, in the list() method.

auto_update_trigger_pull()

Trigger the need to pull the resources from the HMC, in the list() method.

disable_auto_update()

Disable Auto-updating for this manager object, if currently enabled.

dump()

Dump the resources of this resource manager as a resource definition.

enable_auto_update()

Enable Auto-updating for this manager object, if currently disabled.

find(**filter_args)

Find exactly one resource in scope of this manager, by matching resource properties against the specified filter arguments, and return its Python resource object (e.g. for a CPC, a Cpc object is returned).

find_by_name(name)

Find a resource by name and return its Python resource object (e.g. for a CPC, a Cpc object is returned).

find_local(name, uri[, properties])

Return a local resource object without fetching it from the HMC.

findall(**filter_args)

Find zero or more resources in scope of this manager, by matching resource properties against the specified filter arguments, and return a list of their Python resource objects (e.g. for CPCs, a list of Cpc objects is returned).

flush()

Invalidate the Name-URI cache of this manager.

invalidate_cache()

Invalidate the Name-URI cache of this manager.

list_resources_local()

List the resource objects from the local auto-updated list of resources.

remove_resource_local(resource_uri)

Remove the resource object for a resource URI from the local auto-updated list of resources.

resource_object(uri_or_oid[, props])

Return a minimalistic Python resource object for this resource class, that is scoped to this manager.

property cpc

CPC defining the scope for this manager.

Type:

Cpc

list(full_properties=False, filter_args=None, additional_properties=None)[source]

List the Adapters in this CPC.

Any resource property may be specified in a filter argument. For details about filter arguments, see Filtering.

The listing of resources is handled in an optimized way:

  • If this manager is enabled for Auto-updating, a locally maintained resource list is used (which is automatically updated via inventory notifications from the HMC) and the provided filter arguments are applied.

  • Otherwise, if the filter arguments specify the resource name as a single filter argument with a straight match string (i.e. without regular expressions), an optimized lookup is performed based on a locally maintained name-URI cache.

  • Otherwise, the HMC List operation is performed with the subset of the provided filter arguments that can be handled on the HMC side and the remaining filter arguments are applied on the client side on the list result.

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.

  • additional_properties (list of string) –

    List of property names that are to be returned in addition to the default properties.

    This parameter requires HMC 2.16.0 or higher.

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

Attributes:

ports

Access to the Ports of this Adapter.

port_uris_prop

Name of adapter property that specifies the adapter port URIs, or the empty string ('') for adapters without ports.

port_uri_segment

Adapter type specific URI segment for adapter port URIs, or the empty string ('') for adapters without ports.

maximum_crypto_domains

The maximum number of crypto domains on this crypto adapter.

ceased_existence

Indicates that the corresponding object on the HMC no longer exists, if auto-update is enabled for the resource.

full_properties

A boolean indicating whether or not the resource properties in this object are the full set of resource properties.

manager

Subclass of BaseManager: Manager object for this resource (and for all resources of the same type in the scope of that manager).

name

The name of the resource.

properties

The properties of this resource that are currently present in this Python object, as a dictionary.

properties_timestamp

The point in time of the last update of the resource properties cached in this object, as Unix time (an integer that is the number of seconds since the Unix epoch).

uri

The canonical URI path of the resource.

Methods:

delete()

Delete this Adapter.

update_properties(properties)

Update writeable properties of this Adapter.

__repr__()

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

change_crypto_type(crypto_type[, zeroize])

Reconfigures a cryptographic adapter to a different crypto type.

change_adapter_type(adapter_type)

Reconfigures an adapter from one type to another, or to ungonfigured.

dump()

Dump this Adapter resource with its properties and child resources (recursively) as a resource definition.

list_assigned_partitions([full_properties, ...])

List the partitions assigned to this adapter.

list_sibling_adapters([full_properties])

List the other Adapters on the same adapter card as this Adapter.

__str__()

Return a human readable string representation of this resource.

auto_update_enabled()

Return whether Auto-updating is currently enabled for the resource object.

cease_existence_local()

Update this Python object to indicate that the corresponding HMC object no longer exists.

disable_auto_update()

Disable Auto-updating for this resource object, if currently enabled.

enable_auto_update()

Enable Auto-updating for this resource object, if currently disabled.

get_properties_local(names[, defaults])

Return the values of a set of resource properties, using default values for those that are not cached in this Python object, without retrieving them from the HMC.

get_properties_pulled(names)

Return a set of resource properties with the values they currently have on the HMC.

get_property(name)

Return the value of a resource property.

prop(name[, default])

Return the value of a resource property, applying a default if the resource does not have a property with that name.

pull_full_properties()

Retrieve the full set of resource properties from the HMC and cache them in this Python object.

pull_properties(properties)

Retrieve the specified set of resource properties from the HMC and cache them in this Python object.

update_properties_local(properties)

Update the values of a set of resource properties on this Python object without propagating the updates to the HMC.

property ports

Access to the Ports of this Adapter.

Type:

PortManager

property port_uris_prop

Name of adapter property that specifies the adapter port URIs, or the empty string (‘’) for adapters without ports.

For example, ‘network-port-uris’ for a network adapter.

Type:

string

property port_uri_segment

Adapter type specific URI segment for adapter port URIs, or the empty string (‘’) for adapters without ports.

For example, ‘network-ports’ for a network adapter.

Type:

string

property maximum_crypto_domains

The maximum number of crypto domains on this crypto adapter.

The following table shows the maximum number of crypto domains for crypto adapters supported on IBM Z machine generations in DPM mode. The corresponding LinuxONE machine generations are listed in the notes below the table:

Adapter type

Machine generations

Maximum domains

Crypto Express 5S

z15 (5) / z14 (3) / z13 (1)

85

Crypto Express 5S

z15 (6) / z14-ZR1 (4) / z13s (2)

40

Crypto Express 6S

z16 (7) / z15 (5) / z14 (3)

85

Crypto Express 6S

z15 (6) / z14-ZR1 (4)

40

Crypto Express 7S

z16 (7) / z15 (5)

85

Crypto Express 7S

z15 (6)

40

Crypto Express 8S

z16 (7)

85

Notes:

  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

  5. Supported for z15-T01 and LinuxONE III LT1

  6. Supported for z15-T02 and LinuxONE III LT2

  7. Supported for z16-A01 and LinuxONE 4

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

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

Raises:
Type:

Integer

delete()[source]

Delete this Adapter.

The Adapter must be a HiperSockets Adapter.

Authorization requirements:

  • Object-access permission to the HiperSockets Adapter to be deleted.

  • Task permission to the “Delete HiperSockets Adapter” task.

Raises:
update_properties(properties)[source]

Update writeable properties of this Adapter.

This method serializes with other methods that access or change properties on the same Python object.

Authorization requirements:

  • Object-access permission to the Adapter.

  • Task permission for the “Adapter Details” task.

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:
dump()[source]

Dump this Adapter resource with its properties and child resources (recursively) as a resource definition.

The returned resource definition has the following format:

{
    # Resource properties:
    "properties": {...},

    # Child resources:
    "ports": [...],
}
Returns:

Resource definition of this resource.

Return type:

dict

list_assigned_partitions(full_properties=False, filter_args=None)[source]

List the partitions assigned to this adapter.

This method is not supported for OSA adapters configured as OSM (because those cannot be assigned to partitions).

Authorization requirements:

  • Object-access permission to this Adapter.

Parameters:
  • full_properties (bool) – Controls whether the full set of partition properties should be retrieved, vs. only a short set (uri, name, status).

  • filter_args (dict) –

    Filter arguments that narrow the list of returned partitions to those that match the specified filter arguments. For details, see Filtering.

    None causes no filtering to happen, i.e. all assigned partitions are returned.

Returns:

A list of Partition objects.

Raises:
list_sibling_adapters(full_properties=False)[source]

List the other Adapters on the same adapter card as this Adapter.

Some adapter cards are represented as multiple Adapter objects (for example, 2-port FICON Express cards, or 2-port CNA cards). This method lists the other Adapter objects that are on the same adapter card as this Adapter object.

This is useful for example to determine the affected Adapter objects when replacing the adapter card, or when changing the type of a FICON Express adepter (see change_adapter_type()).

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.

Returns:

A list of Adapter objects.

Raises:

5.8. Ports

A Port is a physical connector port (jack) of an Adapter.

Port resources are contained in Adapter resources.

Ports only exist in CPCs that are in DPM mode.

class zhmcclient.PortManager(adapter, port_type)[source]

Manager providing access to the Ports of a particular Adapter.

Derived from BaseManager; see there for common methods and attributes.

Objects of this class are not directly created by the user; they are accessible as properties in higher level resources (in this case, the Adapter object).

Attributes:

adapter

Adapter defining the scope for this manager.

port_type

Type of the Ports managed by this object:

case_insensitive_names

bool: Indicates whether the names of the resources are treated case insensitively.

class_name

The resource class name

name_prop

The name of the resource property indicating the resource name

parent

Subclass of BaseResource: Parent resource defining the scope for this manager.

resource_class

The Python class of the parent resource of this manager.

session

Session: Session with the HMC.

supports_properties

bool: Indicates whether the "Get Properties" operation for this type of resource supports the 'properties' query parameter in the latest released version of the HMC.

uri

The canonical URI path of the manager.

Methods:

list([full_properties, filter_args])

List the Ports of this Adapter.

__repr__()

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

add_resources_local(resource_obj_list)

Add a resource object to the local auto-updated list of resources.

auto_update_enabled()

Return whether Auto-updating is currently enabled for the manager object.

auto_update_needs_pull()

Return whether there is a need to pull the resources from the HMC, in the list() method.

auto_update_trigger_pull()

Trigger the need to pull the resources from the HMC, in the list() method.

disable_auto_update()

Disable Auto-updating for this manager object, if currently enabled.

dump()

Dump the resources of this resource manager as a resource definition.

enable_auto_update()

Enable Auto-updating for this manager object, if currently disabled.

find(**filter_args)

Find exactly one resource in scope of this manager, by matching resource properties against the specified filter arguments, and return its Python resource object (e.g. for a CPC, a Cpc object is returned).

find_by_name(name)

Find a resource by name and return its Python resource object (e.g. for a CPC, a Cpc object is returned).

find_local(name, uri[, properties])

Return a local resource object without fetching it from the HMC.

findall(**filter_args)

Find zero or more resources in scope of this manager, by matching resource properties against the specified filter arguments, and return a list of their Python resource objects (e.g. for CPCs, a list of Cpc objects is returned).

flush()

Invalidate the Name-URI cache of this manager.

invalidate_cache()

Invalidate the Name-URI cache of this manager.

list_resources_local()

List the resource objects from the local auto-updated list of resources.

remove_resource_local(resource_uri)

Remove the resource object for a resource URI from the local auto-updated list of resources.

resource_object(uri_or_oid[, props])

Return a minimalistic Python resource object for this resource class, that is scoped to this manager.

property adapter

Adapter defining the scope for this manager.

Type:

Adapter

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

Any resource property may be specified in a filter argument. For details about filter arguments, see Filtering.

The listing of resources is handled in an optimized way:

  • If this manager is enabled for Auto-updating, a locally maintained resource list is used (which is automatically updated via inventory notifications from the HMC) and the provided filter arguments are applied.

  • Otherwise, if the filter arguments specify the resource name as a single filter argument with a straight match string (i.e. without regular expressions), an optimized lookup is performed based on a locally maintained name-URI cache.

  • Otherwise, the corresponding array property for this resource in the parent object is used to list the resources, and the provided filter arguments are applied.

Authorization requirements:

  • Object-access permission to this Adapter.

Parameters:
  • full_properties (bool) – Controls whether the full set of resource properties should be retrieved, vs. only the short set as returned by the list operation.

  • filter_args (dict) –

    Filter arguments that narrow the list of returned resources to those that match the specified filter arguments. For details, see Filtering.

    None causes no filtering to happen, i.e. all resources are returned.

Returns:

A list of Port objects.

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

Representation of a Port.

Derived from BaseResource; see there for common methods and attributes.

For the properties of a Port, see section ‘Data model - Port Element Object’ in section ‘Adapter object’ in the HMC API book.

Objects of this class are not directly created by the user; they are returned from creation or list functions on their manager object (in this case, PortManager).

Methods:

update_properties(properties)

Update writeable properties of this Port.

dump()

Dump the Port resource with its properties as a resource definition.

__repr__()

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

__str__()

Return a human readable string representation of this resource.

auto_update_enabled()

Return whether Auto-updating is currently enabled for the resource object.

cease_existence_local()

Update this Python object to indicate that the corresponding HMC object no longer exists.

disable_auto_update()

Disable Auto-updating for this resource object, if currently enabled.

enable_auto_update()

Enable Auto-updating for this resource object, if currently disabled.

get_properties_local(names[, defaults])

Return the values of a set of resource properties, using default values for those that are not cached in this Python object, without retrieving them from the HMC.

get_properties_pulled(names)

Return a set of resource properties with the values they currently have on the HMC.

get_property(name)

Return the value of a resource property.

prop(name[, default])

Return the value of a resource property, applying a default if the resource does not have a property with that name.

pull_full_properties()

Retrieve the full set of resource properties from the HMC and cache them in this Python object.

pull_properties(properties)

Retrieve the specified set of resource properties from the HMC and cache them in this Python object.

update_properties_local(properties)

Update the values of a set of resource properties on this Python object without propagating the updates to the HMC.

Attributes:

ceased_existence

Indicates that the corresponding object on the HMC no longer exists, if auto-update is enabled for the resource.

full_properties

A boolean indicating whether or not the resource properties in this object are the full set of resource properties.

manager

Subclass of BaseManager: Manager object for this resource (and for all resources of the same type in the scope of that manager).

name

The name of the resource.

properties

The properties of this resource that are currently present in this Python object, as a dictionary.

properties_timestamp

The point in time of the last update of the resource properties cached in this object, as Unix time (an integer that is the number of seconds since the Unix epoch).

uri

The canonical URI path of the resource.

update_properties(properties)[source]

Update writeable properties of this Port.

This method serializes with other methods that access or change properties on the same Python object.

Authorization requirements:

  • Object-access permission to the Adapter of this Port.

  • Task permission to the “Adapter Details” task.

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:
dump()[source]

Dump the Port resource with its properties as a resource definition.

If the adapter of this port is a FICON adapter in the not-configured state, the port properties cannot be retrieved from the HMC, so an empty dict is returned.

Otherwise, the returned resource definition has the following format:

{
    "properties": {...},
}
Returns:

Resource definition of this Port resource.

Return type:

dict

5.9. NICs

A NIC (Network Interface Card) is a logical entity that provides a Partition with access to external communication networks through a Network Adapter. More specifically, a NIC connects a Partition with a Network Port, or with a Virtual Switch which then connects to the Network Port.

NIC resources are contained in Partition resources.

NICs only exist in CPCs that are in DPM mode.

class zhmcclient.NicManager(partition)[source]

Manager providing access to the NICs in a particular Partition.

Derived from BaseManager; see there for common methods and attributes.

Objects of this class are not directly created by the user; they are accessible via the following instance variable of a Partition object (in DPM mode):

Attributes:

partition

Partition defining the scope for this manager.

case_insensitive_names

bool: Indicates whether the names of the resources are treated case insensitively.

class_name

The resource class name

name_prop

The name of the resource property indicating the resource name

parent

Subclass of BaseResource: Parent resource defining the scope for this manager.

resource_class

The Python class of the parent resource of this manager.

session

Session: Session with the HMC.

supports_properties

bool: Indicates whether the "Get Properties" operation for this type of resource supports the 'properties' query parameter in the latest released version of the HMC.

uri

The canonical URI path of the manager.

Methods:

list([full_properties, filter_args])

List the NICs in this Partition.

create(properties)

Create and configure a NIC in this Partition.

__repr__()

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

add_resources_local(resource_obj_list)

Add a resource object to the local auto-updated list of resources.

auto_update_enabled()

Return whether Auto-updating is currently enabled for the manager object.

auto_update_needs_pull()

Return whether there is a need to pull the resources from the HMC, in the list() method.

auto_update_trigger_pull()

Trigger the need to pull the resources from the HMC, in the list() method.

disable_auto_update()

Disable Auto-updating for this manager object, if currently enabled.

dump()

Dump the resources of this resource manager as a resource definition.

enable_auto_update()

Enable Auto-updating for this manager object, if currently disabled.

find(**filter_args)

Find exactly one resource in scope of this manager, by matching resource properties against the specified filter arguments, and return its Python resource object (e.g. for a CPC, a Cpc object is returned).

find_by_name(name)

Find a resource by name and return its Python resource object (e.g. for a CPC, a Cpc object is returned).

find_local(name, uri[, properties])

Return a local resource object without fetching it from the HMC.

findall(**filter_args)

Find zero or more resources in scope of this manager, by matching resource properties against the specified filter arguments, and return a list of their Python resource objects (e.g. for CPCs, a list of Cpc objects is returned).

flush()

Invalidate the Name-URI cache of this manager.

invalidate_cache()

Invalidate the Name-URI cache of this manager.

list_resources_local()

List the resource objects from the local auto-updated list of resources.

remove_resource_local(resource_uri)

Remove the resource object for a resource URI from the local auto-updated list of resources.

resource_object(uri_or_oid[, props])

Return a minimalistic Python resource object for this resource class, that is scoped to this manager.

property partition

Partition defining the scope for this manager.

Type:

Partition

list(full_properties=False, filter_args=None)[source]

List the NICs in this Partition.

Any resource property may be specified in a filter argument. For details about filter arguments, see Filtering.

The listing of resources is handled in an optimized way:

  • If this manager is enabled for Auto-updating, a locally maintained resource list is used (which is automatically updated via inventory notifications from the HMC) and the provided filter arguments are applied.

  • Otherwise, if the filter arguments specify the resource name as a single filter argument with a straight match string (i.e. without regular expressions), an optimized lookup is performed based on a locally maintained name-URI cache.

  • Otherwise, the corresponding array property for this resource in the parent object is used to list the resources, and the provided filter arguments are applied.

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.

update_properties(properties)

Update writeable properties of this NIC.

__repr__()

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

__str__()

Return a human readable string representation of this resource.

auto_update_enabled()

Return whether Auto-updating is currently enabled for the resource object.

cease_existence_local()

Update this Python object to indicate that the corresponding HMC object no longer exists.

disable_auto_update()

Disable Auto-updating for this resource object, if currently enabled.

dump()

Dump this resource with its properties and child resources (recursively) as a resource definition.

enable_auto_update()

Enable Auto-updating for this resource object, if currently disabled.

get_properties_local(names[, defaults])

Return the values of a set of resource properties, using default values for those that are not cached in this Python object, without retrieving them from the HMC.

get_properties_pulled(names)

Return a set of resource properties with the values they currently have on the HMC.

get_property(name)

Return the value of a resource property.

prop(name[, default])

Return the value of a resource property, applying a default if the resource does not have a property with that name.

pull_full_properties()

Retrieve the full set of resource properties from the HMC and cache them in this Python object.

pull_properties(properties)

Retrieve the specified set of resource properties from the HMC and cache them in this Python object.

update_properties_local(properties)

Update the values of a set of resource properties on this Python object without propagating the updates to the HMC.

Attributes:

ceased_existence

Indicates that the corresponding object on the HMC no longer exists, if auto-update is enabled for the resource.

full_properties

A boolean indicating whether or not the resource properties in this object are the full set of resource properties.

manager

Subclass of BaseManager: Manager object for this resource (and for all resources of the same type in the scope of that manager).

name

The name of the resource.

properties

The properties of this resource that are currently present in this Python object, as a dictionary.

properties_timestamp

The point in time of the last update of the resource properties cached in this object, as Unix time (an integer that is the number of seconds since the Unix epoch).

uri

The canonical URI path of the resource.

delete()[source]

Delete this NIC.

Authorization requirements:

  • Object-access permission to the Partition containing this HBA.

  • Task permission to the “Partition Details” task.

Raises:
update_properties(properties)[source]

Update writeable properties of this NIC.

This method serializes with other methods that access or change properties on the same Python object.

Authorization requirements:

  • Object-access permission to the Partition containing this NIC.

  • Object-access permission to the backing Adapter for this NIC.

  • Task permission to the “Partition Details” task.

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.10. HBAs

A HBA (Host Bus Adapter) is a logical entity that provides a Partition with access to external storage area networks (SANs) through an FCP Adapter. More specifically, an HBA connects a Partition with an Adapter Port on an FCP Adapter.

HBA resources are contained in Partition resources.

HBA resources only exist in CPCs that are in DPM mode and when the “dpm-storage-management” feature is not enabled. See section Storage Groups for details. When the “dpm-storage-management” feature is enabled, virtual HBAs are represented as Virtual Storage Resource resources.

class zhmcclient.HbaManager(partition)[source]

Manager providing access to the HBAs in a particular Partition.

Derived from BaseManager; see there for common methods and attributes.

Objects of this class are not directly created by the user; they are accessible via the following instance variable of a Partition object (in DPM mode):

Note that this instance variable will be None if the “dpm-storage-management” feature is enabled.

Attributes:

partition

Partition defining the scope for this manager.

case_insensitive_names

bool: Indicates whether the names of the resources are treated case insensitively.

class_name

The resource class name

name_prop

The name of the resource property indicating the resource name

parent

Subclass of BaseResource: Parent resource defining the scope for this manager.

resource_class

The Python class of the parent resource of this manager.

session

Session: Session with the HMC.

supports_properties

bool: Indicates whether the "Get Properties" operation for this type of resource supports the 'properties' query parameter in the latest released version of the HMC.

uri

The canonical URI path of the manager.

Methods:

list([full_properties, filter_args])

List the HBAs in this Partition.

create(properties)

Create and configure an HBA in this Partition.

__repr__()

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

add_resources_local(resource_obj_list)

Add a resource object to the local auto-updated list of resources.

auto_update_enabled()

Return whether Auto-updating is currently enabled for the manager object.

auto_update_needs_pull()

Return whether there is a need to pull the resources from the HMC, in the list() method.

auto_update_trigger_pull()

Trigger the need to pull the resources from the HMC, in the list() method.

disable_auto_update()

Disable Auto-updating for this manager object, if currently enabled.

dump()

Dump the resources of this resource manager as a resource definition.

enable_auto_update()

Enable Auto-updating for this manager object, if currently disabled.

find(**filter_args)

Find exactly one resource in scope of this manager, by matching resource properties against the specified filter arguments, and return its Python resource object (e.g. for a CPC, a Cpc object is returned).

find_by_name(name)

Find a resource by name and return its Python resource object (e.g. for a CPC, a Cpc object is returned).

find_local(name, uri[, properties])

Return a local resource object without fetching it from the HMC.

findall(**filter_args)

Find zero or more resources in scope of this manager, by matching resource properties against the specified filter arguments, and return a list of their Python resource objects (e.g. for CPCs, a list of Cpc objects is returned).

flush()

Invalidate the Name-URI cache of this manager.

invalidate_cache()

Invalidate the Name-URI cache of this manager.

list_resources_local()

List the resource objects from the local auto-updated list of resources.

remove_resource_local(resource_uri)

Remove the resource object for a resource URI from the local auto-updated list of resources.

resource_object(uri_or_oid[, props])

Return a minimalistic Python resource object for this resource class, that is scoped to this manager.

property partition

Partition defining the scope for this manager.

Type:

Partition

list(full_properties=False, filter_args=None)[source]

List the HBAs in this Partition.

Any resource property may be specified in a filter argument. For details about filter arguments, see Filtering.

The listing of resources is handled in an optimized way:

  • If this manager is enabled for Auto-updating, a locally maintained resource list is used (which is automatically updated via inventory notifications from the HMC) and the provided filter arguments are applied.

  • Otherwise, if the filter arguments specify the resource name as a single filter argument with a straight match string (i.e. without regular expressions), an optimized lookup is performed based on a locally maintained name-URI cache.

  • Otherwise, the corresponding array property for this resource in the parent object is used to list the resources, and the provided filter arguments are applied.

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.

update_properties(properties)

Update writeable properties of this HBA.

reassign_port(port)

Reassign this HBA to a new underlying FCP port.

__repr__()

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

__str__()

Return a human readable string representation of this resource.

auto_update_enabled()

Return whether Auto-updating is currently enabled for the resource object.

cease_existence_local()

Update this Python object to indicate that the corresponding HMC object no longer exists.

disable_auto_update()

Disable Auto-updating for this resource object, if currently enabled.

dump()

Dump this resource with its properties and child resources (recursively) as a resource definition.

enable_auto_update()

Enable Auto-updating for this resource object, if currently disabled.

get_properties_local(names[, defaults])

Return the values of a set of resource properties, using default values for those that are not cached in this Python object, without retrieving them from the HMC.

get_properties_pulled(names)

Return a set of resource properties with the values they currently have on the HMC.

get_property(name)

Return the value of a resource property.

prop(name[, default])

Return the value of a resource property, applying a default if the resource does not have a property with that name.

pull_full_properties()

Retrieve the full set of resource properties from the HMC and cache them in this Python object.

pull_properties(properties)

Retrieve the specified set of resource properties from the HMC and cache them in this Python object.

update_properties_local(properties)

Update the values of a set of resource properties on this Python object without propagating the updates to the HMC.

Attributes:

ceased_existence

Indicates that the corresponding object on the HMC no longer exists, if auto-update is enabled for the resource.

full_properties

A boolean indicating whether or not the resource properties in this object are the full set of resource properties.

manager

Subclass of BaseManager: Manager object for this resource (and for all resources of the same type in the scope of that manager).

name

The name of the resource.

properties

The properties of this resource that are currently present in this Python object, as a dictionary.

properties_timestamp

The point in time of the last update of the resource properties cached in this object, as Unix time (an integer that is the number of seconds since the Unix epoch).

uri

The canonical URI path of the resource.

delete()[source]

Delete this HBA.

Authorization requirements:

  • Object-access permission to the Partition containing this HBA.

  • Task permission to the “Partition Details” task.

Raises:
update_properties(properties)[source]

Update writeable properties of this HBA.

This method serializes with other methods that access or change properties on the same Python object.

Authorization requirements:

  • Object-access permission to the Partition containing this HBA.

  • TBD: Verify: Object-access permission to the backing Adapter for this HBA.

  • Task permission to the “Partition Details” task.

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.11. Virtual Functions

A Virtual Function is a logical entity that provides a Partition with access to Accelerator Adapters.

Virtual Function resources are contained in Partition resources.

Virtual Functions only exist in CPCs that are in DPM mode.

class zhmcclient.VirtualFunctionManager(partition)[source]

Manager providing access to the Virtual Functions in a particular Partition.

Derived from BaseManager; see there for common methods and attributes.

Objects of this class are not directly created by the user; they are accessible via the following instance variable of a Partition object (in DPM mode):

Attributes:

partition

Partition defining the scope for this manager.

case_insensitive_names

bool: Indicates whether the names of the resources are treated case insensitively.

class_name

The resource class name

name_prop

The name of the resource property indicating the resource name

parent

Subclass of BaseResource: Parent resource defining the scope for this manager.

resource_class

The Python class of the parent resource of this manager.

session

Session: Session with the HMC.

supports_properties

bool: Indicates whether the "Get Properties" operation for this type of resource supports the 'properties' query parameter in the latest released version of the HMC.

uri

The canonical URI path of the manager.

Methods:

list([full_properties, filter_args])

List the Virtual Functions of this Partition.

create(properties)

Create a Virtual Function in this Partition.

__repr__()

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

add_resources_local(resource_obj_list)

Add a resource object to the local auto-updated list of resources.

auto_update_enabled()

Return whether Auto-updating is currently enabled for the manager object.

auto_update_needs_pull()

Return whether there is a need to pull the resources from the HMC, in the list() method.

auto_update_trigger_pull()

Trigger the need to pull the resources from the HMC, in the list() method.

disable_auto_update()

Disable Auto-updating for this manager object, if currently enabled.

dump()

Dump the resources of this resource manager as a resource definition.

enable_auto_update()

Enable Auto-updating for this manager object, if currently disabled.

find(**filter_args)

Find exactly one resource in scope of this manager, by matching resource properties against the specified filter arguments, and return its Python resource object (e.g. for a CPC, a Cpc object is returned).

find_by_name(name)

Find a resource by name and return its Python resource object (e.g. for a CPC, a Cpc object is returned).

find_local(name, uri[, properties])

Return a local resource object without fetching it from the HMC.

findall(**filter_args)

Find zero or more resources in scope of this manager, by matching resource properties against the specified filter arguments, and return a list of their Python resource objects (e.g. for CPCs, a list of Cpc objects is returned).

flush()

Invalidate the Name-URI cache of this manager.

invalidate_cache()

Invalidate the Name-URI cache of this manager.

list_resources_local()

List the resource objects from the local auto-updated list of resources.

remove_resource_local(resource_uri)

Remove the resource object for a resource URI from the local auto-updated list of resources.

resource_object(uri_or_oid[, props])

Return a minimalistic Python resource object for this resource class, that is scoped to this manager.

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

Any resource property may be specified in a filter argument. For details about filter arguments, see Filtering.

The listing of resources is handled in an optimized way:

  • If this manager is enabled for Auto-updating, a locally maintained resource list is used (which is automatically updated via inventory notifications from the HMC) and the provided filter arguments are applied.

  • Otherwise, if the filter arguments specify the resource name as a single filter argument with a straight match string (i.e. without regular expressions), an optimized lookup is performed based on a locally maintained name-URI cache.

  • Otherwise, the corresponding array property for this resource in the parent object is used to list the resources, and the provided filter arguments are applied.

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.

update_properties(properties)

Update writeable properties of this Virtual Function.

__repr__()

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

__str__()

Return a human readable string representation of this resource.

auto_update_enabled()

Return whether Auto-updating is currently enabled for the resource object.

cease_existence_local()

Update this Python object to indicate that the corresponding HMC object no longer exists.

disable_auto_update()

Disable Auto-updating for this resource object, if currently enabled.

dump()

Dump this resource with its properties and child resources (recursively) as a resource definition.

enable_auto_update()

Enable Auto-updating for this resource object, if currently disabled.

get_properties_local(names[, defaults])

Return the values of a set of resource properties, using default values for those that are not cached in this Python object, without retrieving them from the HMC.

get_properties_pulled(names)

Return a set of resource properties with the values they currently have on the HMC.

get_property(name)

Return the value of a resource property.

prop(name[, default])

Return the value of a resource property, applying a default if the resource does not have a property with that name.

pull_full_properties()

Retrieve the full set of resource properties from the HMC and cache them in this Python object.

pull_properties(properties)

Retrieve the specified set of resource properties from the HMC and cache them in this Python object.

update_properties_local(properties)

Update the values of a set of resource properties on this Python object without propagating the updates to the HMC.

Attributes:

ceased_existence

Indicates that the corresponding object on the HMC no longer exists, if auto-update is enabled for the resource.

full_properties

A boolean indicating whether or not the resource properties in this object are the full set of resource properties.

manager

Subclass of BaseManager: Manager object for this resource (and for all resources of the same type in the scope of that manager).

name

The name of the resource.

properties

The properties of this resource that are currently present in this Python object, as a dictionary.

properties_timestamp

The point in time of the last update of the resource properties cached in this object, as Unix time (an integer that is the number of seconds since the Unix epoch).

uri

The canonical URI path of the resource.

delete()[source]

Delete this Virtual Function.

Authorization requirements:

  • Object-access permission to the Partition of this Virtual Function.

  • Task permission for the “Partition Details” task.

Raises:
update_properties(properties)[source]

Update writeable properties of this Virtual Function.

This method serializes with other methods that access or change properties on the same Python object.

Authorization requirements:

  • Object-access permission to the Partition of this Virtual Function.

  • When updating the “adapter-uri” property, object-access permission to the Adapter identified in that URI.

  • Task permission for the “Partition Details” task.

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.12. Virtual Switches

A Virtual Switch is a virtualized networking switch connecting NICs with a Network Port.

Virtual Switches are generated automatically every time a new Network Adapter is detected and configured.

Virtual Switch resources are contained in CPC resources.

Virtual Switches only exist in CPCs that are in DPM mode.

class zhmcclient.VirtualSwitchManager(cpc)[source]

Manager providing access to the Virtual Switches in a particular CPC.

Derived from BaseManager; see there for common methods and attributes.

Objects of this class are not directly created by the user; they are accessible via the following instance variable of a Cpc object (in DPM mode):

Attributes:

cpc

CPC defining the scope for this manager.

case_insensitive_names

bool: Indicates whether the names of the resources are treated case insensitively.

class_name

The resource class name

name_prop

The name of the resource property indicating the resource name

parent

Subclass of BaseResource: Parent resource defining the scope for this manager.

resource_class

The Python class of the parent resource of this manager.

session

Session: Session with the HMC.

supports_properties

bool: Indicates whether the "Get Properties" operation for this type of resource supports the 'properties' query parameter in the latest released version of the HMC.

uri

The canonical URI path of the manager.

Methods:

list([full_properties, filter_args, ...])

List the Virtual Switches in this CPC.

__repr__()

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

add_resources_local(resource_obj_list)

Add a resource object to the local auto-updated list of resources.

auto_update_enabled()

Return whether Auto-updating is currently enabled for the manager object.

auto_update_needs_pull()

Return whether there is a need to pull the resources from the HMC, in the list() method.

auto_update_trigger_pull()

Trigger the need to pull the resources from the HMC, in the list() method.

disable_auto_update()

Disable Auto-updating for this manager object, if currently enabled.

dump()

Dump the resources of this resource manager as a resource definition.

enable_auto_update()

Enable Auto-updating for this manager object, if currently disabled.

find(**filter_args)

Find exactly one resource in scope of this manager, by matching resource properties against the specified filter arguments, and return its Python resource object (e.g. for a CPC, a Cpc object is returned).

find_by_name(name)

Find a resource by name and return its Python resource object (e.g. for a CPC, a Cpc object is returned).

find_local(name, uri[, properties])

Return a local resource object without fetching it from the HMC.

findall(**filter_args)

Find zero or more resources in scope of this manager, by matching resource properties against the specified filter arguments, and return a list of their Python resource objects (e.g. for CPCs, a list of Cpc objects is returned).

flush()

Invalidate the Name-URI cache of this manager.

invalidate_cache()

Invalidate the Name-URI cache of this manager.

list_resources_local()

List the resource objects from the local auto-updated list of resources.

remove_resource_local(resource_uri)

Remove the resource object for a resource URI from the local auto-updated list of resources.

resource_object(uri_or_oid[, props])

Return a minimalistic Python resource object for this resource class, that is scoped to this manager.

property cpc

CPC defining the scope for this manager.

Type:

Cpc

list(full_properties=False, filter_args=None, additional_properties=None)[source]

List the Virtual Switches in this CPC.

Any resource property may be specified in a filter argument. For details about filter arguments, see Filtering.

The listing of resources is handled in an optimized way:

  • If this manager is enabled for Auto-updating, a locally maintained resource list is used (which is automatically updated via inventory notifications from the HMC) and the provided filter arguments are applied.

  • Otherwise, if the filter arguments specify the resource name as a single filter argument with a straight match string (i.e. without regular expressions), an optimized lookup is performed based on a locally maintained name-URI cache.

  • Otherwise, the HMC List operation is performed with the subset of the provided filter arguments that can be handled on the HMC side and the remaining filter arguments are applied on the client side on the list result.

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.

  • additional_properties (list of string) –

    List of property names that are to be returned in addition to the default properties.

    This parameter requires HMC 2.16.0 or higher.

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.

update_properties(properties)

Update writeable properties of this Virtual Switch.

__repr__()

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

__str__()

Return a human readable string representation of this resource.

auto_update_enabled()

Return whether Auto-updating is currently enabled for the resource object.

cease_existence_local()

Update this Python object to indicate that the corresponding HMC object no longer exists.

disable_auto_update()

Disable Auto-updating for this resource object, if currently enabled.

dump()

Dump this resource with its properties and child resources (recursively) as a resource definition.

enable_auto_update()

Enable Auto-updating for this resource object, if currently disabled.

get_properties_local(names[, defaults])

Return the values of a set of resource properties, using default values for those that are not cached in this Python object, without retrieving them from the HMC.

get_properties_pulled(names)

Return a set of resource properties with the values they currently have on the HMC.

get_property(name)

Return the value of a resource property.

prop(name[, default])

Return the value of a resource property, applying a default if the resource does not have a property with that name.

pull_full_properties()

Retrieve the full set of resource properties from the HMC and cache them in this Python object.

pull_properties(properties)

Retrieve the specified set of resource properties from the HMC and cache them in this Python object.

update_properties_local(properties)

Update the values of a set of resource properties on this Python object without propagating the updates to the HMC.

Attributes:

ceased_existence

Indicates that the corresponding object on the HMC no longer exists, if auto-update is enabled for the resource.

full_properties

A boolean indicating whether or not the resource properties in this object are the full set of resource properties.

manager

Subclass of BaseManager: Manager object for this resource (and for all resources of the same type in the scope of that manager).

name

The name of the resource.

properties

The properties of this resource that are currently present in this Python object, as a dictionary.

properties_timestamp

The point in time of the last update of the resource properties cached in this object, as Unix time (an integer that is the number of seconds since the Unix epoch).

uri

The canonical URI path of the resource.

get_connected_nics()[source]

List the NICs connected to this Virtual Switch.

This method performs the “Get Connected VNICs of a Virtual Switch” HMC operation.

Authorization requirements:

  • Object-access permission to this CPC.

  • Object-access permission to the backing Adapter of this Virtual Switch.

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.

This method serializes with other methods that access or change properties on the same Python object.

Authorization requirements:

  • Object-access permission to the backing Adapter of this Virtual Switch.

  • Task permission for the “Manage Adapters” task.

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

Attributes:

console

The Console object representing the HMC.

case_insensitive_names

bool: Indicates whether the names of the resources are treated case insensitively.

class_name

The resource class name

name_prop

The name of the resource property indicating the resource name

parent

Subclass of BaseResource: Parent resource defining the scope for this manager.

resource_class

The Python class of the parent resource of this manager.

session

Session: Session with the HMC.

supports_properties

bool: Indicates whether the "Get Properties" operation for this type of resource supports the 'properties' query parameter in the latest released version of the HMC.

uri

The canonical URI path of the manager.

Methods:

list([full_properties, filter_args])

List the storage groups defined in the HMC.

create([properties, template])

Create and configure a storage group either from input properties or from a storage group template.

__repr__()

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

add_resources_local(resource_obj_list)

Add a resource object to the local auto-updated list of resources.

auto_update_enabled()

Return whether Auto-updating is currently enabled for the manager object.

auto_update_needs_pull()

Return whether there is a need to pull the resources from the HMC, in the list() method.

auto_update_trigger_pull()

Trigger the need to pull the resources from the HMC, in the list() method.

disable_auto_update()

Disable Auto-updating for this manager object, if currently enabled.

dump()

Dump the resources of this resource manager as a resource definition.

enable_auto_update()

Enable Auto-updating for this manager object, if currently disabled.

find(**filter_args)

Find exactly one resource in scope of this manager, by matching resource properties against the specified filter arguments, and return its Python resource object (e.g. for a CPC, a Cpc object is returned).

find_by_name(name)

Find a resource by name and return its Python resource object (e.g. for a CPC, a Cpc object is returned).

find_local(name, uri[, properties])

Return a local resource object without fetching it from the HMC.

findall(**filter_args)

Find zero or more resources in scope of this manager, by matching resource properties against the specified filter arguments, and return a list of their Python resource objects (e.g. for CPCs, a list of Cpc objects is returned).

flush()

Invalidate the Name-URI cache of this manager.

invalidate_cache()

Invalidate the Name-URI cache of this manager.

list_resources_local()

List the resource objects from the local auto-updated list of resources.

remove_resource_local(resource_uri)

Remove the resource object for a resource URI from the local auto-updated list of resources.

resource_object(uri_or_oid[, props])

Return a minimalistic Python resource object for this resource class, that is scoped to this manager.

property console

The Console object representing the HMC.

Type:

Console

list(full_properties=False, filter_args=None)