]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Fixes an issue with 3PAR attach
authorWalter A. Boring IV <walter.boring@hp.com>
Fri, 2 May 2014 22:30:47 +0000 (15:30 -0700)
committerWalter A. Boring IV <walter.boring@hp.com>
Fri, 2 May 2014 22:30:47 +0000 (15:30 -0700)
There was a case that during vlun creation
the location returned back from the 3PAR
didn't include the NSP value.

Change-Id: I6c6341fda65df0e8ce148f3d926990a50471a2db
Closes-Bug: #1315542

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

index cdfb052b7c160e8736b762ade10d2944c335705b..ff47caefafd0f612a5f1d8be56cd9362871f2fcf 100644 (file)
@@ -919,6 +919,38 @@ class HP3PARBaseDriver(object):
                                'minIOPS': '10', 'minBWS': '20',
                                'latency': '5', 'priority': 'high'})
 
+    def test_create_vlun(self):
+        host = 'fake-host'
+        lun_id = 11
+        nsp = '1:2:3'
+        mock_client = self.setup_driver()
+        location = ("%(name)s,%(lunid)s,%(host)s,%(nsp)s" %
+                    {'name': self.VOLUME_NAME,
+                     'lunid': lun_id,
+                     'host': host,
+                     'nsp': nsp})
+        mock_client.createVLUN.return_value = location
+
+        expected_info = {'volume_name': self.VOLUME_NAME,
+                         'lun_id': lun_id,
+                         'host_name': host,
+                         'nsp': nsp}
+        vlun_info = self.driver.common._create_3par_vlun(self.VOLUME_NAME,
+                                                         host, nsp)
+        self.assertEqual(expected_info, vlun_info)
+
+        location = ("%(name)s,%(lunid)s,%(host)s" %
+                    {'name': self.VOLUME_NAME,
+                     'lunid': lun_id,
+                     'host': host})
+        mock_client.createVLUN.return_value = location
+        expected_info = {'volume_name': self.VOLUME_NAME,
+                         'lun_id': lun_id,
+                         'host_name': host}
+        vlun_info = self.driver.common._create_3par_vlun(self.VOLUME_NAME,
+                                                         host, None)
+        self.assertEqual(expected_info, vlun_info)
+
 
 class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase):
 
index b1d188d503b6d2212d1778d890d3157de237e8f0..45bf53507f6ffba46c2dffb0347976ba24c3b936 100644 (file)
@@ -123,10 +123,11 @@ class HP3PARCommon(object):
         2.0.7 - Allow extend volume based on snapshot bug #1285906
         2.0.8 - Fix detach issue for multiple hosts bug #1288927
         2.0.9 - Remove unused 3PAR driver method bug #1310807
+        2.0.10 - Fixed an issue with 3PAR vlun location bug #1315542
 
     """
 
-    VERSION = "2.0.9"
+    VERSION = "2.0.10"
 
     stats = {}
 
@@ -359,8 +360,9 @@ class HP3PARCommon(object):
                 vlun_info = {'volume_name': vlun[0],
                              'lun_id': int(vlun[1]),
                              'host_name': vlun[2],
-                             'nsp': vlun[3],
                              }
+                if len(vlun) > 3:
+                    vlun_info['nsp'] = vlun[3]
 
             return vlun_info