Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial version of pcied #60

Merged
merged 14 commits into from
Jul 17, 2020
Merged

Initial version of pcied #60

merged 14 commits into from
Jul 17, 2020

Conversation

sujinmkang
Copy link
Collaborator

@sujinmkang sujinmkang commented Jun 14, 2020

pcied will run in pmon container to monitor the pcie device status during run time.
It will update the state db with current pcie status so other monitoring service can read to alert any failure status.

@lgtm-com
Copy link

lgtm-com bot commented Jun 14, 2020

This pull request introduces 1 alert when merging b21b15e into c617191 - view on LGTM.com

new alerts:

  • 1 for Syntax error

@lgtm-com
Copy link

lgtm-com bot commented Jun 15, 2020

This pull request introduces 7 alerts when merging e059bb3 into c617191 - view on LGTM.com

new alerts:

  • 6 for Unused import
  • 1 for Wrong number of arguments in a call

@lgtm-com
Copy link

lgtm-com bot commented Jun 19, 2020

This pull request introduces 1 alert when merging df98786 into c617191 - view on LGTM.com

new alerts:

  • 1 for Unused import

@sujinmkang sujinmkang marked this pull request as ready for review June 19, 2020 05:45
@lgtm-com
Copy link

lgtm-com bot commented Jun 23, 2020

This pull request introduces 2 alerts when merging 5aee4c2 into c617191 - view on LGTM.com

new alerts:

  • 1 for First parameter of a method is not named 'self'
  • 1 for Unused import

@sujinmkang sujinmkang requested review from jleveque and yxieca June 28, 2020 00:43
sonic-pcied/scripts/pcied Outdated Show resolved Hide resolved
sonic-pcied/scripts/pcied Outdated Show resolved Hide resolved

tmp_pcie_status_f="/tmp/pcie_status_f"
os.system('sudo pcieutil pcie-check | grep "%s" > %s'%(PCIE_RESULT_REGIX, tmp_pcie_status_f))
f=open(tmp_pcie_status_f, "r")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of using /tmp/ file to query results. We should use STATE_DB as a place-holder.


def check_pcie_devices(self):
platform, hwsku = get_platform_and_hwsku()
pciefilePath = "/".join([PLATFORM_ROOT_PATH, platform, "plugins", PCIE_CONF_FILE])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is PCIE_CONF_FILE a plugin or a config file? If it's not a plugin I would suggest putting it under platform folder.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I'm planing to work on additional feature on sonic-pcie again. I will fix this with that.

sys.path.append(os.path.abspath(pciefilePath))
if not os.path.exists(pciefilePath):
logger.log_error("Platform pcie configuration file doesn't exist! exit pcied")
sys.exit("Platform PCIe Configuration file doesn't exist!")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest moving this check outside this function and do it before entering the loop, or it will periodically print out error msg on the platform which doesn't have this supported?

sonic-pcied/scripts/pcied Outdated Show resolved Hide resolved
sonic-pcied/scripts/pcied Outdated Show resolved Hide resolved
pcie_status = f.readline()
if "PASSED" in pcie_status:
self.update_state_db("PCIE_STATUS|", "PCIE_DEVICES", "PASSED")
logger.log_info("PCIe device status check : PASSED")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want it to be printed out each 60s?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought it's ok to indicate the pcie status every 60 seconds. Do you have any other suggestion? I was also thinking about logging only when its status changes.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO logging only on when status change is better.

@lgtm-com
Copy link

lgtm-com bot commented Jul 16, 2020

This pull request introduces 1 alert when merging e43ca20 into c530587 - view on LGTM.com

new alerts:

  • 1 for Unused import

sonic-pcied/scripts/pcied Outdated Show resolved Hide resolved
sonic-pcied/scripts/pcied Outdated Show resolved Hide resolved
sonic-pcied/scripts/pcied Show resolved Hide resolved
@sujinmkang sujinmkang merged commit e665ee8 into sonic-net:master Jul 17, 2020
self.state_db.connect("STATE_DB")

def check_pcie_devices(self):
cmd = [ 'sudo', 'pcieutil', 'pcie-check' ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pcieutil is absent in pmon container. Please view on these links: sonic-net/sonic-buildimage#5236

@sujinmkang sujinmkang deleted the pcied branch November 17, 2020 23:48
vdahiya12 pushed a commit to vdahiya12/sonic-platform-daemons that referenced this pull request Apr 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants