From: Navneet Singh Date: Sat, 16 Feb 2013 10:30:26 +0000 (-0800) Subject: NetApp: Fix for snapshot not deleted in error state. X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=d595d344016719eab810628a62bd276b9e98ea91;p=openstack-build%2Fcinder-build.git NetApp: Fix for snapshot not deleted in error state. 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 --- diff --git a/cinder/volume/drivers/netapp/iscsi.py b/cinder/volume/drivers/netapp/iscsi.py index ec6898e32..6ca53cf66 100644 --- a/cinder/volume/drivers/netapp/iscsi.py +++ b/cinder/volume/drivers/netapp/iscsi.py @@ -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'],