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
This commit is contained in:
Kurt Martin 2016-03-02 14:57:06 -08:00
parent f813bde3c5
commit c86b150d5f
2 changed files with 5 additions and 21 deletions

View 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

View 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.