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.
|
refresh, this property is reset.
|
||||||
"""
|
"""
|
||||||
from rsd_lib.resources.v2_4.storage_service import volume
|
from rsd_lib.resources.v2_4.storage_service import volume
|
||||||
return volume.VolumeCollection(
|
|
||||||
self._conn,
|
return [
|
||||||
utils.get_sub_resource_path_by(self, "ProvidingVolumes"),
|
volume.VolumeCollection(
|
||||||
redfish_version=self.redfish_version,
|
self._conn, path, redfish_version=self.redfish_version
|
||||||
)
|
)
|
||||||
|
for path in utils.get_sub_resource_path_by(
|
||||||
|
self, "ProvidingVolumes", is_collection=True
|
||||||
|
)
|
||||||
|
]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@utils.cache_it
|
@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
|
It is calculated once when it is queried for the first time. On
|
||||||
refresh, this property is reset.
|
refresh, this property is reset.
|
||||||
"""
|
"""
|
||||||
return storage_pool.StoragePoolCollection(
|
return [
|
||||||
self._conn,
|
storage_pool.StoragePoolCollection(
|
||||||
utils.get_sub_resource_path_by(self, "ProvidingPools"),
|
self._conn, path, redfish_version=self.redfish_version
|
||||||
redfish_version=self.redfish_version,
|
)
|
||||||
)
|
for path in utils.get_sub_resource_path_by(
|
||||||
|
self, "ProvidingPools", is_collection=True
|
||||||
|
)
|
||||||
|
]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@utils.cache_it
|
@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
|
It is calculated once when it is queried for the first time. On
|
||||||
refresh, this property is reset.
|
refresh, this property is reset.
|
||||||
"""
|
"""
|
||||||
return drive.DriveCollection(
|
return [
|
||||||
self._conn,
|
drive.DriveCollection(
|
||||||
utils.get_sub_resource_path_by(self, "ProvidingDrives"),
|
self._conn, path, redfish_version=self.redfish_version
|
||||||
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",
|
"Description": "Volume capacity source",
|
||||||
"Id": "1",
|
"Id": "1",
|
||||||
"Name": "CapacitySource",
|
"Name": "CapacitySource",
|
||||||
"ProvidingPools": {
|
"ProvidingPools": [
|
||||||
"@odata.id": "/redfish/v1/StorageServices/1/Volumes/1/CapacitySources/1/ProvidingPools"
|
{
|
||||||
},
|
"@odata.id": "/redfish/v1/StorageServices/1/Volumes/1/CapacitySources/1/ProvidingPools"
|
||||||
"ProvidingVolumes": {
|
}
|
||||||
"@odata.id": "/redfish/v1/StorageServices/1/Volumes/1/CapacitySources/1/ProvidingVolumes"
|
],
|
||||||
},
|
"ProvidingVolumes": [
|
||||||
"ProvidingDrives": {
|
{
|
||||||
"@odata.id": "/redfish/v1/StorageServices/1/Volumes/1/CapacitySources/1/ProvidingDrives"
|
"@odata.id": "/redfish/v1/StorageServices/1/Volumes/1/CapacitySources/1/ProvidingVolumes"
|
||||||
},
|
}
|
||||||
|
],
|
||||||
|
"ProvidingDrives": [
|
||||||
|
{
|
||||||
|
"@odata.id": "/redfish/v1/StorageServices/1/Volumes/1/CapacitySources/1/ProvidingDrives"
|
||||||
|
}
|
||||||
|
],
|
||||||
"ProvidedCapacity": {
|
"ProvidedCapacity": {
|
||||||
"Data": {
|
"Data": {
|
||||||
"AllocatedBytes": 3071983104
|
"AllocatedBytes": 3071983104
|
||||||
|
@ -61,8 +61,9 @@ class CapacitySourceTestCase(testtools.TestCase):
|
|||||||
# | WHEN |
|
# | WHEN |
|
||||||
actual_providing_volumes = self.capacity_sources_inst.providing_volumes
|
actual_providing_volumes = self.capacity_sources_inst.providing_volumes
|
||||||
# | THEN |
|
# | THEN |
|
||||||
|
self.assertIsInstance(actual_providing_volumes, list)
|
||||||
self.assertIsInstance(
|
self.assertIsInstance(
|
||||||
actual_providing_volumes, volume.VolumeCollection
|
actual_providing_volumes[0], volume.VolumeCollection
|
||||||
)
|
)
|
||||||
self.conn.get.return_value.json.assert_called_once_with()
|
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())
|
self.conn.get.return_value.json.return_value = json.loads(f.read())
|
||||||
# | WHEN & THEN |
|
# | WHEN & THEN |
|
||||||
self.assertIsInstance(
|
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,
|
volume.VolumeCollection,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -104,7 +108,10 @@ class CapacitySourceTestCase(testtools.TestCase):
|
|||||||
self.conn.get.return_value.json.return_value = json.loads(f.read())
|
self.conn.get.return_value.json.return_value = json.loads(f.read())
|
||||||
# | WHEN & THEN |
|
# | WHEN & THEN |
|
||||||
self.assertIsInstance(
|
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,
|
volume.VolumeCollection,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -120,8 +127,9 @@ class CapacitySourceTestCase(testtools.TestCase):
|
|||||||
# | WHEN |
|
# | WHEN |
|
||||||
actual_providing_pools = self.capacity_sources_inst.providing_pools
|
actual_providing_pools = self.capacity_sources_inst.providing_pools
|
||||||
# | THEN |
|
# | THEN |
|
||||||
|
self.assertIsInstance(actual_providing_pools, list)
|
||||||
self.assertIsInstance(
|
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()
|
self.conn.get.return_value.json.assert_called_once_with()
|
||||||
|
|
||||||
@ -143,8 +151,9 @@ class CapacitySourceTestCase(testtools.TestCase):
|
|||||||
) as f:
|
) as f:
|
||||||
self.conn.get.return_value.json.return_value = json.loads(f.read())
|
self.conn.get.return_value.json.return_value = json.loads(f.read())
|
||||||
# | WHEN & THEN |
|
# | WHEN & THEN |
|
||||||
|
self.assertIsInstance(self.capacity_sources_inst.providing_pools, list)
|
||||||
self.assertIsInstance(
|
self.assertIsInstance(
|
||||||
self.capacity_sources_inst.providing_pools,
|
self.capacity_sources_inst.providing_pools[0],
|
||||||
storage_pool.StoragePoolCollection,
|
storage_pool.StoragePoolCollection,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -165,8 +174,9 @@ class CapacitySourceTestCase(testtools.TestCase):
|
|||||||
) as f:
|
) as f:
|
||||||
self.conn.get.return_value.json.return_value = json.loads(f.read())
|
self.conn.get.return_value.json.return_value = json.loads(f.read())
|
||||||
# | WHEN & THEN |
|
# | WHEN & THEN |
|
||||||
|
self.assertIsInstance(self.capacity_sources_inst.providing_pools, list)
|
||||||
self.assertIsInstance(
|
self.assertIsInstance(
|
||||||
self.capacity_sources_inst.providing_pools,
|
self.capacity_sources_inst.providing_pools[0],
|
||||||
storage_pool.StoragePoolCollection,
|
storage_pool.StoragePoolCollection,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -180,7 +190,10 @@ class CapacitySourceTestCase(testtools.TestCase):
|
|||||||
# | WHEN |
|
# | WHEN |
|
||||||
actual_providing_drives = self.capacity_sources_inst.providing_drives
|
actual_providing_drives = self.capacity_sources_inst.providing_drives
|
||||||
# | THEN |
|
# | 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()
|
self.conn.get.return_value.json.assert_called_once_with()
|
||||||
|
|
||||||
# reset mock
|
# reset mock
|
||||||
@ -201,7 +214,11 @@ class CapacitySourceTestCase(testtools.TestCase):
|
|||||||
self.conn.get.return_value.json.return_value = json.loads(f.read())
|
self.conn.get.return_value.json.return_value = json.loads(f.read())
|
||||||
# | WHEN & THEN |
|
# | WHEN & THEN |
|
||||||
self.assertIsInstance(
|
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...
|
# 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())
|
self.conn.get.return_value.json.return_value = json.loads(f.read())
|
||||||
# | WHEN & THEN |
|
# | WHEN & THEN |
|
||||||
self.assertIsInstance(
|
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