From: Kurt Martin Date: Fri, 20 Feb 2015 17:19:03 +0000 (-0800) Subject: Fixed 3PAR driver load balancing during migration X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=72957abe4098abd969dfa775eb5dc6409cde3349;p=openstack-build%2Fcinder-build.git Fixed 3PAR driver load balancing during migration 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 --- diff --git a/cinder/tests/test_hp3par.py b/cinder/tests/test_hp3par.py index 45246f4c1..848bceb00 100644 --- a/cinder/tests/test_hp3par.py +++ b/cinder/tests/test_hp3par.py @@ -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, diff --git a/cinder/volume/drivers/san/hp/hp_3par_iscsi.py b/cinder/volume/drivers/san/hp/hp_3par_iscsi.py index 71aebe250..374316340 100644 --- a/cinder/volume/drivers/san/hp/hp_3par_iscsi.py +++ b/cinder/volume/drivers/san/hp/hp_3par_iscsi.py @@ -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)