From f7f9e6228d8b73be6c1a4ad3fd998d02104a7a3b Mon Sep 17 00:00:00 2001 From: "Walter A. Boring IV" Date: Fri, 2 May 2014 15:30:47 -0700 Subject: [PATCH] Fixes an issue with 3PAR attach 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 | 32 +++++++++++++++++++ .../volume/drivers/san/hp/hp_3par_common.py | 6 ++-- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/cinder/tests/test_hp3par.py b/cinder/tests/test_hp3par.py index cdfb052b7..ff47caefa 100644 --- a/cinder/tests/test_hp3par.py +++ b/cinder/tests/test_hp3par.py @@ -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): diff --git a/cinder/volume/drivers/san/hp/hp_3par_common.py b/cinder/volume/drivers/san/hp/hp_3par_common.py index b1d188d50..45bf53507 100644 --- a/cinder/volume/drivers/san/hp/hp_3par_common.py +++ b/cinder/volume/drivers/san/hp/hp_3par_common.py @@ -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 -- 2.45.2