EMC ScaleIO should return ceiling of volume size

The function _get_volume_size returns the floor of volume size in
EMC ScaleIO driver.  This patch fixes it by returning the ceiling
of volume size.

Change-Id: I9cdd4437305df4526404029fab00403eb9b21692
Closes-Bug: #1591598
This commit is contained in:
yuyafei 2016-06-30 19:04:25 +08:00
parent ebee5c09fb
commit b2acb1d89f
3 changed files with 4 additions and 3 deletions

View File

@ -48,7 +48,7 @@ class TestManageExisting(scaleio.TestScaleIODriver):
'instances/Volume::' + self.volume['provider_id']:
mocks.MockHTTPSResponse({
'id': fake.PROVIDER_ID,
'sizeInKb': 8388608,
'sizeInKb': 8000000,
'mappedSdcInfo': None
}, 200)
},

View File

@ -58,7 +58,7 @@ class TestManageExistingSnapshot(scaleio.TestScaleIODriver):
'instances/Volume::' + self.snapshot['provider_id']:
mocks.MockHTTPSResponse({
'id': fake.PROVIDER2_ID,
'sizeInKb': 8388608,
'sizeInKb': 8000000,
'mappedSdcInfo': None,
'ancestorVolumeId': fake.PROVIDER_ID
}, 200),

View File

@ -19,6 +19,7 @@ Driver for EMC ScaleIO based on ScaleIO remote CLI.
import base64
import binascii
import json
import math
from os_brick.initiator import connector
from oslo_config import cfg
@ -1078,7 +1079,7 @@ class ScaleIODriver(driver.VolumeDriver):
def _get_volume_size(self, volume, existing_ref):
response = self._query_scaleio_volume(volume, existing_ref)
return int(response['sizeInKb'] / units.Mi)
return int(math.ceil(float(response['sizeInKb']) / units.Mi))
def _execute_scaleio_get_request(self, request):
r = requests.get(