Merge "3PAR drivers volume size conversion is incorrect"

This commit is contained in:
Jenkins 2015-11-09 06:03:12 +00:00 committed by Gerrit Code Review
commit e8092ff36d
2 changed files with 12 additions and 16 deletions

View File

@ -669,7 +669,7 @@ class HP3PARBaseDriver(object):
mock.call.createVolume( mock.call.createVolume(
self.VOLUME_3PAR_NAME, self.VOLUME_3PAR_NAME,
HP3PAR_CPG, HP3PAR_CPG,
1907, { 2048, {
'comment': comment, 'comment': comment,
'tpvv': True, 'tpvv': True,
'tdvv': False, 'tdvv': False,
@ -698,7 +698,7 @@ class HP3PARBaseDriver(object):
mock.call.createVolume( mock.call.createVolume(
self.VOLUME_3PAR_NAME, self.VOLUME_3PAR_NAME,
HP3PAR_CPG2, HP3PAR_CPG2,
1907, { 2048, {
'comment': comment, 'comment': comment,
'tpvv': True, 'tpvv': True,
'tdvv': False, 'tdvv': False,
@ -854,7 +854,7 @@ class HP3PARBaseDriver(object):
mock.call.createVolume( mock.call.createVolume(
self.VOLUME_3PAR_NAME, self.VOLUME_3PAR_NAME,
HP3PAR_CPG, HP3PAR_CPG,
1907, { 2048, {
'comment': comment, 'comment': comment,
'tpvv': True, 'tpvv': True,
'tdvv': False, 'tdvv': False,
@ -899,7 +899,7 @@ class HP3PARBaseDriver(object):
mock.call.createVolume( mock.call.createVolume(
self.VOLUME_3PAR_NAME, self.VOLUME_3PAR_NAME,
HP3PAR_CPG, HP3PAR_CPG,
1907, { 2048, {
'comment': comment, 'comment': comment,
'tpvv': False, 'tpvv': False,
'tdvv': True, 'tdvv': True,
@ -949,7 +949,7 @@ class HP3PARBaseDriver(object):
mock.call.createVolume( mock.call.createVolume(
self.VOLUME_3PAR_NAME, self.VOLUME_3PAR_NAME,
HP3PAR_CPG, HP3PAR_CPG,
1907, { 2048, {
'comment': comment, 'comment': comment,
'tpvv': True, 'tpvv': True,
'tdvv': False, 'tdvv': False,

View File

@ -201,11 +201,12 @@ class HP3PARCommon(object):
2.0.49 - Added client CPG stats to driver volume stats. bug #1482741 2.0.49 - Added client CPG stats to driver volume stats. bug #1482741
2.0.50 - Add over subscription support 2.0.50 - Add over subscription support
2.0.51 - Adds consistency group support 2.0.51 - Adds consistency group support
2.0.52 - Added update_migrated_volume. bug # 1492023 2.0.52 - Added update_migrated_volume. bug #1492023
2.0.53 - Fix volume size conversion. bug #1513158
""" """
VERSION = "2.0.52" VERSION = "2.0.53"
stats = {} stats = {}
@ -789,18 +790,13 @@ class HP3PARCommon(object):
return vol_encoded return vol_encoded
def _capacity_from_size(self, vol_size): def _capacity_from_size(self, vol_size):
# because 3PAR volume sizes are in Mebibytes.
# because 3PAR volume sizes are in
# Mebibytes, Gigibytes, not Megabytes.
MB = 1000
MiB = 1.048576
if int(vol_size) == 0: if int(vol_size) == 0:
capacity = MB # default: 1GB capacity = units.Gi # default: 1GiB
else: else:
capacity = vol_size * MB capacity = vol_size * units.Gi
capacity = int(round(capacity / MiB)) capacity = int(math.ceil(capacity / units.Mi))
return capacity return capacity
def _delete_3par_host(self, hostname): def _delete_3par_host(self, hostname):