Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: zhmcclient/zhmc-ansible-modules
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: a2c18844ca334de78cac45a61f1294ad3e4d8e46
Choose a base ref
..
head repository: zhmcclient/zhmc-ansible-modules
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 03e2854fffe9541c36838067c64b2538e53cfdc4
Choose a head ref
Showing with 57 additions and 54 deletions.
  1. +31 −43 plugins/modules/zhmc_cpc_capacity.py
  2. +24 −4 tests/end2end/mocked_hmc_z16.yaml
  3. +2 −7 tests/end2end/test_zhmc_cpc_capacity.py
74 changes: 31 additions & 43 deletions plugins/modules/zhmc_cpc_capacity.py
Original file line number Diff line number Diff line change
@@ -163,7 +163,7 @@
purpose processors can be set via the C(software_model) parameter."
- "Each item in the dictionary identifies the target number of processors
of one type of specialty processor. The key identifies the type
of specialty processor ('aap', 'icf', 'ifl', 'iip', 'sap'),
of specialty processor ('icf', 'ifl', 'iip', 'sap'),
and the value is the target number of processors of that type. Note
that the target number is the number of permanently activated
processors plus the number of temporarily activated processors."
@@ -290,42 +290,45 @@
software_model_purchased:
description:
- "The software model based on the purchased processors."
- "The software model based on the originally purchased processors."
type: str
software_model_permanent:
description:
- "The software model based on the permanent processors."
- "The software model based on the permanently present processors
(including any permanent capacity changes since the original
purchase)."
type: str
software_model_permanent_plus_billable:
description:
- "The software model based on the permanent plus billable temporary
processors."
- "The software model based on the permanently present processors
plus billable temporary processors."
type: str
software_model_permanent_plus_temporary:
description:
- "The software model based on the permanent plus all temporary
processors."
- "The software model based on the permanently present processors
plus all temporary processors."
type: str
msu_purchased:
description:
- "The MSU value associated with the software model based on the
purchased processors."
originally purchased processors."
type: int
msu_permanent:
description:
- "The MSU value associated with the software model based on the
permanent processors."
permanently present processors (including any permanent capacity
changes since the original purchase)."
type: int
msu_permanent_plus_billable:
description:
- "The MSU value associated with the software model based on the
permanent plus billable temporary processors."
permanently present processors plus billable temporary processors."
type: int
msu_permanent_plus_temporary:
description:
- "The MSU value associated with the software model based on the
permanent plus all temporary processors."
permanently present processors plus all temporary processors."
type: int
processor_count_general_purpose:
@@ -340,11 +343,6 @@
description:
- "The count of active Internal Coupling Facility (ICF) processors."
type: int
processor_count_aap:
description:
- "The count of active IBM zEnterprise Application Assist Processor
(zAAP) processors."
type: int
processor_count_iip:
description:
- "The count of active IBM z Integrated Information Processor (zIIP)
@@ -381,12 +379,6 @@
become active, when more processors are made available by adding new
hardware or by deactivating capacity records."
type: int
processor_count_pending_aap:
description:
- "The number of Application Assist processors that will become active,
when more processors are made available by adding new hardware or by
deactivating capacity records."
type: int
processor_count_pending_iip:
description:
- "The number of z Integrated Information Processors that will become
@@ -477,36 +469,34 @@
'is-on-off-cod-installed',
'is-on-off-cod-activated',
'on-off-cod-activation-date',
'software-model-purchased',
'software-model-purchased', # added in SE 2.16.0
'software-model-permanent',
'software-model-permanent-plus-billable',
'software-model-permanent-plus-temporary',
'msu-purchased',
'msu-purchased', # added in SE 2.16.0
'msu-permanent',
'msu-permanent-plus-billable',
'msu-permanent-plus-temporary',
'processor-count-general-purpose',
'processor-count-ifl',
'processor-count-icf',
'processor-count-aap',
'processor-count-iip',
'processor-count-service-assist',
'processor-count-spare',
'processor-count-defective',
'processor-count-pending-general-purpose',
'processor-count-pending-ifl',
'processor-count-pending-icf',
'processor-count-pending-aap',
'processor-count-pending-iip',
'processor-count-pending-service-assist',
'processor-count-permanent-ifl',
'processor-count-permanent-icf',
'processor-count-permanent-iip',
'processor-count-permanent-service-assist',
'processor-count-unassigned-ifl',
'processor-count-unassigned-icf',
'processor-count-unassigned-iip',
'processor-count-unassigned-service-assist',
'processor-count-permanent-ifl', # added in SE 2.16.0
'processor-count-permanent-icf', # added in SE 2.16.0
'processor-count-permanent-iip', # added in SE 2.16.0
'processor-count-permanent-service-assist', # added in SE 2.16.0
'processor-count-unassigned-ifl', # added in SE 2.16.0
'processor-count-unassigned-icf', # added in SE 2.16.0
'processor-count-unassigned-iip', # added in SE 2.16.0
'processor-count-unassigned-service-assist', # added in SE 2.16.0
]


@@ -546,7 +536,6 @@ def get_current_processor_dict(cpc):
processor_dict = {
'ifl': cpc.get_property('processor-count-ifl'),
'icf': cpc.get_property('processor-count-icf'),
'aap': cpc.get_property('processor-count-aap'),
'iip': cpc.get_property('processor-count-iip'),
'sap': cpc.get_property('processor-count-service-assist'),
}
@@ -560,8 +549,13 @@ def cpc_result_properties(cpc):
"""
result_props = {}
for prop_name in CPC_CAPACITY_PROPERTIES:
value = cpc.get_property(prop_name)
result_props[prop_name] = value
# Some properties have been added in SSE 2.16.0. If the property is
# not known by the CPC, we just ignore it.
try:
value = cpc.get_property(prop_name)
result_props[prop_name] = value
except KeyError:
pass
return ensure_underscores(result_props)


@@ -591,9 +585,6 @@ def add_temporary_capacity_check_mode(
elif proc_key == 'icf':
update_properties['processor-count-icf'] = \
cpc.get_property('processor-count-icf') + delta
elif proc_key == 'aap':
update_properties['processor-count-aap'] = \
cpc.get_property('processor-count-aap') + delta
elif proc_key == 'iip':
update_properties['processor-count-iip'] = \
cpc.get_property('processor-count-iip') + delta
@@ -631,9 +622,6 @@ def remove_temporary_capacity_check_mode(
elif proc_key == 'icf':
update_properties['processor-count-icf'] = \
cpc.get_property('processor-count-icf') - delta
elif proc_key == 'aap':
update_properties['processor-count-aap'] = \
cpc.get_property('processor-count-aap') - delta
elif proc_key == 'iip':
update_properties['processor-count-iip'] = \
cpc.get_property('processor-count-iip') - delta
28 changes: 24 additions & 4 deletions tests/end2end/mocked_hmc_z16.yaml
Original file line number Diff line number Diff line change
@@ -349,6 +349,7 @@ hmc_definition:
msu-permanent-plus-billable: 3068
msu-permanent-plus-temporary: 3068
msu-permanent: 3068
msu-purchased: 3068
network1-ipv4-alt-ipaddr: null
network1-ipv4-mask: 255.255.254.0
network1-ipv4-pri-ipaddr: 9.152.151.39
@@ -364,6 +365,8 @@ hmc_definition:
processor-count-icf: 0
processor-count-ifl: 10
processor-count-iip: 3
processor-count-service-assist: 5
processor-count-spare: 0
processor-count-pending-aap: 0
processor-count-pending-cbp: 0
processor-count-pending-general-purpose: 0
@@ -372,12 +375,19 @@ hmc_definition:
processor-count-pending-iip: 0
processor-count-pending-service-assist: 0
processor-count-pending: 0
processor-count-service-assist: 5
processor-count-spare: 0
processor-count-permanent-icf: 0
processor-count-permanent-ifl: 10
processor-count-permanent-iip: 3
processor-count-permanent-service-assist: 5
processor-count-unassigned-icf: 0
processor-count-unassigned-ifl: 0
processor-count-unassigned-iip: 0
processor-count-unassigned-service-assist: 0
se-version: 2.14.1
software-model-permanent-plus-billable: '720'
software-model-permanent-plus-temporary: '720'
software-model-permanent: '720'
software-model-purchased: '720'
status: active
storage-customer-available: 1105920
storage-customer-central: 16384
@@ -594,6 +604,7 @@ hmc_definition:
msu-permanent-plus-billable: 3068
msu-permanent-plus-temporary: 3068
msu-permanent: 3068
msu-purchased: 3068
network1-ipv4-alt-ipaddr: null
network1-ipv4-mask: 255.255.254.0
network1-ipv4-pri-ipaddr: 9.152.151.39
@@ -609,6 +620,8 @@ hmc_definition:
processor-count-icf: 0
processor-count-ifl: 10
processor-count-iip: 3
processor-count-service-assist: 5
processor-count-spare: 0
processor-count-pending-aap: 0
processor-count-pending-cbp: 0
processor-count-pending-general-purpose: 0
@@ -617,12 +630,19 @@ hmc_definition:
processor-count-pending-iip: 0
processor-count-pending-service-assist: 0
processor-count-pending: 0
processor-count-service-assist: 5
processor-count-spare: 0
processor-count-permanent-icf: 0
processor-count-permanent-ifl: 10
processor-count-permanent-iip: 3
processor-count-permanent-service-assist: 5
processor-count-unassigned-icf: 0
processor-count-unassigned-ifl: 0
processor-count-unassigned-iip: 0
processor-count-unassigned-service-assist: 0
se-version: 2.14.1
software-model-permanent-plus-billable: '720'
software-model-permanent-plus-temporary: '720'
software-model-permanent: '720'
software-model-purchased: '720'
status: active
storage-customer-available: 1105920
storage-customer-central: 16384
9 changes: 2 additions & 7 deletions tests/end2end/test_zhmc_cpc_capacity.py
Original file line number Diff line number Diff line change
@@ -78,15 +78,13 @@ def func(changed, cpc):
'processor_count_general_purpose',
'processor_count_ifl',
'processor_count_icf',
'processor_count_aap',
'processor_count_iip',
'processor_count_service_assist',
'processor_count_spare',
'processor_count_defective',
'processor_count_pending_general_purpose',
'processor_count_pending_ifl',
'processor_count_pending_icf',
'processor_count_pending_aap',
'processor_count_pending_iip',
'processor_count_pending_service_assist',
'processor_count_permanent_ifl',
@@ -165,12 +163,9 @@ def test_zhmc_cpc_capacity_facts(
changed, cpc_props = get_module_output(mod_obj)
assert changed is False

cpc_prop_names = set(cpc_props.keys())
exp_cpc_prop_names = set(CPC_CAPACITY_PROPERTIES)
assert cpc_prop_names == exp_cpc_prop_names
for name, value in cpc_props.items():
assert name in CPC_CAPACITY_PROPERTIES

for name in CPC_CAPACITY_PROPERTIES:
value = cpc_props[name]
exp_value = exp_cpc_props[name]
assert value == exp_value, \
"Incorrect value for property {p!r} in module result for " \