def max_volume_size_bytes(self): """Max size available (in bytes) among all Volume resources. Returns the cached value until it (or its parent resource) is refreshed. """ return utils.max_safe(self.volumes_sizes_bytes)
def max_size_bytes(self): """Max size available in bytes among all Volumes of this collection.""" if self._max_size_bytes is None: self._max_size_bytes = ( utils.max_safe([vol.capacity_bytes for vol in self.get_members()])) return self._max_size_bytes
def max_size_bytes(self): """Max size available (in bytes) among all enabled device resources. It returns the cached value until it (or its parent resource) is refreshed. """ if self._max_size_bytes is None: self._max_size_bytes = (utils.max_safe( device.capacity_bytes for simpl_stor in self.get_members() for device in simpl_stor.devices if (device.status.state == res_cons.STATE_ENABLED))) return self._max_size_bytes
def test_max_safe(self): self.assertEqual(10, utils.max_safe([1, 3, 2, 8, 5, 10, 6])) self.assertEqual(821, utils.max_safe([15, 300, 270, None, 821, None])) self.assertEqual(0, utils.max_safe([])) self.assertIsNone(utils.max_safe([], default=None))
def drives_max_size_bytes(self): """Max size available in bytes among all Drives of this collection.""" return utils.max_safe(self.drives_sizes_bytes)
def drives_max_size_bytes(self): """Max size available in bytes among all Drives of this collection.""" if self._drives_max_size_bytes is None: self._drives_max_size_bytes = ( utils.max_safe(drv.capacity_bytes for drv in self.drives)) return self._drives_max_size_bytes