Use SensitiveStringField for BlockDeviceMapping.connection_info

bd977f400a1192d5cf7c2b52ef91615c0828813c added the SensitiveStringField
to oslo.versionedobjects. SensitiveStringField is a StringField, which
is what BlockDeviceMapping.connection_info was already using. The difference
is that a SensitiveStringField masks passwords in the 'stringify' method,
which is what's used when __repr__ is called on the object.

Since BDM.connection_info can contain credentials, and the connection_info
dict gets passed around quite a bit in the compute manager and virt drivers,
it has from time to time gotten logged without first masking passwords.

This makes the object handle masking the password so we don't have to do it
explicitly anymore.

There is no version bump on the BlockDeviceMapping object since nothing has
functionally changed.

Change-Id: I66a0b5f6834034e2fcbefc4510e3aa018edec310
Closes-Bug: #1321785
This commit is contained in:
Matt Riedemann 2016-03-05 13:40:52 -05:00
parent 5b972c62ba
commit db50aaca0a
3 changed files with 3 additions and 2 deletions

View File

@ -80,7 +80,7 @@ class BlockDeviceMapping(base.NovaPersistentObject, base.NovaObject,
'volume_size': fields.IntegerField(nullable=True),
'image_id': fields.StringField(nullable=True),
'no_device': fields.BooleanField(default=False),
'connection_info': fields.StringField(nullable=True),
'connection_info': fields.SensitiveStringField(nullable=True),
}
@staticmethod

View File

@ -43,6 +43,7 @@ IntegerField = fields.IntegerField
UUIDField = fields.UUIDField
FloatField = fields.FloatField
StringField = fields.StringField
SensitiveStringField = fields.SensitiveStringField
EnumField = fields.EnumField
DateTimeField = fields.DateTimeField
DictOfStringsField = fields.DictOfStringsField

View File

@ -1103,7 +1103,7 @@ object_data = {
'AggregateList': '1.2-fb6e19f3c3a3186b04eceb98b5dadbfa',
'BandwidthUsage': '1.2-c6e4c779c7f40f2407e3d70022e3cd1c',
'BandwidthUsageList': '1.2-5fe7475ada6fe62413cbfcc06ec70746',
'BlockDeviceMapping': '1.16-12319f6f47f740a67a88a23f7c7ee6ef',
'BlockDeviceMapping': '1.16-f0c172e902bc62f1cac05b17d7be7688',
'BlockDeviceMappingList': '1.17-1e568eecb91d06d4112db9fd656de235',
'BuildRequest': '1.0-e4ca475cabb07f73d8176f661afe8c55',
'CellMapping': '1.0-7f1a7e85a22bbb7559fc730ab658b9bd',