]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Fix inability to delete volumes in error state for NetApp driver
authorRushi Agrawal <rushi.agr@gmail.com>
Fri, 1 Feb 2013 18:16:58 +0000 (23:46 +0530)
committerRushi Agrawal <rushi.agr@gmail.com>
Tue, 5 Feb 2013 11:09:18 +0000 (16:39 +0530)
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
cinder/volume/drivers/netapp.py

index 72ba362f782b2cc13b2affb3123d60a51b653c15..5375924b4d665374a2289f5352f61c36429d8396 100644 (file)
@@ -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,
index d3d1316a3844bd8ed9821cff27bc104a8e7bc688..34ecae14a015494d8a751902921ccc4e7c4a36ce 100644 (file)
@@ -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')