From: Kurt Martin Date: Wed, 2 Mar 2016 22:57:06 +0000 (-0800) Subject: Don't fail on clearing 3PAR object volume key X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=c86b150d5fb4bc5a238da1d84b94408c68e74a04;p=openstack-build%2Fcinder-build.git Don't fail on clearing 3PAR object volume key The 3PARs drivers write a key value pair on the 3PAR backend volumes to track the instance that the volume is exported to. However, in certain cases the key is not present and we would throw an exception and not allow the detach to continue. If the key is not present then we do not need to clear it. This patch will just log a warning that it wasn't present and continue with the detaching the volume. Change-Id: Ie19c9050d514d68ba162bcbfa95dfc6e96d5d7bb Closes-Bug: #1546392 --- diff --git a/cinder/tests/unit/test_hpe3par.py b/cinder/tests/unit/test_hpe3par.py index e2b428c33..03b963b73 100644 --- a/cinder/tests/unit/test_hpe3par.py +++ b/cinder/tests/unit/test_hpe3par.py @@ -2216,14 +2216,6 @@ class HPE3PARBaseDriver(object): mock_client.assert_has_calls(expected) - # test the exception - mock_client.removeVolumeMetaData.side_effect = Exception( - 'Custom ex') - self.assertRaises(exception.CinderException, - self.driver.detach_volume, - context.get_admin_context(), - self.volume, None) - def test_create_snapshot(self): # setup_mock_client drive with default configuration # and return the mock HTTP 3PAR client @@ -2620,13 +2612,6 @@ class HPE3PARBaseDriver(object): mock_client.assert_has_calls(expected) - # check the exception - mock_client.removeVolumeMetaData.side_effect = Exception('fake') - self.assertRaises(exception.VolumeBackendAPIException, - common.clear_volume_key_value_pair, - self.volume, - None) - def test_extend_volume(self): # setup_mock_client drive with default configuration # and return the mock HTTP 3PAR client diff --git a/cinder/volume/drivers/hpe/hpe_3par_common.py b/cinder/volume/drivers/hpe/hpe_3par_common.py index 79e1e384a..66ed9e63c 100644 --- a/cinder/volume/drivers/hpe/hpe_3par_common.py +++ b/cinder/volume/drivers/hpe/hpe_3par_common.py @@ -1,4 +1,4 @@ -# (c) Copyright 2012-2015 Hewlett Packard Enterprise Development LP +# (c) Copyright 2012-2016 Hewlett Packard Enterprise Development LP # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -229,10 +229,11 @@ class HPE3PARCommon(object): 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 + 3.0.17 - Don't fail on clearing 3PAR object volume key. bug #1546392 """ - VERSION = "3.0.16" + VERSION = "3.0.17" stats = {} @@ -2279,10 +2280,8 @@ class HPE3PARCommon(object): volume_name = self._get_3par_vol_name(volume['id']) self.client.removeVolumeMetaData(volume_name, key) except Exception as ex: - msg = _('Failure in clear_volume_key_value_pair: ' - '%s') % six.text_type(ex) - LOG.error(msg) - raise exception.VolumeBackendAPIException(data=msg) + LOG.warning(_LW('Issue occurred in clear_volume_key_value_pair: ' + '%s'), six.text_type(ex)) def attach_volume(self, volume, instance_uuid): """Save the instance UUID in the volume.