Fix use of invalid variable in tgt exists check

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
This commit is contained in:
John Griffith 2014-12-03 10:44:49 -07:00
parent 2f3384c0a5
commit 22abe90815

View 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