]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
3PAR: Fix extend volume GiB to MiB
authorKurt Martin <kurt.f.martin@hp.com>
Tue, 25 Feb 2014 16:30:01 +0000 (08:30 -0800)
committerGerrit Code Review <review@openstack.org>
Tue, 25 Feb 2014 19:29:09 +0000 (19:29 +0000)
Extend volume was sending GiB instead of MiB to the 3PAR
array. This patch is now sending the growth size in MiBs
instead of GiBs.

Change-Id: Ib4903315a32e090e760883cc80c50f3698fe015f
Closes-Bug: #1284368

cinder/tests/test_hp3par.py
cinder/volume/drivers/san/hp/hp_3par_common.py

index 820a880ae3606457d5f24e7554537a2bad575d0d..f015b73543ba200a1db4d0314d56165a6d0680d6 100644 (file)
@@ -24,6 +24,7 @@ from cinder import context
 from cinder import exception
 from cinder.openstack.common import log as logging
 from cinder import test
+from cinder import units
 from cinder.volume.drivers.san.hp import hp_3par_fc as hpfcdriver
 from cinder.volume.drivers.san.hp import hp_3par_iscsi as hpdriver
 from cinder.volume import qos_specs
@@ -773,9 +774,10 @@ class HP3PARBaseDriver(object):
         old_size = self.volume['size']
         new_size = old_size + grow_size
         self.driver.extend_volume(self.volume, str(new_size))
+        growth_size_mib = grow_size * units.KiB
 
         expected = [
-            mock.call.growVolume(self.VOLUME_3PAR_NAME, grow_size)]
+            mock.call.growVolume(self.VOLUME_3PAR_NAME, growth_size_mib)]
 
         mock_client.assert_has_calls(expected)
 
index 8bb6b434fe8072e4391706a2e3463f429815d302..f3fb0bde867125fb4a03532b903db5a9856f06ec 100644 (file)
@@ -118,10 +118,11 @@ class HP3PARCommon(object):
         2.0.2 - Add back-end assisted volume migrate
         2.0.3 - Allow deleting missing snapshots bug #1283233
         2.0.4 - Allow volumes created from snapshots to be larger bug #1279478
+        2.0.5 - Fix extend volume units bug #1284368
 
     """
 
-    VERSION = "2.0.4"
+    VERSION = "2.0.5"
 
     stats = {}
 
@@ -248,8 +249,9 @@ class HP3PARCommon(object):
         growth_size = int(new_size) - old_size
         LOG.debug("Extending Volume %s from %s to %s, by %s GB." %
                   (volume_name, old_size, new_size, growth_size))
+        growth_size_mib = growth_size * units.KiB
         try:
-            self.client.growVolume(volume_name, growth_size)
+            self.client.growVolume(volume_name, growth_size_mib)
         except Exception:
             with excutils.save_and_reraise_exception():
                 LOG.error(_("Error extending volume %s") % volume)