]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Fixed 3PAR driver load balancing during migration
authorKurt Martin <kurt.f.martin@hp.com>
Fri, 20 Feb 2015 17:19:03 +0000 (09:19 -0800)
committerKurt Martin <kurt.f.martin@hp.com>
Fri, 20 Feb 2015 17:19:03 +0000 (09:19 -0800)
This patch will not allow the 3PAR iSCSI driver to pick another
iSCSI IP from the hp3par_iscsi_ips list during a nova live-migration.

Nova expects that the IQN will be exactly the same as it's attaching
the volume(s) to the new host during live-migration. This conflicts
with the Cinder settings such as "hp3par_iscsi_ips" which allows for
multiple IPs for the purpose of load balancing.

Change-Id: Idee2fdf7d5bbbe8fb7bdbc3ff20622a213738aa5
Closes-bug: 1423958

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

index 45246f4c1fea8420e4d02763ebe912c1f63349e1..848bceb00a283ed1259d97e8095125e40ae3b0bb 100644 (file)
@@ -3579,6 +3579,9 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase):
             {'active': True,
              'volumeName': self.VOLUME_3PAR_NAME,
              'lun': self.TARGET_LUN, 'type': 0}]
+        mock_client.getVLUN.return_value = {
+            'lun': self.TARGET_LUN,
+            'portPos': {'node': 8, 'slot': 1, 'cardPort': 1}}
         location = ("%(volume_name)s,%(lun_id)s,%(host)s,%(nsp)s" %
                     {'volume_name': self.VOLUME_3PAR_NAME,
                      'lun_id': self.TARGET_LUN,
@@ -3599,6 +3602,7 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase):
                 mock.call.getHost(self.FAKE_HOST),
                 mock.call.queryHost(iqns=['iqn.1993-08.org.debian:01:222']),
                 mock.call.getHost(self.FAKE_HOST),
+                mock.call.getVLUN(self.VOLUME_3PAR_NAME),
                 mock.call.createVLUN(
                     self.VOLUME_3PAR_NAME,
                     auto=True,
index 71aebe250042e5b4ac2404937633ee422fc56656..3743163407e600c73d856db1f26e058effee1020 100644 (file)
@@ -80,10 +80,12 @@ class HP3PARISCSIDriver(cinder.volume.driver.ISCSIDriver):
         2.0.11 - Added missing host name during attach fix #1398206
         2.0.12 - Removed usage of host name cache #1398914
         2.0.13 - Update LOG usage to fix translations.  bug #1384312
+        2.0.14 - Do not allow a different iSCSI IP (hp3par_iscsi_ips) to be
+                 used during live-migration.  bug #1423958
 
     """
 
-    VERSION = "2.0.13"
+    VERSION = "2.0.14"
 
     def __init__(self, *args, **kwargs):
         super(HP3PARISCSIDriver, self).__init__(*args, **kwargs)
@@ -278,9 +280,26 @@ class HP3PARISCSIDriver(cinder.volume.driver.ISCSIDriver):
                 common,
                 volume,
                 connector)
-            least_used_nsp = self._get_least_used_nsp_for_host(
-                common,
-                host['name'])
+
+            least_used_nsp = None
+            try:
+                vol_name = common._get_3par_vol_name(volume['id'])
+                existing_vlun = common.client.getVLUN(vol_name)
+
+                # We override the nsp here on purpose to force the
+                # volume to be exported out the same IP as it already is.
+                # This happens during nova live-migration, we want to
+                # disable the picking of a different IP that we export
+                # the volume to, or nova complains.
+                least_used_nsp = common.build_nsp(existing_vlun['portPos'])
+            except hpexceptions.HTTPNotFound:
+                # ignore this error, as we will create the vlun later
+                pass
+
+            if not least_used_nsp:
+                least_used_nsp = self._get_least_used_nsp_for_host(
+                    common,
+                    host['name'])
 
             # now that we have a host, create the VLUN
             vlun = common.create_vlun(volume, host, least_used_nsp)