From 7294fc54a4713c19b48a64138e101ca28c78d105 Mon Sep 17 00:00:00 2001 From: Ashwin Srinivasan Date: Sun, 24 Nov 2024 22:34:24 +0000 Subject: [PATCH 1/3] Enables utility to fall back to generic info if vendor specific parser fails --- sonic_platform_base/sonic_storage/ssd.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sonic_platform_base/sonic_storage/ssd.py b/sonic_platform_base/sonic_storage/ssd.py index e2daf05f9..6ae4df9c8 100644 --- a/sonic_platform_base/sonic_storage/ssd.py +++ b/sonic_platform_base/sonic_storage/ssd.py @@ -375,8 +375,10 @@ def parse_transcend_info(self): self.temperature = temp_raw.split()[-1] def fetch_vendor_ssd_info(self, diskdev, model): - self.vendor_ssd_info = self._execute_shell(self.vendor_ssd_utility[model]["utility"].format(diskdev)) - + try: + self.vendor_ssd_info = self._execute_shell(self.vendor_ssd_utility[model]["utility"].format(diskdev)) + except: + self.log.log_info("Error fetching vendor info. Falling back to generic info.") def parse_vendor_ssd_info(self, model): self.vendor_ssd_utility[model]["parser"]() From 5147ad008eeaa860f98cd5ba62ef3ad6db3fd49f Mon Sep 17 00:00:00 2001 From: Ashwin Srinivasan Date: Sun, 24 Nov 2024 22:43:04 +0000 Subject: [PATCH 2/3] Added blank line after function end --- sonic_platform_base/sonic_storage/ssd.py | 1 + 1 file changed, 1 insertion(+) diff --git a/sonic_platform_base/sonic_storage/ssd.py b/sonic_platform_base/sonic_storage/ssd.py index 6ae4df9c8..f9bb4d698 100644 --- a/sonic_platform_base/sonic_storage/ssd.py +++ b/sonic_platform_base/sonic_storage/ssd.py @@ -379,6 +379,7 @@ def fetch_vendor_ssd_info(self, diskdev, model): self.vendor_ssd_info = self._execute_shell(self.vendor_ssd_utility[model]["utility"].format(diskdev)) except: self.log.log_info("Error fetching vendor info. Falling back to generic info.") + def parse_vendor_ssd_info(self, model): self.vendor_ssd_utility[model]["parser"]() From 9bcb0b94288445ff90afc75b503781a828b10c1c Mon Sep 17 00:00:00 2001 From: Ashwin Srinivasan Date: Mon, 25 Nov 2024 00:33:07 +0000 Subject: [PATCH 3/3] Changed per review --- sonic_platform_base/sonic_storage/ssd.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/sonic_platform_base/sonic_storage/ssd.py b/sonic_platform_base/sonic_storage/ssd.py index f9bb4d698..013585614 100644 --- a/sonic_platform_base/sonic_storage/ssd.py +++ b/sonic_platform_base/sonic_storage/ssd.py @@ -105,9 +105,8 @@ def fetch_parse_info(self, diskdev): if self.model: vendor = self._parse_vendor() if vendor: - - self.fetch_vendor_ssd_info(diskdev, vendor) try: + self.fetch_vendor_ssd_info(diskdev, vendor) self.parse_vendor_ssd_info(vendor) except Exception as ex: self.log.log_error("{}".format(str(ex))) @@ -375,10 +374,7 @@ def parse_transcend_info(self): self.temperature = temp_raw.split()[-1] def fetch_vendor_ssd_info(self, diskdev, model): - try: - self.vendor_ssd_info = self._execute_shell(self.vendor_ssd_utility[model]["utility"].format(diskdev)) - except: - self.log.log_info("Error fetching vendor info. Falling back to generic info.") + self.vendor_ssd_info = self._execute_shell(self.vendor_ssd_utility[model]["utility"].format(diskdev)) def parse_vendor_ssd_info(self, model): self.vendor_ssd_utility[model]["parser"]()