]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Don't fail on clearing 3PAR object volume key
authorKurt Martin <kurt.f.martin@hpe.com>
Wed, 2 Mar 2016 22:57:06 +0000 (14:57 -0800)
committerKurt Martin <kurt.f.martin@hpe.com>
Fri, 4 Mar 2016 00:07:21 +0000 (16:07 -0800)
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

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

index e2b428c338ff389475e1057f78c46c3e8a76a378..03b963b73902bf7f6e1f60ef6280287ee593d2ee 100644 (file)
@@ -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
index 79e1e384a7581ff5757153193d3d50754281915d..66ed9e63ce89be0ebe3b025eef641eba84d04711 100644 (file)
@@ -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.