From 22384060e40a4f6f0c0cf023d50f26cef1bd6f6f Mon Sep 17 00:00:00 2001 From: Eric Harney Date: Tue, 27 Jan 2015 16:59:53 -0500 Subject: [PATCH] TgtAdm: Fix _recreate_backing_lun logging If the execute of tgtadm new fails, the exception thrown skips over the debugging output. Ensure the output from the command is always printed. Change-Id: I9772c0f725cd6a19d4af8acae814a046e6cfdd17 --- cinder/volume/targets/tgt.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cinder/volume/targets/tgt.py b/cinder/volume/targets/tgt.py index a0991045a..52b71bab9 100644 --- a/cinder/volume/targets/tgt.py +++ b/cinder/volume/targets/tgt.py @@ -99,19 +99,22 @@ class TgtAdm(iscsi.ISCSITarget): # how long should we wait?? I have no idea, let's go big # and error on the side of caution time.sleep(10) + + (out, err) = (None, None) try: (out, err) = utils.execute('tgtadm', '--lld', 'iscsi', '--op', 'new', '--mode', 'logicalunit', '--tid', tid, '--lun', '1', '-b', path, run_as_root=True) - LOG.debug('StdOut from recreate backing lun: %s' % out) - LOG.debug('StdErr from recreate backing lun: %s' % err) except putils.ProcessExecutionError as e: LOG.error(_LE("Failed to recover attempt to create " "iscsi backing lun for volume " "id:%(vol_id)s: %(e)s") % {'vol_id': name, 'e': e}) + finally: + LOG.debug('StdOut from recreate backing lun: %s' % out) + LOG.debug('StdErr from recreate backing lun: %s' % err) def _iscsi_location(self, ip, target, iqn, lun=None): return "%s:%s,%s %s %s" % (ip, self.configuration.iscsi_port, -- 2.45.2