From 22abe9081543bde315f39438e56eb7ce8c30c223 Mon Sep 17 00:00:00 2001 From: John Griffith Date: Wed, 3 Dec 2014 10:44:49 -0700 Subject: [PATCH] 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 --- cinder/brick/iscsi/iscsi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- 2.45.2