summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjichenjc <jichenjc@cn.ibm.com>2018-04-04 13:26:01 +0800
committerLee Yarwood <lyarwood@redhat.com>2018-05-29 17:14:37 +0100
commitc17516f3999447ad0d4ec7ecd8f223f6468b693a (patch)
treee9d4c808b6919511e91de9e6c9b4fd4f98e3c1b5
parenta0bcc6bda09c5dff4bf0ba57b80ebb94f01567f0 (diff)
downloadnova-c17516f3999447ad0d4ec7ecd8f223f6468b693a.tar.gz
Avoid showing password in log
per bug indicated, the password is shown in the log. https://github.com/openstack/oslo.utils/blob/master/oslo_utils/strutils.py#L295 indicated auth_password can be masked through mask_password method. Conflicts: nova/compute/manager.py NOTE(lyarwood): Conflicts caused by Ica323b87fa85a454fca9d46ada3677f18fe50022 and Ifc01dbf98545104c998ab96f65ff8623a6db0f28 not being present in Pike. Additionally If12e7860baad2899380f06144a0270784a5466b8 was not present in Queens but landed in Pike and Ocata as a stable only change. Change-Id: I725eea1866642b40cc6b065ed0e8aefb91ca2889 Closes-Bug: 1761054 (cherry picked from commit 1b61d6c08c7c86834acab45320230824b88d529c) (cherry picked from commit df90dfd5cdf76c65b8d8a539d79e384c82c8428c) (cherry picked from commit 978066fe31a5331f143a05e1fd753c729b2dcf09)
-rw-r--r--nova/compute/manager.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py
index 6181bc3a3d..00277116f8 100644
--- a/nova/compute/manager.py
+++ b/nova/compute/manager.py
@@ -5027,16 +5027,19 @@ class ComputeManager(manager.Manager):
# currently implementing swap_volume, will modify the contents of
# new_cinfo when connect_volume is called. This is then saved to
# the BDM in swap_volume for future use outside of this flow.
- LOG.debug("swap_volume: Calling driver volume swap with "
- "connection infos: new: %(new_cinfo)s; "
- "old: %(old_cinfo)s",
- {'new_cinfo': new_cinfo, 'old_cinfo': old_cinfo},
- instance=instance)
+ msg = ("swap_volume: Calling driver volume swap with "
+ "connection infos: new: %(new_cinfo)s; "
+ "old: %(old_cinfo)s" %
+ {'new_cinfo': new_cinfo, 'old_cinfo': old_cinfo})
+ # Both new and old info might contain password
+ LOG.debug(strutils.mask_password(msg), instance=instance)
+
self.driver.swap_volume(context, old_cinfo, new_cinfo, instance,
mountpoint, resize_to)
- LOG.debug("swap_volume: Driver volume swap returned, new "
- "connection_info is now : %(new_cinfo)s",
- {'new_cinfo': new_cinfo})
+ msg = ("swap_volume: Driver volume swap returned, new "
+ "connection_info is now : %(new_cinfo)s" %
+ {'new_cinfo': new_cinfo})
+ LOG.debug(strutils.mask_password(msg))
except Exception as ex:
failed = True
with excutils.save_and_reraise_exception():