Change "ProvidingPools" to list in Volume Capacity
Change-Id: I4c89ef8cf78b8269bb1658e7b8c054e9b6e10d63
This commit is contained in:
parent
e69322aebb
commit
d34ece37cd
@ -97,11 +97,15 @@ class CapacitySource(rsd_lib_base.ResourceBase):
|
||||
refresh, this property is reset.
|
||||
"""
|
||||
from rsd_lib.resources.v2_4.storage_service import volume
|
||||
return volume.VolumeCollection(
|
||||
self._conn,
|
||||
utils.get_sub_resource_path_by(self, "ProvidingVolumes"),
|
||||
redfish_version=self.redfish_version,
|
||||
)
|
||||
|
||||
return [
|
||||
volume.VolumeCollection(
|
||||
self._conn, path, redfish_version=self.redfish_version
|
||||
)
|
||||
for path in utils.get_sub_resource_path_by(
|
||||
self, "ProvidingVolumes", is_collection=True
|
||||
)
|
||||
]
|
||||
|
||||
@property
|
||||
@utils.cache_it
|
||||
@ -111,11 +115,14 @@ class CapacitySource(rsd_lib_base.ResourceBase):
|
||||
It is calculated once when it is queried for the first time. On
|
||||
refresh, this property is reset.
|
||||
"""
|
||||
return storage_pool.StoragePoolCollection(
|
||||
self._conn,
|
||||
utils.get_sub_resource_path_by(self, "ProvidingPools"),
|
||||
redfish_version=self.redfish_version,
|
||||
)
|
||||
return [
|
||||
storage_pool.StoragePoolCollection(
|
||||
self._conn, path, redfish_version=self.redfish_version
|
||||
)
|
||||
for path in utils.get_sub_resource_path_by(
|
||||
self, "ProvidingPools", is_collection=True
|
||||
)
|
||||
]
|
||||
|
||||
@property
|
||||
@utils.cache_it
|
||||
@ -125,8 +132,11 @@ class CapacitySource(rsd_lib_base.ResourceBase):
|
||||
It is calculated once when it is queried for the first time. On
|
||||
refresh, this property is reset.
|
||||
"""
|
||||
return drive.DriveCollection(
|
||||
self._conn,
|
||||
utils.get_sub_resource_path_by(self, "ProvidingDrives"),
|
||||
redfish_version=self.redfish_version,
|
||||
)
|
||||
return [
|
||||
drive.DriveCollection(
|
||||
self._conn, path, redfish_version=self.redfish_version
|
||||
)
|
||||
for path in utils.get_sub_resource_path_by(
|
||||
self, "ProvidingDrives", is_collection=True
|
||||
)
|
||||
]
|
||||
|
@ -5,15 +5,21 @@
|
||||
"Description": "Volume capacity source",
|
||||
"Id": "1",
|
||||
"Name": "CapacitySource",
|
||||
"ProvidingPools": {
|
||||
"@odata.id": "/redfish/v1/StorageServices/1/Volumes/1/CapacitySources/1/ProvidingPools"
|
||||
},
|
||||
"ProvidingVolumes": {
|
||||
"@odata.id": "/redfish/v1/StorageServices/1/Volumes/1/CapacitySources/1/ProvidingVolumes"
|
||||
},
|
||||
"ProvidingDrives": {
|
||||
"@odata.id": "/redfish/v1/StorageServices/1/Volumes/1/CapacitySources/1/ProvidingDrives"
|
||||
},
|
||||
"ProvidingPools": [
|
||||
{
|
||||
"@odata.id": "/redfish/v1/StorageServices/1/Volumes/1/CapacitySources/1/ProvidingPools"
|
||||
}
|
||||
],
|
||||
"ProvidingVolumes": [
|
||||
{
|
||||
"@odata.id": "/redfish/v1/StorageServices/1/Volumes/1/CapacitySources/1/ProvidingVolumes"
|
||||
}
|
||||
],
|
||||
"ProvidingDrives": [
|
||||
{
|
||||
"@odata.id": "/redfish/v1/StorageServices/1/Volumes/1/CapacitySources/1/ProvidingDrives"
|
||||
}
|
||||
],
|
||||
"ProvidedCapacity": {
|
||||
"Data": {
|
||||
"AllocatedBytes": 3071983104
|
||||
|
@ -61,8 +61,9 @@ class CapacitySourceTestCase(testtools.TestCase):
|
||||
# | WHEN |
|
||||
actual_providing_volumes = self.capacity_sources_inst.providing_volumes
|
||||
# | THEN |
|
||||
self.assertIsInstance(actual_providing_volumes, list)
|
||||
self.assertIsInstance(
|
||||
actual_providing_volumes, volume.VolumeCollection
|
||||
actual_providing_volumes[0], volume.VolumeCollection
|
||||
)
|
||||
self.conn.get.return_value.json.assert_called_once_with()
|
||||
|
||||
@ -84,7 +85,10 @@ class CapacitySourceTestCase(testtools.TestCase):
|
||||
self.conn.get.return_value.json.return_value = json.loads(f.read())
|
||||
# | WHEN & THEN |
|
||||
self.assertIsInstance(
|
||||
self.capacity_sources_inst.providing_volumes,
|
||||
self.capacity_sources_inst.providing_volumes, list
|
||||
)
|
||||
self.assertIsInstance(
|
||||
self.capacity_sources_inst.providing_volumes[0],
|
||||
volume.VolumeCollection,
|
||||
)
|
||||
|
||||
@ -104,7 +108,10 @@ class CapacitySourceTestCase(testtools.TestCase):
|
||||
self.conn.get.return_value.json.return_value = json.loads(f.read())
|
||||
# | WHEN & THEN |
|
||||
self.assertIsInstance(
|
||||
self.capacity_sources_inst.providing_volumes,
|
||||
self.capacity_sources_inst.providing_volumes, list
|
||||
)
|
||||
self.assertIsInstance(
|
||||
self.capacity_sources_inst.providing_volumes[0],
|
||||
volume.VolumeCollection,
|
||||
)
|
||||
|
||||
@ -120,8 +127,9 @@ class CapacitySourceTestCase(testtools.TestCase):
|
||||
# | WHEN |
|
||||
actual_providing_pools = self.capacity_sources_inst.providing_pools
|
||||
# | THEN |
|
||||
self.assertIsInstance(actual_providing_pools, list)
|
||||
self.assertIsInstance(
|
||||
actual_providing_pools, storage_pool.StoragePoolCollection
|
||||
actual_providing_pools[0], storage_pool.StoragePoolCollection
|
||||
)
|
||||
self.conn.get.return_value.json.assert_called_once_with()
|
||||
|
||||
@ -143,8 +151,9 @@ class CapacitySourceTestCase(testtools.TestCase):
|
||||
) as f:
|
||||
self.conn.get.return_value.json.return_value = json.loads(f.read())
|
||||
# | WHEN & THEN |
|
||||
self.assertIsInstance(self.capacity_sources_inst.providing_pools, list)
|
||||
self.assertIsInstance(
|
||||
self.capacity_sources_inst.providing_pools,
|
||||
self.capacity_sources_inst.providing_pools[0],
|
||||
storage_pool.StoragePoolCollection,
|
||||
)
|
||||
|
||||
@ -165,8 +174,9 @@ class CapacitySourceTestCase(testtools.TestCase):
|
||||
) as f:
|
||||
self.conn.get.return_value.json.return_value = json.loads(f.read())
|
||||
# | WHEN & THEN |
|
||||
self.assertIsInstance(self.capacity_sources_inst.providing_pools, list)
|
||||
self.assertIsInstance(
|
||||
self.capacity_sources_inst.providing_pools,
|
||||
self.capacity_sources_inst.providing_pools[0],
|
||||
storage_pool.StoragePoolCollection,
|
||||
)
|
||||
|
||||
@ -180,7 +190,10 @@ class CapacitySourceTestCase(testtools.TestCase):
|
||||
# | WHEN |
|
||||
actual_providing_drives = self.capacity_sources_inst.providing_drives
|
||||
# | THEN |
|
||||
self.assertIsInstance(actual_providing_drives, drive.DriveCollection)
|
||||
self.assertIsInstance(actual_providing_drives, list)
|
||||
self.assertIsInstance(
|
||||
actual_providing_drives[0], drive.DriveCollection
|
||||
)
|
||||
self.conn.get.return_value.json.assert_called_once_with()
|
||||
|
||||
# reset mock
|
||||
@ -201,7 +214,11 @@ class CapacitySourceTestCase(testtools.TestCase):
|
||||
self.conn.get.return_value.json.return_value = json.loads(f.read())
|
||||
# | WHEN & THEN |
|
||||
self.assertIsInstance(
|
||||
self.capacity_sources_inst.providing_drives, drive.DriveCollection
|
||||
self.capacity_sources_inst.providing_drives, list
|
||||
)
|
||||
self.assertIsInstance(
|
||||
self.capacity_sources_inst.providing_drives[0],
|
||||
drive.DriveCollection,
|
||||
)
|
||||
|
||||
# On refreshing the chassis instance...
|
||||
@ -220,5 +237,9 @@ class CapacitySourceTestCase(testtools.TestCase):
|
||||
self.conn.get.return_value.json.return_value = json.loads(f.read())
|
||||
# | WHEN & THEN |
|
||||
self.assertIsInstance(
|
||||
self.capacity_sources_inst.providing_drives, drive.DriveCollection
|
||||
self.capacity_sources_inst.providing_drives, list
|
||||
)
|
||||
self.assertIsInstance(
|
||||
self.capacity_sources_inst.providing_drives[0],
|
||||
drive.DriveCollection,
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user