Skip to content

Commit

Permalink
[pcieutil] Remove the warning message and change the config file loca…
Browse files Browse the repository at this point in the history
…tion (sonic-net#1362)

- What I did
Fixes sonic-net#6437

- How I did it
Changed the configuration file path from plugin to platform directory

- How to verify it
Verify on the device
  • Loading branch information
sujinmkang committed Feb 9, 2021
1 parent 794cdd3 commit e48eb55
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions pcieutil/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

# Global platform-specific psuutil class instance
platform_pcieutil = None
platform_plugins_path = None
platform_path = None

log = logger.Logger(SYSLOG_IDENTIFIER)

Expand All @@ -46,22 +46,16 @@ def print_result(name, result):

def load_platform_pcieutil():
global platform_pcieutil
global platform_plugins_path
global platform_path

# Load platform module from source
try:
platform_path, _ = device_info.get_paths_to_platform_and_hwsku_dirs()
platform_plugins_path = os.path.join(platform_path, "plugins")
sys.path.append(os.path.abspath(platform_plugins_path))
from pcieutil import PcieUtil
from sonic_platform_base.sonic_pcie.pcie_common import PcieUtil
platform_pcieutil = PcieUtil(platform_path)
except ImportError as e:
log.log_warning("Failed to load platform-specific PcieUtil module. Falling back to the common implementation")
try:
from sonic_platform_base.sonic_pcie.pcie_common import PcieUtil
platform_pcieutil = PcieUtil(platform_plugins_path)
except ImportError as e:
log.log_error("Failed to load default PcieUtil module. Error : {}".format(str(e)), True)
raise e
log.log_error("Failed to load default PcieUtil module. Error : {}".format(str(e)), True)
raise e


# ==================== CLI commands and groups ====================
Expand Down Expand Up @@ -298,7 +292,7 @@ def check():
def generate():
'''Generate config file with current pci device'''
platform_pcieutil.dump_conf_yaml()
click.echo("Generate config file pcie.yaml under path %s" % platform_plugins_path)
click.echo("Generated config file '{}/pcie.yaml'".format(platform_path))


if __name__ == '__main__':
Expand Down

0 comments on commit e48eb55

Please sign in to comment.