]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
NetApp: Fix for snapshot not deleted in error state.
authorNavneet Singh <singn@netapp.com>
Sat, 16 Feb 2013 10:30:26 +0000 (02:30 -0800)
committerNavneet Singh <singn@netapp.com>
Sat, 16 Feb 2013 10:39:47 +0000 (02:39 -0800)
This fix enables cleaning of volumes/snapshots
in error state by allowing them to delete.
It will allow the delete call to be
successful if snapshot/volume are in
error state. This also fixes the bug
raised recently with  number 1145409 which seems
to be duplicate of 1143661.

bug 1143661
bug 1145409

Change-Id: I38bc13e676404f96db54b12edfa56680489e893e

cinder/volume/drivers/netapp/iscsi.py

index ec6898e322096c0935f935af12b80df718561a07..6ca53cf6645ef540e8a742b60d0409861f1dfd7a 100644 (file)
@@ -1244,6 +1244,10 @@ class NetAppCmodeISCSIDriver(driver.ISCSIDriver):
         """Driver entry point for destroying existing volumes."""
         name = volume['name']
         handle = self._get_lun_handle(name)
+        if not handle:
+            msg = _("No entry in LUN table for volume %(name)s.")
+            LOG.warn(msg % locals())
+            return
         self.client.service.DestroyLun(Handle=handle)
         LOG.debug(_("Destroyed LUN %s") % handle)
         self.lun_table.pop(name)
@@ -1353,7 +1357,12 @@ class NetAppCmodeISCSIDriver(driver.ISCSIDriver):
 
     def delete_snapshot(self, snapshot):
         """Driver entry point for deleting a snapshot."""
-        handle = self._get_lun_handle(snapshot['name'])
+        name = snapshot['name']
+        handle = self._get_lun_handle(name)
+        if not handle:
+            msg = _("No entry in LUN table for snapshot %(name)s.")
+            LOG.warn(msg % locals())
+            return
         self.client.service.DestroyLun(Handle=handle)
         LOG.debug(_("Destroyed LUN %s") % handle)
         self.lun_table.pop(snapshot['name'])
@@ -1571,6 +1580,10 @@ class NetAppDirectISCSIDriver(driver.ISCSIDriver):
         """Driver entry point for destroying existing volumes."""
         name = volume['name']
         metadata = self._get_lun_attr(name, 'metadata')
+        if not metadata:
+            msg = _("No entry in LUN table for volume/snapshot %(name)s.")
+            LOG.warn(msg % locals())
+            return
         lun_destroy = NaElement.create_node_with_children(
             'lun-destroy',
             **{'path': metadata['Path'],