Skip to content

Commit 8c0fe92

Browse files
Ashwin SrinivasanStaphylo
authored andcommitted
api: use the newer Storage class definition
The SsdUtil platform API is being refactored and now uses new endpoints. This change uses these new import paths while keeping backward compatibility for a bit. The code of the sonic_ssd should be revisited once all the storage features have merged upstream. Change-Id: Id296c188ba596cff23c7f93de85ad5db11b8f9eb
1 parent af03fbd commit 8c0fe92

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

arista/utils/sonic_ssd.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,15 @@
22
import os
33

44
# pylint: disable=import-error
5-
from sonic_platform_base.sonic_ssd.ssd_base import SsdBase
6-
from sonic_platform_base.sonic_ssd.ssd_generic import SsdUtil as SsdUtilDefault
7-
8-
class EmmcUtil(SsdBase):
5+
try:
6+
from sonic_platform_base.sonic_storage.storage_base import StorageBase
7+
from sonic_platform_base.sonic_storage.ssd import SsdUtil as SsdUtilDefault
8+
except ImportError:
9+
# fallback to the old imports if the new ones can't be found
10+
from sonic_platform_base.sonic_ssd.ssd_base import SsdBase as StorageBase
11+
from sonic_platform_base.sonic_ssd.ssd_generic import SsdUtil as SsdUtilDefault
12+
13+
class EmmcUtil(StorageBase):
914
def __init__(self, diskdev):
1015
self.diskdev = diskdev
1116
self.path = os.path.join('/sys/block', os.path.basename(diskdev))

0 commit comments

Comments
 (0)