Skip to content

Commit

Permalink
Log iSCSI target output on error.
Browse files Browse the repository at this point in the history
Add the command output on error to aid in debugging.

Change-Id: Ib505eaeba7f1ca0e54e99dec8ebbbf71df3e5a51
Fixes: bug 1186991
  • Loading branch information
avishay-traeger committed Jun 4, 2013
1 parent a003e4a commit f7730d3
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions cinder/brick/iscsi/iscsi.py
Expand Up @@ -167,9 +167,10 @@ def create_iscsi_target(self, name, tid, lun, path,
'--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)
Expand Down Expand Up @@ -205,9 +206,10 @@ def remove_iscsi_target(self, tid, lun, vol_id, **kwargs):
'--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)
Expand Down Expand Up @@ -259,10 +261,11 @@ def create_iscsi_target(self, name, tid, lun, path,
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

Expand Down

0 comments on commit f7730d3

Please sign in to comment.