From 5103bc9214ca4301593f230150765ac9ba7e4a79 Mon Sep 17 00:00:00 2001 From: wisererik Date: Mon, 10 Aug 2020 23:15:36 +0800 Subject: [PATCH] Fix oceanstor driver issue --- delfin/drivers/huawei/oceanstor/alert_handler.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/delfin/drivers/huawei/oceanstor/alert_handler.py b/delfin/drivers/huawei/oceanstor/alert_handler.py index cb06e00a8..f8d2f2c6b 100644 --- a/delfin/drivers/huawei/oceanstor/alert_handler.py +++ b/delfin/drivers/huawei/oceanstor/alert_handler.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import binascii from datetime import datetime from oslo_log import log @@ -98,12 +97,14 @@ def parse_alert(self, context, alert): description = alert['hwIsmReportingAlarmAdditionInfo'] if self._is_hex(description): - description = binascii.unhexlify(description[2:]) + description = bytes.fromhex(description[2:]).decode('ascii') alert_model['description'] = description recovery_advice = alert['hwIsmReportingAlarmRestoreAdvice'] if self._is_hex(recovery_advice): - recovery_advice = binascii.unhexlify(recovery_advice[2:]) + recovery_advice = bytes.fromhex( + recovery_advice[2:]).decode('ascii') + alert_model['recovery_advice'] = recovery_advice alert_model['resource_type'] = constants.DEFAULT_RESOURCE_TYPE