From d595d344016719eab810628a62bd276b9e98ea91 Mon Sep 17 00:00:00 2001 From: Navneet Singh Date: Sat, 16 Feb 2013 02:30:26 -0800 Subject: [PATCH] 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 --- cinder/volume/drivers/netapp/iscsi.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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'], -- 2.45.2