From 4653773bc0cc1bf5cbc484d9ba853829bcd18eea Mon Sep 17 00:00:00 2001 From: Chris M Date: Mon, 20 Sep 2021 05:24:14 +0000 Subject: [PATCH] Seagate driver: fix get_volume_size() The driver was reporting volume sizes in units of GB (10^9), the default format the native array UIs, rather than GiB (2^30). This change also affects the HPE MSA, Dell PowerVault, and Lenovo drivers as they use the same code. Change-Id: I038f1399812e6c053622751eb62df89eff8a33db --- cinder/tests/unit/volume/drivers/test_seagate.py | 4 ++-- cinder/volume/drivers/stx/client.py | 2 +- releasenotes/notes/fix-size-reporting-seagate-driver.rst | 5 +++++ 3 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 releasenotes/notes/fix-size-reporting-seagate-driver.rst diff --git a/cinder/tests/unit/volume/drivers/test_seagate.py b/cinder/tests/unit/volume/drivers/test_seagate.py index 472121d64ee..85ae0dd6e2b 100644 --- a/cinder/tests/unit/volume/drivers/test_seagate.py +++ b/cinder/tests/unit/volume/drivers/test_seagate.py @@ -255,8 +255,8 @@ class TestSeagateClient(test.TestCase): @mock.patch.object(STXClient, '_request') def test_backend_stats(self, mock_request): - stats = {'free_capacity_gb': 1979, - 'total_capacity_gb': 1979} + stats = {'free_capacity_gb': 1843, + 'total_capacity_gb': 1843} linear = etree.XML(response_stats_linear) virtual = etree.XML(response_stats_virtual) mock_request.side_effect = [linear, virtual] diff --git a/cinder/volume/drivers/stx/client.py b/cinder/volume/drivers/stx/client.py index f3a6951abde..598efe11697 100644 --- a/cinder/volume/drivers/stx/client.py +++ b/cinder/volume/drivers/stx/client.py @@ -338,7 +338,7 @@ class STXClient(object): return False def _get_size(self, size): - return int(math.ceil(float(size) * 512 / (units.G))) + return int(math.ceil(float(size) * 512 / (units.Gi))) def backend_stats(self, backend_name, backend_type): stats = {'free_capacity_gb': 0, diff --git a/releasenotes/notes/fix-size-reporting-seagate-driver.rst b/releasenotes/notes/fix-size-reporting-seagate-driver.rst new file mode 100644 index 00000000000..9286352c726 --- /dev/null +++ b/releasenotes/notes/fix-size-reporting-seagate-driver.rst @@ -0,0 +1,5 @@ +--- +fixes: + - | + Seagate, HPE MSA, Dell PowerVault, Lenovo drivers: report volume + size in GiB (2^30) rather than GB (10^9).