From: Avishay Traeger Date: Tue, 4 Jun 2013 08:46:20 +0000 (+0300) Subject: Log iSCSI target output on error. X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=f7730d31df65ec166b2bdb6667162dc22f7d4fd6;p=openstack-build%2Fcinder-build.git Log iSCSI target output on error. Add the command output on error to aid in debugging. Change-Id: Ib505eaeba7f1ca0e54e99dec8ebbbf71df3e5a51 Fixes: bug 1186991 --- diff --git a/cinder/brick/iscsi/iscsi.py b/cinder/brick/iscsi/iscsi.py index 574869707..d09ae7ab5 100644 --- a/cinder/brick/iscsi/iscsi.py +++ b/cinder/brick/iscsi/iscsi.py @@ -167,9 +167,10 @@ class TgtAdm(TargetAdmin): '--update', name, run_as_root=True) - except exception.ProcessExecutionError, e: + except exception.ProcessExecutionError as e: LOG.error(_("Failed to create iscsi target for volume " - "id:%(vol_id)s.") % locals()) + "id:%(vol_id)s: %(e)s") + % {'vol_id': vol_id, 'e': str(e)}) #Don't forget to remove the persistent file we created os.unlink(volume_path) @@ -205,9 +206,10 @@ class TgtAdm(TargetAdmin): '--delete', iqn, run_as_root=True) - except exception.ProcessExecutionError, e: + except exception.ProcessExecutionError as e: LOG.error(_("Failed to remove iscsi target for volume " - "id:%(vol_id)s.") % locals()) + "id:%(vol_id)s: %(e)s") + % {'vol_id': vol_id, 'e': str(e)}) raise exception.ISCSITargetRemoveFailed(volume_id=vol_id) os.unlink(volume_path) @@ -259,10 +261,11 @@ class IetAdm(TargetAdmin): f = open(conf_file, 'a+') f.write(volume_conf) f.close() - except exception.ProcessExecutionError, e: + except exception.ProcessExecutionError as e: vol_id = name.split(':')[1] LOG.error(_("Failed to create iscsi target for volume " - "id:%(vol_id)s.") % locals()) + "id:%(vol_id)s: %(e)s") + % {'vol_id': vol_id, 'e': str(e)}) raise exception.ISCSITargetCreateFailed(volume_id=vol_id) return tid