From: Eric Harney Date: Tue, 27 Jan 2015 21:59:53 +0000 (-0500) Subject: TgtAdm: Fix _recreate_backing_lun logging X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=22384060e40a4f6f0c0cf023d50f26cef1bd6f6f;p=openstack-build%2Fcinder-build.git 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 --- 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,