code string | signature string | docstring string | loss_without_docstring float64 | loss_with_docstring float64 | factor float64 |
|---|---|---|---|---|---|
# We do here some lazy loading.
if not self._reset_activation_profiles:
self._reset_activation_profiles = \
ActivationProfileManager(self, profile_type='reset')
return self._reset_activation_profiles | def reset_activation_profiles(self) | :class:`~zhmcclient.ActivationProfileManager`: Access to the
:term:`Reset Activation Profiles <Reset Activation Profile>` in this
CPC. | 6.21995 | 4.12922 | 1.506325 |
# We do here some lazy loading.
if not self._image_activation_profiles:
self._image_activation_profiles = \
ActivationProfileManager(self, profile_type='image')
return self._image_activation_profiles | def image_activation_profiles(self) | :class:`~zhmcclient.ActivationProfileManager`: Access to the
:term:`Image Activation Profiles <Image Activation Profile>` in this
CPC. | 4.683078 | 3.716303 | 1.260144 |
# We do here some lazy loading.
if not self._load_activation_profiles:
self._load_activation_profiles = \
ActivationProfileManager(self, profile_type='load')
return self._load_activation_profiles | def load_activation_profiles(self) | :class:`~zhmcclient.ActivationProfileManager`: Access to the
:term:`Load Activation Profiles <load Activation Profile>` in this
CPC. | 6.212577 | 4.051997 | 1.533214 |
machine_type = self.get_property('machine-type')
try:
max_parts = self._MAX_PARTITIONS_BY_MACHINE_TYPE[machine_type]
except KeyError:
raise ValueError("Unknown machine type: {!r}".format(machine_type))
return max_parts | def maximum_active_partitions(self) | Integer: The maximum number of active logical partitions or partitions
of this CPC.
The following table shows the maximum number of active logical
partitions or partitions by machine generations supported at the HMC
API:
========================= ==================
Mac... | 3.477294 | 3.51551 | 0.989129 |
feature_list = self.prop('available-features-list', None)
if feature_list is None:
raise ValueError("Firmware features are not supported on CPC %s" %
self.name)
return feature_list | def feature_info(self) | Returns information about the features available for this CPC.
Authorization requirements:
* Object-access permission to this CPC.
Returns:
:term:`iterable`:
An iterable where each item represents one feature that is
available for this CPC.
Each... | 9.43512 | 6.904111 | 1.366594 |
result = self.manager.session.post(
self.uri + '/operations/start',
wait_for_completion=wait_for_completion,
operation_timeout=operation_timeout)
return result | def start(self, wait_for_completion=True, operation_timeout=None) | Start this CPC, using the HMC operation "Start CPC".
Authorization requirements:
* Object-access permission to this CPC.
* Task permission for the "Start (start a single DPM system)" task.
Parameters:
wait_for_completion (bool):
Boolean controlling whether this ... | 3.520299 | 3.401698 | 1.034865 |
body = {'profile-area': profile_area}
result = self.manager.session.post(
self.uri + '/operations/import-profiles',
body,
wait_for_completion=wait_for_completion,
operation_timeout=operation_timeout)
return result | def import_profiles(self, profile_area, wait_for_completion=True,
operation_timeout=None) | 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 CP... | 2.846494 | 3.484528 | 0.816895 |
body = {'partitions': [p.uri for p in partitions]}
result = self.manager.session.post(self._uri + '/operations/'
'export-port-names-list', body=body)
# Parse the returned comma-separated string for each WWPN into a dict:
wwpn_list = []
... | def get_wwpns(self, partitions) | Return the WWPNs of the host ports (of the :term:`HBAs <HBA>`) of the
specified :term:`Partitions <Partition>` of this CPC.
This method performs the HMC operation "Export WWPN List".
Authorization requirements:
* Object-access permission to this CPC.
* Object-access permission... | 4.543259 | 3.586165 | 1.266885 |
body = {'power-saving': power_saving}
result = self.manager.session.post(
self.uri + '/operations/set-cpc-power-save',
body,
wait_for_completion=wait_for_completion,
operation_timeout=operation_timeout)
if wait_for_completion:
... | def set_power_save(self, power_saving, wait_for_completion=True,
operation_timeout=None) | 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"
... | 6.114517 | 5.040025 | 1.213192 |
body = {'power-capping-state': power_capping_state}
if power_cap is not None:
body['power-cap-current'] = power_cap
result = self.manager.session.post(
self.uri + '/operations/set-cpc-power-capping',
body,
wait_for_completion=wait_for_comp... | def set_power_capping(self, power_capping_state, power_cap=None,
wait_for_completion=True, operation_timeout=None) | Set the power capping settings of this CPC. The power capping settings
of a CPC define whether or not the power consumption of the CPC is
limited and if so, what the limit is. Use this method to limit the
peak power consumption of a CPC, or to remove a power consumption
limit for a CPC.
... | 5.002289 | 4.073784 | 1.227922 |
result = self.manager.session.get(self.uri + '/energy-management-data')
em_list = result['objects']
if len(em_list) != 1:
uris = [em_obj['object-uri'] for em_obj in em_list]
raise ParseError("Energy management data returned for no resource "
... | def get_energy_management_properties(self) | 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 on... | 3.486044 | 3.026837 | 1.151712 |
if filter_args is None:
filter_args = {}
else:
filter_args = filter_args.copy()
if 'cpc-uri' in filter_args:
raise ValueError(
"The filter_args parameter specifies the 'cpc-uri' property "
"with value: %s" % filter_arg... | def list_associated_storage_groups(
self, full_properties=False, filter_args=None) | Return the :term:`storage groups <storage group>` 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-acce... | 2.732161 | 2.544122 | 1.073911 |
# The operation requires exactly 16 characters in lower case
host_wwpn_16 = format(int(host_wwpn, 16), '016x')
wwpn_16 = format(int(wwpn, 16), '016x')
lun_16 = format(int(lun, 16), '016x')
body = {
'host-world-wide-port-name': host_wwpn_16,
'ada... | def validate_lun_path(self, host_wwpn, host_port, wwpn, lun) | 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
... | 2.696632 | 2.500937 | 1.078248 |
# noqa: E501
body = {
'user-pattern-uris': [up.uri for up in user_patterns]
}
self.manager.session.post(
'/api/console/operations/reorder-user-patterns',
body=body) | def reorder(self, user_patterns) | Reorder the User Patterns of the HMC as specified.
The order of User Patterns determines the search order during logon
processing.
Authorization requirements:
* Task permission to the "Manage User Patterns" task.
Parameters:
user_patterns (list of :class:`~zhmcclie... | 6.255577 | 6.502201 | 0.962071 |
self._count = 0
self._sum = float(0)
self._min = float('inf')
self._max = float(0) | def reset(self) | Reset the time statistics data for the operation. | 4.217685 | 3.251037 | 1.297335 |
if self.keeper.enabled:
if self._begin_time is None:
raise RuntimeError("end() called without preceding begin()")
dt = time.time() - self._begin_time
self._begin_time = None
self._count += 1
self._sum += dt
if dt > ... | def end(self) | This method must be called after the operation returns.
Note that this method is not to be invoked by the user; it is invoked
by the implementation of the :class:`~zhmcclient.Session` class.
If the statistics keeper holding this time statistics is enabled, this
method takes the current ... | 3.21316 | 2.833191 | 1.134113 |
if not self.enabled:
return self._disabled_stats
if name not in self._time_stats:
self._time_stats[name] = TimeStats(self, name)
return self._time_stats[name] | def get_stats(self, name) | Get the time statistics for a name.
If a time statistics for that name does not exist yet, create one.
Parameters:
name (string):
Name of the time statistics.
Returns:
TimeStats: The time statistics for the specified name. If the
statistics keeper is... | 3.221316 | 2.780584 | 1.158503 |
resource_obj_list = []
resource_obj = self._try_optimized_lookup(filter_args)
if resource_obj:
resource_obj_list.append(resource_obj)
else:
query_parms, client_filters = self._divide_filter_args(filter_args)
uri = self.parent.uri + '/operatio... | def list(self, full_properties=False, filter_args=None) | List the unmanaged CPCs exposed by the HMC this client is connected to.
Because the CPCs are unmanaged, the returned
:class:`~zhmcclient.UnmanagedCpc` objects cannot perform any operations
and will have only the following properties:
* ``object-uri``
* ``name``
Authori... | 3.620236 | 3.252457 | 1.113077 |
if not query_str:
return None
query_parms = {}
for query_item in query_str.split('&'):
# Example for these items: 'name=a%20b'
if query_item == '':
continue
items = query_item.split('=')
if len(items) != 2:
raise BadRequestError(
... | def parse_query_parms(method, uri, query_str) | Parse the specified query parms string and return a dictionary of query
parameters. The key of each dict item is the query parameter name, and the
value of each dict item is the query parameter value. If a query parameter
shows up more than once, the resulting dict item value is a list of all
those valu... | 2.575058 | 2.571912 | 1.001223 |
# Check presence of request body
if body is None:
raise BadRequestError(method, uri, reason=3,
message="Missing request body")
# Check required input fields
for field_name in field_names:
if field_name not in body:
raise BadRequestError(me... | def check_required_fields(method, uri, body, field_names) | Check required fields in the request body.
Raises:
BadRequestError with reason 3: Missing request body
BadRequestError with reason 5: Missing required field in request body | 3.35851 | 2.487639 | 1.35008 |
status = cpc.properties.get('status', None)
if status is None:
# Do nothing if no status is set on the faked CPC
return
valid_statuses = ['active', 'service-required', 'degraded', 'exceptions']
if status not in valid_statuses:
if uri.startswith(cpc.uri):
# The ur... | def check_valid_cpc_status(method, uri, cpc) | Check that the CPC is in a valid status, as indicated by its 'status'
property.
If the Cpc object does not have a 'status' property set, this function does
nothing (in order to make the mock support easy to use).
Raises:
ConflictError with reason 1: The CPC itself has been targeted by the
... | 4.382372 | 3.643717 | 1.20272 |
status = partition.properties.get('status', None)
if status is None:
# Do nothing if no status is set on the faked partition
return
if valid_statuses and status not in valid_statuses or \
invalid_statuses and status in invalid_statuses:
if uri.startswith(partition.ur... | def check_partition_status(method, uri, partition, valid_statuses=None,
invalid_statuses=None) | Check that the partition is in one of the valid statuses (if specified)
and not in one of the invalid statuses (if specified), as indicated by its
'status' property.
If the Partition object does not have a 'status' property set, this
function does nothing (in order to make the mock support easy to use)... | 4.636734 | 4.203621 | 1.103033 |
if 'crypto-configuration' not in partition.properties or \
partition.properties['crypto-configuration'] is None:
partition.properties['crypto-configuration'] = {}
crypto_config = partition.properties['crypto-configuration']
if 'crypto-adapter-uris' not in crypto_config or \
... | def ensure_crypto_config(partition) | Ensure that the 'crypto-configuration' property on the faked partition
is initialized. | 1.781679 | 1.617778 | 1.101312 |
try:
resource = hmc.lookup_by_uri(uri)
except KeyError:
raise InvalidResourceError(method, uri)
return resource.properties | def get(method, hmc, uri, uri_parms, logon_required) | Operation: Get <resource> Properties. | 5.643846 | 4.437002 | 1.271995 |
assert wait_for_completion is True # async not supported yet
try:
resource = hmc.lookup_by_uri(uri)
except KeyError:
raise InvalidResourceError(method, uri)
resource.update(body) | def post(method, hmc, uri, uri_parms, body, logon_required,
wait_for_completion) | Operation: Update <resource> Properties. | 6.059366 | 5.515124 | 1.098682 |
try:
resource = hmc.lookup_by_uri(uri)
except KeyError:
raise InvalidResourceError(method, uri)
resource.manager.remove(resource.oid) | def delete(method, hmc, uri, uri_parms, logon_required) | Operation: Delete <resource>. | 6.267822 | 5.654634 | 1.10844 |
assert wait_for_completion is True # synchronous operation
console_uri = '/api/console'
try:
console = hmc.lookup_by_uri(console_uri)
except KeyError:
raise InvalidResourceError(method, uri)
check_required_fields(method, uri, body, ['user-pattern... | def post(method, hmc, uri, uri_parms, body, logon_required,
wait_for_completion) | Operation: Reorder User Patterns. | 4.568647 | 3.763137 | 1.214053 |
assert wait_for_completion is True # synchronous operation
console_uri = '/api/console'
try:
hmc.lookup_by_uri(console_uri)
except KeyError:
raise InvalidResourceError(method, uri)
resp = []
# TODO: Add the ability to return audit log ent... | def post(method, hmc, uri, uri_parms, body, logon_required,
wait_for_completion) | Operation: Get Console Audit Log. | 12.481513 | 9.701969 | 1.286493 |
query_str = uri_parms[0]
try:
console = hmc.consoles.lookup_by_oid(None)
except KeyError:
raise InvalidResourceError(method, uri)
result_ucpcs = []
filter_args = parse_query_parms(method, uri, query_str)
for ucpc in console.unmanaged_cpcs... | def get(method, hmc, uri, uri_parms, logon_required) | Operation: List Unmanaged CPCs. | 3.781003 | 3.229715 | 1.170692 |
query_str = uri_parms[0]
try:
console = hmc.consoles.lookup_by_oid(None)
except KeyError:
raise InvalidResourceError(method, uri)
result_users = []
filter_args = parse_query_parms(method, uri, query_str)
for user in console.users.list(filt... | def get(method, hmc, uri, uri_parms, logon_required) | Operation: List Users. | 3.339178 | 3.056753 | 1.092394 |
try:
user = hmc.lookup_by_uri(uri)
except KeyError:
raise InvalidResourceError(method, uri)
# Check user type
type_ = user.properties['type']
if type_ == 'pattern-based':
raise BadRequestError(
method, uri, reason=312,
... | def delete(method, hmc, uri, uri_parms, logon_required) | Operation: Delete User. | 6.298251 | 5.835387 | 1.07932 |
assert wait_for_completion is True # synchronous operation
user_oid = uri_parms[0]
user_uri = '/api/users/' + user_oid
try:
user = hmc.lookup_by_uri(user_uri)
except KeyError:
raise InvalidResourceError(method, uri)
check_required_fields(... | def post(method, hmc, uri, uri_parms, body, logon_required,
wait_for_completion) | Operation: Add User Role to User. | 3.092007 | 2.860936 | 1.080768 |
query_str = uri_parms[0]
try:
console = hmc.consoles.lookup_by_oid(None)
except KeyError:
raise InvalidResourceError(method, uri)
result_user_roles = []
filter_args = parse_query_parms(method, uri, query_str)
for user_role in console.user_... | def get(method, hmc, uri, uri_parms, logon_required) | Operation: List User Roles. | 3.036598 | 2.735388 | 1.110116 |
assert wait_for_completion is True # synchronous operation
try:
console = hmc.consoles.lookup_by_oid(None)
except KeyError:
raise InvalidResourceError(method, uri)
check_required_fields(method, uri, body, ['name'])
properties = copy.deepcopy(body... | def post(method, hmc, uri, uri_parms, body, logon_required,
wait_for_completion) | Operation: Create User Role. | 5.17044 | 4.60523 | 1.122732 |
assert wait_for_completion is True # synchronous operation
user_role_oid = uri_parms[0]
user_role_uri = '/api/user-roles/' + user_role_oid
try:
user_role = hmc.lookup_by_uri(user_role_uri)
except KeyError:
raise InvalidResourceError(method, uri)
... | def post(method, hmc, uri, uri_parms, body, logon_required,
wait_for_completion) | Operation: Add Permission to User Role. | 4.330637 | 3.8897 | 1.11336 |
query_str = uri_parms[0]
try:
console = hmc.consoles.lookup_by_oid(None)
except KeyError:
raise InvalidResourceError(method, uri)
result_tasks = []
filter_args = parse_query_parms(method, uri, query_str)
for task in console.tasks.list(filt... | def get(method, hmc, uri, uri_parms, logon_required) | Operation: List Tasks. | 3.468234 | 3.161071 | 1.097171 |
query_str = uri_parms[0]
try:
console = hmc.consoles.lookup_by_oid(None)
except KeyError:
raise InvalidResourceError(method, uri)
result_user_patterns = []
filter_args = parse_query_parms(method, uri, query_str)
for user_pattern in console... | def get(method, hmc, uri, uri_parms, logon_required) | Operation: List User Patterns. | 3.167668 | 2.785578 | 1.137168 |
query_str = uri_parms[0]
try:
console = hmc.consoles.lookup_by_oid(None)
except KeyError:
raise InvalidResourceError(method, uri)
result_password_rules = []
filter_args = parse_query_parms(method, uri, query_str)
for password_rule in conso... | def get(method, hmc, uri, uri_parms, logon_required) | Operation: List Password Rules. | 3.107596 | 2.810591 | 1.105673 |
assert wait_for_completion is True # synchronous operation
try:
console = hmc.consoles.lookup_by_oid(None)
except KeyError:
raise InvalidResourceError(method, uri)
check_required_fields(method, uri, body, ['name'])
new_password_rule = console.pas... | def post(method, hmc, uri, uri_parms, body, logon_required,
wait_for_completion) | Operation: Create Password Rule. | 6.540294 | 5.287412 | 1.236956 |
query_str = uri_parms[0]
try:
console = hmc.consoles.lookup_by_oid(None)
except KeyError:
raise InvalidResourceError(method, uri)
result_ldap_srv_defs = []
filter_args = parse_query_parms(method, uri, query_str)
for ldap_srv_def in console... | def get(method, hmc, uri, uri_parms, logon_required) | Operation: List LDAP Server Definitions. | 2.952477 | 2.621012 | 1.126464 |
query_str = uri_parms[0]
result_cpcs = []
filter_args = parse_query_parms(method, uri, query_str)
for cpc in hmc.cpcs.list(filter_args):
result_cpc = {}
for prop in cpc.properties:
if prop in ('object-uri', 'name', 'status'):
... | def get(method, hmc, uri, uri_parms, logon_required) | Operation: List CPCs. | 2.876127 | 2.5446 | 1.130287 |
assert wait_for_completion is True # async not supported yet
cpc_oid = uri_parms[0]
try:
cpc = hmc.cpcs.lookup_by_oid(cpc_oid)
except KeyError:
raise InvalidResourceError(method, uri)
check_required_fields(method, uri, body, ['power-saving'])
... | def post(method, hmc, uri, uri_parms, body, logon_required,
wait_for_completion) | Operation: Set CPC Power Save (any CPC mode). | 3.24313 | 3.049943 | 1.063341 |
assert wait_for_completion is True # async not supported yet
cpc_oid = uri_parms[0]
try:
cpc = hmc.cpcs.lookup_by_oid(cpc_oid)
except KeyError:
raise InvalidResourceError(method, uri)
check_required_fields(method, uri, body, ['power-capping-state... | def post(method, hmc, uri, uri_parms, body, logon_required,
wait_for_completion) | Operation: Set CPC Power Capping (any CPC mode). | 2.555902 | 2.415056 | 1.05832 |
cpc_oid = uri_parms[0]
try:
cpc = hmc.cpcs.lookup_by_oid(cpc_oid)
except KeyError:
raise InvalidResourceError(method, uri)
energy_props = {
'cpc-power-cap-allowed':
cpc.properties.get('cpc-power-cap-allowed'),
'cpc... | def get(method, hmc, uri, uri_parms, logon_required) | Operation: Get CPC Energy Management Data (any CPC mode). | 1.498244 | 1.459964 | 1.02622 |
assert wait_for_completion is True # async not supported yet
cpc_oid = uri_parms[0]
try:
cpc = hmc.cpcs.lookup_by_oid(cpc_oid)
except KeyError:
raise InvalidResourceError(method, uri)
if not cpc.dpm_enabled:
raise CpcNotInDpmError(met... | def post(method, hmc, uri, uri_parms, body, logon_required,
wait_for_completion) | Operation: Stop CPC (requires DPM mode). | 4.607003 | 4.107832 | 1.121517 |
assert wait_for_completion is True # this operation is always synchr.
cpc_oid = uri_parms[0]
try:
cpc = hmc.cpcs.lookup_by_oid(cpc_oid)
except KeyError:
raise InvalidResourceError(method, uri)
if not cpc.dpm_enabled:
raise CpcNotInDpm... | def post(method, hmc, uri, uri_parms, body, logon_required,
wait_for_completion) | Operation: Export WWPN List (requires DPM mode). | 2.896516 | 2.720198 | 1.064818 |
assert wait_for_completion is True # always synchronous
check_required_fields(method, uri, body,
['anticipated-frequency-seconds'])
new_metrics_context = hmc.metrics_contexts.add(body)
result = {
'metrics-context-uri': new_metrics_conte... | def post(method, hmc, uri, uri_parms, body, logon_required,
wait_for_completion) | Operation: Create Metrics Context. | 5.795965 | 4.991899 | 1.161074 |
try:
metrics_context = hmc.lookup_by_uri(uri)
except KeyError:
raise InvalidResourceError(method, uri)
hmc.metrics_contexts.remove(metrics_context.oid) | def delete(method, hmc, uri, uri_parms, logon_required) | Operation: Delete Metrics Context. | 8.038406 | 4.632932 | 1.735058 |
try:
metrics_context = hmc.lookup_by_uri(uri)
except KeyError:
raise InvalidResourceError(method, uri)
result = metrics_context.get_metric_values_response()
return result | def get(method, hmc, uri, uri_parms, logon_required) | Operation: Get Metrics. | 6.378214 | 5.186401 | 1.229796 |
cpc_oid = uri_parms[0]
query_str = uri_parms[1]
try:
cpc = hmc.cpcs.lookup_by_oid(cpc_oid)
except KeyError:
raise InvalidResourceError(method, uri)
result_adapters = []
if cpc.dpm_enabled:
filter_args = parse_query_parms(method... | def get(method, hmc, uri, uri_parms, logon_required) | Operation: List Adapters of a CPC (empty result if not in DPM
mode). | 3.064855 | 2.669867 | 1.147943 |
assert wait_for_completion is True
cpc_oid = uri_parms[0]
try:
cpc = hmc.cpcs.lookup_by_oid(cpc_oid)
except KeyError:
raise InvalidResourceError(method, uri)
if not cpc.dpm_enabled:
raise CpcNotInDpmError(method, uri, cpc)
chec... | def post(method, hmc, uri, uri_parms, body, logon_required,
wait_for_completion) | Operation: Create Hipersocket (requires DPM mode). | 5.686607 | 5.345662 | 1.06378 |
try:
adapter = hmc.lookup_by_uri(uri)
except KeyError:
raise InvalidResourceError(method, uri)
cpc = adapter.manager.parent
assert cpc.dpm_enabled
adapter.manager.remove(adapter.oid) | def delete(method, hmc, uri, uri_parms, logon_required) | Operation: Delete Hipersocket (requires DPM mode). | 7.927327 | 6.590697 | 1.202806 |
assert wait_for_completion is True # HMC operation is synchronous
adapter_uri = uri.split('/operations/')[0]
try:
adapter = hmc.lookup_by_uri(adapter_uri)
except KeyError:
raise InvalidResourceError(method, uri)
cpc = adapter.manager.parent
... | def post(method, hmc, uri, uri_parms, body, logon_required,
wait_for_completion) | Operation: Change Crypto Type (requires DPM mode). | 5.68122 | 4.904455 | 1.15838 |
assert wait_for_completion is True # HMC operation is synchronous
adapter_uri = uri.split('/operations/')[0]
try:
adapter = hmc.lookup_by_uri(adapter_uri)
except KeyError:
raise InvalidResourceError(method, uri)
cpc = adapter.manager.parent
... | def post(method, hmc, uri, uri_parms, body, logon_required,
wait_for_completion) | Operation: Change Adapter Type (requires DPM mode). | 3.224643 | 2.972914 | 1.084674 |
cpc_oid = uri_parms[0]
query_str = uri_parms[1]
try:
cpc = hmc.cpcs.lookup_by_oid(cpc_oid)
except KeyError:
raise InvalidResourceError(method, uri)
# Reflect the result of listing the partition
result_partitions = []
if cpc.dpm_en... | def get(method, hmc, uri, uri_parms, logon_required) | Operation: List Partitions of a CPC (empty result if not in DPM
mode). | 3.419844 | 3.140445 | 1.088968 |
assert wait_for_completion is True # async not supported yet
cpc_oid = uri_parms[0]
try:
cpc = hmc.cpcs.lookup_by_oid(cpc_oid)
except KeyError:
raise InvalidResourceError(method, uri)
if not cpc.dpm_enabled:
raise CpcNotInDpmError(met... | def post(method, hmc, uri, uri_parms, body, logon_required,
wait_for_completion) | Operation: Create Partition (requires DPM mode). | 5.23255 | 4.866884 | 1.075133 |
assert wait_for_completion is True # async not supported yet
partition_oid = uri_parms[0]
partition_uri = '/api/partitions/' + partition_oid
try:
partition = hmc.lookup_by_uri(partition_uri)
except KeyError:
raise InvalidResourceError(method, uri... | def post(method, hmc, uri, uri_parms, body, logon_required,
wait_for_completion) | Operation: Start Partition (requires DPM mode). | 5.68258 | 5.121253 | 1.109607 |
assert wait_for_completion is True # synchronous operation
partition_oid = uri_parms[0]
partition_uri = '/api/partitions/' + partition_oid
try:
partition = hmc.lookup_by_uri(partition_uri)
except KeyError:
raise InvalidResourceError(method, uri)
... | def post(method, hmc, uri, uri_parms, body, logon_required,
wait_for_completion) | Operation: Mount ISO Image (requires DPM mode). | 3.838317 | 3.521105 | 1.090089 |
assert wait_for_completion is True # async not supported yet
partition_oid = uri_parms[0]
partition_uri = '/api/partitions/' + partition_oid
try:
partition = hmc.lookup_by_uri(partition_uri)
except KeyError:
raise InvalidResourceError(method, uri... | def post(method, hmc, uri, uri_parms, body, logon_required,
wait_for_completion) | Operation: Increase Crypto Configuration (requires DPM mode). | 5.113085 | 4.836558 | 1.057174 |
assert wait_for_completion is True # async not supported yet
partition_oid = uri_parms[0]
partition_uri = '/api/partitions/' + partition_oid
try:
partition = hmc.lookup_by_uri(partition_uri)
except KeyError:
raise InvalidResourceError(method, uri... | def post(method, hmc, uri, uri_parms, body, logon_required,
wait_for_completion) | Operation: Decrease Crypto Configuration (requires DPM mode). | 5.234822 | 4.907786 | 1.066636 |
assert wait_for_completion is True # async not supported yet
partition_uri = re.sub('/hbas$', '', uri)
try:
partition = hmc.lookup_by_uri(partition_uri)
except KeyError:
raise InvalidResourceError(method, uri)
cpc = partition.manager.parent
... | def post(method, hmc, uri, uri_parms, body, logon_required,
wait_for_completion) | Operation: Create HBA (requires DPM mode). | 3.640463 | 3.39062 | 1.073686 |
try:
hba = hmc.lookup_by_uri(uri)
except KeyError:
raise InvalidResourceError(method, uri)
partition = hba.manager.parent
cpc = partition.manager.parent
assert cpc.dpm_enabled
check_valid_cpc_status(method, uri, cpc)
check_partitio... | def delete(method, hmc, uri, uri_parms, logon_required) | Operation: Delete HBA (requires DPM mode). | 6.078058 | 5.341413 | 1.137912 |
assert wait_for_completion is True # async not supported yet
partition_oid = uri_parms[0]
partition_uri = '/api/partitions/' + partition_oid
hba_oid = uri_parms[1]
hba_uri = '/api/partitions/' + partition_oid + '/hbas/' + hba_oid
try:
hba = hmc.looku... | def post(method, hmc, uri, uri_parms, body, logon_required,
wait_for_completion) | Operation: Reassign Storage Adapter Port (requires DPM mode). | 3.695719 | 3.482351 | 1.061271 |
assert wait_for_completion is True # async not supported yet
partition_uri = re.sub('/nics$', '', uri)
try:
partition = hmc.lookup_by_uri(partition_uri)
except KeyError:
raise InvalidResourceError(method, uri)
cpc = partition.manager.parent
... | def post(method, hmc, uri, uri_parms, body, logon_required,
wait_for_completion) | Operation: Create NIC (requires DPM mode). | 3.101945 | 3.005107 | 1.032224 |
assert wait_for_completion is True # async not supported yet
partition_uri = re.sub('/virtual-functions$', '', uri)
try:
partition = hmc.lookup_by_uri(partition_uri)
except KeyError:
raise InvalidResourceError(method, uri)
cpc = partition.manager... | def post(method, hmc, uri, uri_parms, body, logon_required,
wait_for_completion) | Operation: Create Virtual Function (requires DPM mode). | 5.376182 | 4.673022 | 1.150472 |
cpc_oid = uri_parms[0]
query_str = uri_parms[1]
try:
cpc = hmc.cpcs.lookup_by_oid(cpc_oid)
except KeyError:
raise InvalidResourceError(method, uri)
result_vswitches = []
if cpc.dpm_enabled:
filter_args = parse_query_parms(metho... | def get(method, hmc, uri, uri_parms, logon_required) | Operation: List Virtual Switches of a CPC (empty result if not in
DPM mode). | 2.971719 | 2.535159 | 1.172202 |
assert wait_for_completion is True # async not supported yet
vswitch_oid = uri_parms[0]
vswitch_uri = '/api/virtual-switches/' + vswitch_oid
try:
vswitch = hmc.lookup_by_uri(vswitch_uri)
except KeyError:
raise InvalidResourceError(method, uri)
... | def post(method, hmc, uri, uri_parms, body, logon_required,
wait_for_completion) | Operation: Get Connected VNICs of a Virtual Switch
(requires DPM mode). | 4.61675 | 3.918442 | 1.178211 |
query_str = uri_parms[0]
filter_args = parse_query_parms(method, uri, query_str)
result_storage_groups = []
for sg in hmc.consoles.console.storage_groups.list(filter_args):
result_sg = {}
for prop in sg.properties:
if prop in ('object-uri'... | def get(method, hmc, uri, uri_parms, logon_required) | Operation: List Storage Groups (always global but with filters). | 3.426477 | 3.084526 | 1.11086 |
assert wait_for_completion is True # async not supported yet
check_required_fields(method, uri, body, ['name', 'cpc-uri', 'type'])
cpc_uri = body['cpc-uri']
try:
cpc = hmc.lookup_by_uri(cpc_uri)
except KeyError:
raise InvalidResourceError(method,... | def post(method, hmc, uri, uri_parms, body, logon_required,
wait_for_completion) | Operation: Create Storage Group. | 2.990556 | 2.926668 | 1.021829 |
assert wait_for_completion is True # async not supported yet
# The URI is a POST operation, so we need to construct the SG URI
storage_group_oid = uri_parms[0]
storage_group_uri = '/api/storage-groups/' + storage_group_oid
try:
storage_group = hmc.lookup_by_... | def post(method, hmc, uri, uri_parms, body, logon_required,
wait_for_completion) | Operation: Modify Storage Group Properties. | 2.713298 | 2.681162 | 1.011986 |
assert wait_for_completion is True # async not supported yet
# The URI is a POST operation, so we need to construct the SG URI
storage_group_oid = uri_parms[0]
storage_group_uri = '/api/storage-groups/' + storage_group_oid
try:
storage_group = hmc.lookup_by_... | def post(method, hmc, uri, uri_parms, body, logon_required,
wait_for_completion) | Operation: Delete Storage Group. | 6.562687 | 5.965765 | 1.100058 |
assert wait_for_completion is True # async not supported yet
# The URI is a POST operation, so we need to construct the SG URI
storage_group_oid = uri_parms[0]
storage_group_uri = '/api/storage-groups/' + storage_group_oid
try:
hmc.lookup_by_uri(storage_grou... | def post(method, hmc, uri, uri_parms, body, logon_required,
wait_for_completion) | Operation: Request Storage Group Fulfillment. | 7.833829 | 6.811338 | 1.150116 |
assert wait_for_completion is True # async not supported yet
# The URI is a POST operation, so we need to construct the SG URI
storage_group_oid = uri_parms[0]
storage_group_uri = '/api/storage-groups/' + storage_group_oid
try:
storage_group = hmc.lookup_by_... | def post(method, hmc, uri, uri_parms, body, logon_required,
wait_for_completion) | Operation: Add Candidate Adapter Ports to an FCP Storage Group. | 4.075235 | 3.607637 | 1.129613 |
cpc_oid = uri_parms[0]
query_str = uri_parms[1]
try:
cpc = hmc.cpcs.lookup_by_oid(cpc_oid)
except KeyError:
raise InvalidResourceError(method, uri)
result_lpars = []
if not cpc.dpm_enabled:
filter_args = parse_query_parms(metho... | def get(method, hmc, uri, uri_parms, logon_required) | Operation: List Logical Partitions of CPC (empty result in DPM
mode. | 3.054776 | 2.791634 | 1.094261 |
assert wait_for_completion is True # async not supported yet
lpar_oid = uri_parms[0]
lpar_uri = '/api/logical-partitions/' + lpar_oid
try:
lpar = hmc.lookup_by_uri(lpar_uri)
except KeyError:
raise InvalidResourceError(method, uri)
cpc = l... | def post(method, hmc, uri, uri_parms, body, logon_required,
wait_for_completion) | Operation: Activate Logical Partition (requires classic mode). | 3.614968 | 3.484643 | 1.0374 |
assert wait_for_completion is True # async not supported yet
lpar_oid = uri_parms[0]
lpar_uri = '/api/logical-partitions/' + lpar_oid
try:
lpar = hmc.lookup_by_uri(lpar_uri)
except KeyError:
raise InvalidResourceError(method, uri)
cpc = l... | def post(method, hmc, uri, uri_parms, body, logon_required,
wait_for_completion) | Operation: Load Logical Partition (requires classic mode). | 3.207016 | 3.108717 | 1.03162 |
cpc_oid = uri_parms[0]
query_str = uri_parms[1]
try:
cpc = hmc.cpcs.lookup_by_oid(cpc_oid)
except KeyError:
raise InvalidResourceError(method, uri)
assert not cpc.dpm_enabled # TODO: Verify error or empty result?
result_profiles = []
... | def get(method, hmc, uri, uri_parms, logon_required) | Operation: List Load Activation Profiles (requires classic mode). | 3.972533 | 3.421015 | 1.161215 |
result = self.session.post(self.cpc.uri + '/partitions',
body=properties)
# There should not be overlaps, but just in case there are, the
# returned props should overwrite the input props:
props = copy.deepcopy(properties)
props.update(... | def create(self, properties) | 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 '... | 5.318057 | 4.616697 | 1.151918 |
# We do here some lazy loading.
if not self._nics:
self._nics = NicManager(self)
return self._nics | def nics(self) | :class:`~zhmcclient.NicManager`: Access to the :term:`NICs <NIC>` in
this Partition. | 7.067183 | 5.533133 | 1.277248 |
# We do here some lazy loading.
if not self._hbas:
try:
dpm_sm = self.feature_enabled('dpm-storage-management')
except ValueError:
dpm_sm = False
if not dpm_sm:
self._hbas = HbaManager(self)
return self.... | def hbas(self) | :class:`~zhmcclient.HbaManager`: Access to the :term:`HBAs <HBA>` in
this Partition.
If the "dpm-storage-management" feature is enabled, this property is
`None`. | 6.413161 | 3.954511 | 1.621733 |
# We do here some lazy loading.
if not self._virtual_functions:
self._virtual_functions = VirtualFunctionManager(self)
return self._virtual_functions | def virtual_functions(self) | :class:`~zhmcclient.VirtualFunctionManager`: Access to the
:term:`Virtual Functions <Virtual Function>` in this Partition. | 6.132973 | 4.78088 | 1.282813 |
feature_list = self.prop('available-features-list', None)
if feature_list is None:
raise ValueError("Firmware features are not supported on CPC %s" %
self.manager.cpc.name)
for feature in feature_list:
if feature['name'] == feature_na... | def feature_enabled(self, feature_name) | 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
:term:`HMC API`, or use the :meth:... | 3.382086 | 3.084493 | 1.09648 |
feature_list = self.prop('available-features-list', None)
if feature_list is None:
raise ValueError("Firmware features are not supported on CPC %s" %
self.manager.cpc.name)
return feature_list | def feature_info(self) | Returns information about the features available for the CPC of this
partition.
Authorization requirements:
* Object-access permission to this partition.
Returns:
:term:`iterable`:
An iterable where each item represents one feature that is
available ... | 9.216369 | 6.80482 | 1.354388 |
result = self.manager.session.post(
self.uri + '/operations/start',
wait_for_completion=wait_for_completion,
operation_timeout=operation_timeout)
if wait_for_completion:
statuses = ["active", "degraded"]
self.wait_for_status(statuses, ... | def start(self, wait_for_completion=True, operation_timeout=None,
status_timeout=None) | 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
... | 3.48729 | 3.410285 | 1.02258 |
result = self.manager.session.post(
self.uri + '/operations/scsi-dump',
wait_for_completion=wait_for_completion,
operation_timeout=operation_timeout,
body=parameters)
return result | def dump_partition(self, parameters, wait_for_completion=True,
operation_timeout=None) | Dump this Partition, by loading a standalone dump program from a SCSI
device and starting its execution, using the HMC operation
'Dump Partition'.
Authorization requirements:
* Object-access permission to this Partition.
* Task permission to the "Dump Partition" task.
... | 4.476641 | 3.989433 | 1.122125 |
query_parms_str = '?image-name={}&ins-file-name={}'. \
format(quote(image_name, safe=''), quote(ins_file_name, safe=''))
self.manager.session.post(
self.uri + '/operations/mount-iso-image' + query_parms_str,
body=image) | def mount_iso_image(self, image, image_name, ins_file_name) | 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... | 3.6964 | 3.238927 | 1.141242 |
body = {'include-refresh-messages': include_refresh_messages}
result = self.manager.session.post(
self.uri + '/operations/open-os-message-channel', body)
return result['topic-name'] | def open_os_message_channel(self, include_refresh_messages=True) | Open a JMS message channel to this partition's operating system,
returning the string "topic" representing the message channel.
Parameters:
include_refresh_messages (bool):
Boolean controlling whether refresh operating systems messages
should be sent, as follows:
... | 5.05241 | 4.44259 | 1.137267 |
body = {'is-priority': is_priority,
'operating-system-command-text': os_command_text}
self.manager.session.post(
self.uri + '/operations/send-os-cmd', body) | def send_os_command(self, os_command_text, is_priority=False) | Send a command to the operating system running in this partition.
Parameters:
os_command_text (string): The text of the operating system command.
is_priority (bool):
Boolean controlling whether this is a priority operating system
command, as follows:
*... | 5.198136 | 4.786803 | 1.085931 |
if status_timeout is None:
status_timeout = \
self.manager.session.retry_timeout_config.status_timeout
if status_timeout > 0:
end_time = time.time() + status_timeout
if isinstance(status, (list, tuple)):
statuses = status
else:... | def wait_for_status(self, status, status_timeout=None) | Wait until the status of this partition has a desired value.
Parameters:
status (:term:`string` or iterable of :term:`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... | 3.148535 | 2.939804 | 1.071002 |
crypto_adapter_uris = [a.uri for a in crypto_adapters]
body = {'crypto-adapter-uris': crypto_adapter_uris,
'crypto-domain-configurations': crypto_domain_configurations}
self.manager.session.post(
self.uri + '/operations/increase-crypto-configuration', body) | def increase_crypto_config(self, crypto_adapters,
crypto_domain_configurations) | 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
... | 3.394663 | 4.153505 | 0.817301 |
crypto_adapter_uris = [a.uri for a in crypto_adapters]
body = {'crypto-adapter-uris': crypto_adapter_uris,
'crypto-domain-indexes': crypto_domain_indexes}
self.manager.session.post(
self.uri + '/operations/decrease-crypto-configuration', body) | def decrease_crypto_config(self, crypto_adapters,
crypto_domain_indexes) | 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 :meth:`~zhmcclient.Partition.increase_crypto_config`.
Example: Assume that the current crypto configuration o... | 3.410797 | 3.894028 | 0.875905 |
body = {'domain-index': crypto_domain_index,
'access-mode': access_mode}
self.manager.session.post(
self.uri + '/operations/change-crypto-domain-configuration', body) | def change_crypto_domain_config(self, crypto_domain_index, access_mode) | 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 ... | 4.412808 | 5.126781 | 0.860737 |
body = {
'crypto-adapter-uri': crypto_adapter.uri,
'domain-index': crypto_domain_index
}
self.manager.session.post(
self.uri + '/operations/zeroize-crypto-domain', body) | def zeroize_crypto_domain(self, crypto_adapter, crypto_domain_index) | 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 G... | 4.718666 | 4.57184 | 1.032115 |
body = {'storage-group-uri': storage_group.uri}
self.manager.session.post(
self.uri + '/operations/attach-storage-group', body) | def attach_storage_group(self, storage_group) | Attach a :term:`storage group` to this partition.
This will cause the :term:`storage volumes <storage volume>` of the
storage group to be attached to the partition, instantiating any
necessary :term:`virtual storage resource` objects.
A storage group can be attached to a partition rega... | 4.928187 | 5.122694 | 0.96203 |
body = {'storage-group-uri': storage_group.uri}
self.manager.session.post(
self.uri + '/operations/detach-storage-group', body) | def detach_storage_group(self, storage_group) | Detach a :term:`storage group` from this partition.
This will cause the :term:`storage volumes <storage volume>` of the
storage group to be detached from the partition, removing any
:term:`virtual storage resource` objects that had been created upon
attachment.
A storage group ... | 4.694835 | 5.000581 | 0.938858 |
sg_list = []
sg_uris = self.get_property('storage-group-uris')
if sg_uris:
cpc = self.manager.cpc
for sg_uri in sg_uris:
sg = cpc.storage_groups.resource_object(sg_uri)
sg_list.append(sg)
if full_properties:
... | def list_attached_storage_groups(self, full_properties=False) | Return the storage groups that are attached to this partition.
The CPC must have the "dpm-storage-management" feature enabled.
Authorization requirements:
* Object-access permission to this partition.
* Task permission to the "Partition Details" task.
Parameters:
f... | 2.844207 | 2.712246 | 1.048654 |
self.manager.session.post(self.uri, body=properties)
# The name of Password Rules cannot be updated. An attempt to do so
# should cause HTTPError to be raised in the POST above, so we assert
# that here, because we omit the extra code for handling name updates:
assert s... | def update_properties(self, properties) | Update writeable properties of this PasswordRule.
The Password Rule must be user-defined. System-defined Password Rules
cannot be updated.
Authorization requirements:
* Task permission to the "Manage Password Rules" task.
Parameters:
properties (dict): New values f... | 16.568779 | 12.617125 | 1.313198 |
if self._api_version is None:
self.query_api_version()
return self._api_version['api-major-version'],\
self._api_version['api-minor-version'] | def version_info(self) | Returns API version information for the HMC.
This operation does not require authentication.
Returns:
:term:`HMC API version`: The HMC API version supported by the HMC.
Raises:
:exc:`~zhmcclient.HTTPError`
:exc:`~zhmcclient.ParseError`
:exc:`~zhmcclie... | 4.004511 | 6.433034 | 0.622492 |
version_resp = self._session.get('/api/version',
logon_required=False)
self._api_version = version_resp
return self._api_version | def query_api_version(self) | The Query API Version operation returns information about
the level of Web Services API supported by the HMC.
This operation does not require authentication.
Returns:
:term:`json object`:
A JSON object with members ``api-major-version``,
``api-minor-version``... | 6.824972 | 8.822394 | 0.773596 |
uri = '/api/services/inventory'
body = {'resources': resources}
result = self.session.post(uri, body=body)
return result | def get_inventory(self, resources) | Returns a JSON object with the requested resources and their
properties, that are managed by the HMC.
This method performs the 'Get Inventory' HMC operation.
Parameters:
resources (:term:`iterable` of :term:`string`):
Resource classes and/or resource classifiers specifyi... | 5.358238 | 6.932107 | 0.772959 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.