From: John Griffith Date: Wed, 3 Dec 2014 17:44:49 +0000 (-0700) Subject: Fix use of invalid variable in tgt exists check X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=22abe9081543bde315f39438e56eb7ce8c30c223;p=openstack-build%2Fcinder-build.git 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 --- diff --git a/cinder/brick/iscsi/iscsi.py b/cinder/brick/iscsi/iscsi.py index 1ccdf4711..c5afa617c 100644 --- a/cinder/brick/iscsi/iscsi.py +++ b/cinder/brick/iscsi/iscsi.py @@ -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