From 1bab7b69a81c33e09d730cdf35f9e2ad4b97046a Mon Sep 17 00:00:00 2001 From: Rich Hagarty Date: Fri, 23 Jan 2015 17:44:53 -0800 Subject: [PATCH] HP 3PAR modules have bad log messages Some log messages are incorrectly formatted. Specifically, those messages that take multiple variables. In this case, each variable needs to be assigned a unique placeholder. This defect was recently introduced when all log messages where updated to use "," instead of "%" (see Change-Id: I23d53d66fda47981ed8f20b618b2ced8ef6e0682), which allowed translations to be ignored if not required by current log levels. Change-Id: Ic3439ba24c61579457dee206064bed2465ae4b6b Closes-Bug: #1411370 --- .../volume/drivers/san/hp/hp_3par_common.py | 49 +++++++++++-------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/cinder/volume/drivers/san/hp/hp_3par_common.py b/cinder/volume/drivers/san/hp/hp_3par_common.py index 0ab5f809d..7355c0b80 100644 --- a/cinder/volume/drivers/san/hp/hp_3par_common.py +++ b/cinder/volume/drivers/san/hp/hp_3par_common.py @@ -1052,9 +1052,10 @@ class HP3PARCommon(object): return volume_settings def create_volume(self, volume): - LOG.debug("CREATE VOLUME (%s : %s %s)", - (volume['display_name'], volume['name'], - self._get_3par_vol_name(volume['id']))) + LOG.debug('CREATE VOLUME (%(disp_name)s: %(vol_name)s %(id)s)', + {'disp_name': volume['display_name'], + 'vol_name': volume['name'], + 'id': self._get_3par_vol_name(volume['id'])}) try: comments = {'volume_id': volume['id'], 'name': volume['name'], @@ -1270,9 +1271,9 @@ class HP3PARCommon(object): """Creates a volume from a snapshot. """ - LOG.debug("Create Volume from Snapshot\n%s\n%s", - (pprint.pformat(volume['display_name']), - pprint.pformat(snapshot['display_name']))) + LOG.debug("Create Volume from Snapshot\n%(vol_name)s\n%(ss_name)s", + {'vol_name': pprint.pformat(volume['display_name']), + 'ss_name': pprint.pformat(snapshot['display_name'])}) model_update = None if volume['size'] < snapshot['volume_size']: @@ -1392,12 +1393,13 @@ class HP3PARCommon(object): If key already exists, the value will be replaced. """ - LOG.debug("VOLUME (%s : %s %s) Updating KEY-VALUE pair: (%s : %s)", - (volume['display_name'], - volume['name'], - self._get_3par_vol_name(volume['id']), - key, - value)) + LOG.debug("VOLUME (%(disp_name)s : %(vol_name)s %(id)s) " + "Updating KEY-VALUE pair: (%(key)s : %(val)s)", + {'disp_name': volume['display_name'], + 'vol_name': volume['name'], + 'id': self._get_3par_vol_name(volume['id']), + 'key': key, + 'val': value}) try: volume_name = self._get_3par_vol_name(volume['id']) if value is None: @@ -1411,9 +1413,12 @@ class HP3PARCommon(object): def clear_volume_key_value_pair(self, volume, key): """Clears key,value pairs metadata from virtual volume.""" - LOG.debug("VOLUME (%s : %s %s) Clearing Key : %s)", - (volume['display_name'], volume['name'], - self._get_3par_vol_name(volume['id']), key)) + LOG.debug("VOLUME (%(disp_name)s : %(vol_name)s %(id)s) " + "Clearing Key : %(key)s)", + {'disp_name': volume['display_name'], + 'vol_name': volume['name'], + 'id': self._get_3par_vol_name(volume['id']), + 'key': key}) try: volume_name = self._get_3par_vol_name(volume['id']) self.client.removeVolumeMetaData(volume_name, key) @@ -1455,7 +1460,8 @@ class HP3PARCommon(object): dbg = {'id': volume['id'], 'host': host['host'], 'status': volume['status']} - LOG.debug('enter: migrate_volume: id=%(id)s, host=%(host)s.', dbg) + LOG.debug('enter: migrate_volume: id=%(id)s, host=%(host)s, ' + 'status=%(status)s.', dbg) ret = False, None @@ -1470,8 +1476,11 @@ class HP3PARCommon(object): LOG.info(_LI('3PAR driver cannot perform migration. ' 'Retype exception: %s'), e) - LOG.debug('leave: migrate_volume: id=%(id)s, host=%(host)s.', dbg) - LOG.debug('migrate_volume result: %s, %s', ret) + LOG.debug('leave: migrate_volume: id=%(id)s, host=%(host)s, ' + 'status=%(status)s.', dbg) + dbg_ret = {'supported': ret[0], 'model_update': ret[1]} + LOG.debug('migrate_volume result: %(supported)s, %(model_update)s', + dbg_ret) return ret def _convert_to_base_volume(self, volume, new_cpg=None): @@ -1554,8 +1563,8 @@ class HP3PARCommon(object): return self._get_model_update(volume['host'], cpg) def delete_snapshot(self, snapshot): - LOG.debug("Delete Snapshot id %s %s", (snapshot['id'], - pprint.pformat(snapshot))) + LOG.debug("Delete Snapshot id %(id)s %(name)s", + {'id': snapshot['id'], 'name': pprint.pformat(snapshot)}) try: snap_name = self._get_3par_snap_name(snapshot['id']) -- 2.45.2