From a5371712ce67b8e769f5fc12a3048dc5d0eef3eb Mon Sep 17 00:00:00 2001
From: Victor Rodionov <vito.ordaz@gmail.com>
Date: Tue, 8 Oct 2013 03:19:23 +0400
Subject: [PATCH] Nexenta iSCSI driver fix _lu_exists

Catch "does not exist" exception of NMS scsidisk lu_exists method.

Change-Id: I082b588dfbf54efec68a9affc76466097765b6db
Closes-Bug: #1236626
---
 cinder/volume/drivers/nexenta/volume.py | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/cinder/volume/drivers/nexenta/volume.py b/cinder/volume/drivers/nexenta/volume.py
index 219df2647..edcb63272 100644
--- a/cinder/volume/drivers/nexenta/volume.py
+++ b/cinder/volume/drivers/nexenta/volume.py
@@ -43,9 +43,15 @@ CONF.register_opts(options.NEXENTA_VOLUME_OPTIONS)
 
 
 class NexentaDriver(driver.ISCSIDriver):  # pylint: disable=R0921
-    """Executes volume driver commands on Nexenta Appliance."""
+    """Executes volume driver commands on Nexenta Appliance.
 
-    VERSION = '1.0.0'
+    Version history:
+        1.0.0 - Initial driver version.
+        1.0.1 - Fixed bug #1236626: catch "does not exist" exception of
+                lu_exists.
+    """
+
+    VERSION = '1.0.1'
 
     def __init__(self, *args, **kwargs):
         super(NexentaDriver, self).__init__(*args, **kwargs)
@@ -264,7 +270,12 @@ class NexentaDriver(driver.ISCSIDriver):  # pylint: disable=R0921
         :raises: NexentaException if zvol not exists
         :return: True if LU exists, else False
         """
-        return bool(self.nms.scsidisk.lu_exists(zvol_name))
+        try:
+            return bool(self.nms.scsidisk.lu_exists(zvol_name))
+        except nexenta.NexentaException as exc:
+            if 'does not exist' not in exc.args[0]:
+                raise
+            return False
 
     def _is_lu_shared(self, zvol_name):
         """Check if LU exists on appliance and shared.
-- 
2.45.2