diff --git a/cinder/tests/test_huawei.py b/cinder/tests/test_huawei.py index fd3914b9277..0ff2c0115a9 100644 --- a/cinder/tests/test_huawei.py +++ b/cinder/tests/test_huawei.py @@ -390,7 +390,7 @@ class HuaweiVolumeTestCase(test.TestCase): def _test_get_get_volume_stats(self): stats = self.driver.get_volume_stats(True) - fakecapacity = str(int(float(FakePoolInfo['Free Capacity']) / 1024)) + fakecapacity = float(FakePoolInfo['Free Capacity']) / 1024 self.assertEqual(stats['free_capacity_gb'], fakecapacity) diff --git a/cinder/volume/drivers/huawei/huawei_iscsi.py b/cinder/volume/drivers/huawei/huawei_iscsi.py index 617f5235800..869552d0304 100644 --- a/cinder/volume/drivers/huawei/huawei_iscsi.py +++ b/cinder/volume/drivers/huawei/huawei_iscsi.py @@ -1525,7 +1525,7 @@ class HuaweiISCSIDriver(driver.ISCSIDriver): lun_type = 'Thick' poolinfo_dev = self._find_pool_info(lun_type) pools_conf = root.findall('LUN/StoragePool') - total_free_capacity = 0 + total_free_capacity = 0.0 for poolinfo in poolinfo_dev: if self.device_type['type'] == 'Dorado2100 G2': total_free_capacity += float(poolinfo[2]) @@ -1544,4 +1544,4 @@ class HuaweiISCSIDriver(driver.ISCSIDriver): total_free_capacity += float(poolinfo[4]) break - return str(int(total_free_capacity / 1024)) + return total_free_capacity / 1024