From 31b938eae00d5a023bff14567a290eb27de441f9 Mon Sep 17 00:00:00 2001 From: Rushi Agrawal Date: Fri, 1 Feb 2013 23:46:58 +0530 Subject: [PATCH] Fix inability to delete volumes in error state for NetApp driver While using NetApp 7-mode storage box to create volumes, if the volume is not created on the storage box (possibly due to wrong/missing options in cinder.conf file), the volume goes in error state, and when one tries to delete the volume, an exception was raised which made the volume go in error_deleting state, which is unrecoverable. This commit quiesces that exception, resulting in successful removal of the volume entry from the volume table. Fixes bug 1090167 Change-Id: I0a25b71ad03e7f7acf58df3952e074ff164b82ff --- cinder/tests/test_netapp.py | 3 +++ cinder/volume/drivers/netapp.py | 10 ++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/cinder/tests/test_netapp.py b/cinder/tests/test_netapp.py index 72ba362f7..5375924b4 100644 --- a/cinder/tests/test_netapp.py +++ b/cinder/tests/test_netapp.py @@ -992,6 +992,9 @@ class NetAppDriverTestCase(test.TestCase): self.VOLUME_TYPE, self.VOLUME_SIZE) self.driver._remove_destroy(self.VOLUME_NAME, self.PROJECT_ID) + def test_destroy_uncreated_volume(self): + self.driver._remove_destroy('fake-nonexistent-volume', self.PROJECT_ID) + def test_map_unmap(self): self.driver._discover_luns() self.driver._provision(self.VOLUME_NAME, None, self.PROJECT_ID, diff --git a/cinder/volume/drivers/netapp.py b/cinder/volume/drivers/netapp.py index d3d1316a3..34ecae14a 100644 --- a/cinder/volume/drivers/netapp.py +++ b/cinder/volume/drivers/netapp.py @@ -436,8 +436,14 @@ class NetAppISCSIDriver(driver.ISCSIDriver): Remove the LUN from the dataset and destroy the actual LUN and Qtree on the storage system. """ - lun = self._lookup_lun_for_volume(name, project) - lun_details = self._get_lun_details(lun.id) + try: + lun = self._lookup_lun_for_volume(name, project) + lun_details = self._get_lun_details(lun.id) + except exception.VolumeBackendAPIException: + msg = _("No entry in LUN table for volume %(name)s.") + LOG.debug(msg % locals()) + return + member = self.client.factory.create('DatasetMemberParameter') member.ObjectNameOrId = lun.id members = self.client.factory.create('ArrayOfDatasetMemberParameter') -- 2.45.2