]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
3PAR use same LUN id for each export path
authorWalter A. Boring IV <walter.boring@hpe.com>
Tue, 1 Mar 2016 15:22:21 +0000 (07:22 -0800)
committerWalter A. Boring IV <walter.boring@hpe.com>
Thu, 3 Mar 2016 13:19:31 +0000 (05:19 -0800)
When multipath is enabled, and the 3PAR driver is configured
to export a VLUN over N iSCSI IP(ports), we now use the same
LUN ID for each iSCSI IP export.  Previously, when we would
export a volume over N iSCSI ports, we would get a new LUN ID
for each iSCSI port.

Change-Id: Ide0ce373a14f348a554688dee9b699feed3c5f26
Closes-Bug: #1551994

cinder/tests/unit/test_hpe3par.py
cinder/volume/drivers/hpe/hpe_3par_common.py
cinder/volume/drivers/hpe/hpe_3par_iscsi.py

index 747b17952ba9edc9e06f1fea6df2c05c502e8dcc..e2b428c338ff389475e1057f78c46c3e8a76a378 100644 (file)
@@ -4474,7 +4474,8 @@ class TestHPE3PARFCDriver(HPE3PARBaseDriver, test.TestCase):
                 mock.call.createVLUN(
                     self.VOLUME_3PAR_NAME,
                     auto=True,
-                    hostname=self.FAKE_HOST),
+                    hostname=self.FAKE_HOST,
+                    lun=None),
                 mock.call.getHostVLUNs(self.FAKE_HOST)]
 
             mock_client.assert_has_calls(
@@ -4567,7 +4568,8 @@ class TestHPE3PARFCDriver(HPE3PARBaseDriver, test.TestCase):
                     self.VOLUME_3PAR_NAME,
                     auto=True,
                     hostname=self.FAKE_HOST,
-                    portPos={'node': 7, 'slot': 1, 'cardPort': 1}),
+                    portPos={'node': 7, 'slot': 1, 'cardPort': 1},
+                    lun=None),
                 mock.call.getHostVLUNs(self.FAKE_HOST)]
 
             mock_client.assert_has_calls(
@@ -4640,7 +4642,8 @@ class TestHPE3PARFCDriver(HPE3PARBaseDriver, test.TestCase):
                 mock.call.createVLUN(
                     self.VOLUME_3PAR_NAME,
                     auto=True,
-                    hostname=self.FAKE_HOST),
+                    hostname=self.FAKE_HOST,
+                    lun=None),
                 mock.call.getHostVLUNs(self.FAKE_HOST)]
 
             mock_client.assert_has_calls(
@@ -5520,7 +5523,8 @@ class TestHPE3PARISCSIDriver(HPE3PARBaseDriver, test.TestCase):
                     self.VOLUME_3PAR_NAME,
                     auto=True,
                     hostname=self.FAKE_HOST,
-                    portPos=self.FAKE_ISCSI_PORT['portPos']),
+                    portPos=self.FAKE_ISCSI_PORT['portPos'],
+                    lun=None),
                 mock.call.getHostVLUNs(self.FAKE_HOST)]
 
             mock_client.assert_has_calls(
index 27dbd59e42d789daf8c8eebab2646f8359dd2f1d..79e1e384a7581ff5757153193d3d50754281915d 100644 (file)
@@ -228,10 +228,11 @@ class HPE3PARCommon(object):
         3.0.13 - Support creating a cg from a source cg
         3.0.14 - Comparison of WWNs now handles case difference. bug #1546453
         3.0.15 - Update replication to version 2.1
+        3.0.16 - Use same LUN ID for each VLUN path #1551994
 
     """
 
-    VERSION = "3.0.15"
+    VERSION = "3.0.16"
 
     stats = {}
 
@@ -1104,16 +1105,22 @@ class HPE3PARCommon(object):
     def _delete_3par_host(self, hostname):
         self.client.deleteHost(hostname)
 
-    def _create_3par_vlun(self, volume, hostname, nsp):
+    def _create_3par_vlun(self, volume, hostname, nsp, lun_id=None):
         try:
             location = None
+            auto = True
+
+            if lun_id:
+                auto = False
+
             if nsp is None:
                 location = self.client.createVLUN(volume, hostname=hostname,
-                                                  auto=True)
+                                                  auto=auto, lun=lun_id)
             else:
                 port = self.build_portPos(nsp)
                 location = self.client.createVLUN(volume, hostname=hostname,
-                                                  auto=True, portPos=port)
+                                                  auto=auto, portPos=port,
+                                                  lun=lun_id)
 
             vlun_info = None
             if location:
@@ -1364,13 +1371,14 @@ class HPE3PARCommon(object):
                      {'name': volume_name, 'host': hostname})
         return found_vlun
 
-    def create_vlun(self, volume, host, nsp=None):
+    def create_vlun(self, volume, host, nsp=None, lun_id=None):
         """Create a VLUN.
 
         In order to export a volume on a 3PAR box, we have to create a VLUN.
         """
         volume_name = self._get_3par_vol_name(volume['id'])
-        vlun_info = self._create_3par_vlun(volume_name, host['name'], nsp)
+        vlun_info = self._create_3par_vlun(volume_name, host['name'], nsp,
+                                           lun_id=lun_id)
         return self._get_vlun(volume_name,
                               host['name'],
                               vlun_info['lun_id'],
index 4873ca62da9148aeec7d835133620bd9a5d3a122..d7979207fd0704a562704149bdef95abf211ff9d 100644 (file)
@@ -109,10 +109,11 @@ class HPE3PARISCSIDriver(driver.TransferVD,
         3.0.6 - Adding manage/unmanage snapshot support
         3.0.7 - Optimize array ID retrieval
         3.0.8 - Update replication to version 2.1
+        3.0.9 - Use same LUN ID for each VLUN path #1551994
 
     """
 
-    VERSION = "3.0.8"
+    VERSION = "3.0.9"
 
     def __init__(self, *args, **kwargs):
         super(HPE3PARISCSIDriver, self).__init__(*args, **kwargs)
@@ -355,6 +356,7 @@ class HPE3PARISCSIDriver(driver.TransferVD,
 
                 # Cycle through each ready iSCSI port and determine if a new
                 # VLUN should be created or an existing one used.
+                lun_id = None
                 for port in ready_ports:
                     iscsi_ip = port['IPAddr']
                     if iscsi_ip in target_portal_ips:
@@ -370,7 +372,12 @@ class HPE3PARISCSIDriver(driver.TransferVD,
                                 break
                         else:
                             vlun = common.create_vlun(
-                                volume, host, iscsi_ips[iscsi_ip]['nsp'])
+                                volume, host, iscsi_ips[iscsi_ip]['nsp'],
+                                lun_id=lun_id)
+
+                            # We want to use the same LUN ID for every port
+                            if lun_id is None:
+                                lun_id = vlun['lun']
                         iscsi_ip_port = "%s:%s" % (
                             iscsi_ip, iscsi_ips[iscsi_ip]['ip_port'])
                         target_portals.append(iscsi_ip_port)