]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Fix use of invalid variable in tgt exists check
authorJohn Griffith <john.griffith8@gmail.com>
Wed, 3 Dec 2014 17:44:49 +0000 (10:44 -0700)
committerJohn Griffith <john.griffith8@gmail.com>
Fri, 12 Dec 2014 05:36:03 +0000 (05:36 +0000)
I added a check for tgt already exists here:
https://review.openstack.org/#/c/138173/

But, that was wrong, the err value is never going to be
set because of the exception.  This should have inspected
the exception object and checked against it.

So this patch makes it do what it was supposed to do.

Change-Id: I8c184bf1684c8592a36f749cdcb5493f6b65e52b

cinder/brick/iscsi/iscsi.py

index 1ccdf47117b2988a38727d49ab16dbef4ceb2edd..c5afa617c44fd0f2b8dff7d1cd9e69b5013bd3d8 100644 (file)
@@ -254,7 +254,7 @@ class TgtAdm(TargetAdmin):
             LOG.warning(_LW("Failed to create iscsi target for volume "
                             "id:%(vol_id)s: %(e)s")
                         % {'vol_id': vol_id, 'e': e})
-            if "target already exists" in err:
+            if "target already exists" in e.stderr:
                 LOG.warning(_LW('Create iscsi target failed for '
                                 'target already exists'))
                 # NOTE(jdg):  We've run into some cases where the cmd being