]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Only reverify backing lun when create backing lun
authorling-yun <zengyunling@huawei.com>
Fri, 20 Dec 2013 02:55:18 +0000 (10:55 +0800)
committerling-yun <zengyunling@huawei.com>
Fri, 20 Dec 2013 03:12:06 +0000 (11:12 +0800)
In TgtAdm, we alway do twice _verify_backing_lun whether backing lun
exists or not.
If backing lun exists, it doesn't need to call _verify_backing_lun
function again.
It only needs reverify whether backing lun exists or not when recreate
backing lun.

Change-Id: Ic11d778362540df307056a1adcba932e571b7d20
Closes-Bug: #1262958

cinder/brick/iscsi/iscsi.py

index d942e9886067d15da62a4c5175d984d5023689f3..3ea47548f04fa1f5ef5512eda57e291399fb3b3a 100644 (file)
@@ -238,10 +238,10 @@ class TgtAdm(TargetAdmin):
                 os.unlink(volume_path)
                 raise exception.ISCSITargetCreateFailed(volume_id=vol_id)
 
-        # Finally check once more and if no go, fail and punt
-        if not self._verify_backing_lun(iqn, tid):
-            os.unlink(volume_path)
-            raise exception.ISCSITargetCreateFailed(volume_id=vol_id)
+            # Finally check once more and if no go, fail and punt
+            if not self._verify_backing_lun(iqn, tid):
+                os.unlink(volume_path)
+                raise exception.ISCSITargetCreateFailed(volume_id=vol_id)
 
         if old_persist_file is not None and os.path.exists(old_persist_file):
             os.unlink(old_persist_file)