Skip to content

Commit

Permalink
Fixed error in test_hba_property end2end testcase
Browse files Browse the repository at this point in the history
Details:

* The test_hba_property end2end testcase failed when trying to use the
  Partition.hbas property to invoke list(). That property is set to None
  on CPCs that have the storage management feature (i.e. z14 and later).

  It turned out that this error has always been there since the introduction
  of storage management feature support and only surfaced now when PR #1146
  added more exhaustive end2end testing also on existing functionality.

  Fixed by always initializing the Partition.hbas property even when on z14
  or later. Because the initialization is lazy, this does not affect the
  runtime, unless the hbas property is actually accessed.

Signed-off-by: Andreas Maier <maiera@de.ibm.com>
  • Loading branch information
andy-maier committed May 11, 2023
1 parent 58a8c63 commit d533d34
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
7 changes: 7 additions & 0 deletions docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@ Released: not yet

**Cleanup:**

* So far, the `Partition.hbas` property was set to `None` for CPCs that have the
"dpm-storage-management" feature enabled (i.e. starting with z14), because
HBAs are then represented as Virtual Storage Resource objects. For
consistency, this property was changed to provide an `HbaManager` object.
Since that property uses lazy initialization, there is no change at runtime
unless the property is actually accessed.

**Known issues:**

* See `list of open issues`_.
Expand Down
13 changes: 5 additions & 8 deletions zhmcclient/_partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,17 +259,14 @@ 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`.
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.
"""
# 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)
self._hbas = HbaManager(self)
return self._hbas

@property
Expand Down

0 comments on commit d533d34

Please sign in to comment.