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

Add execute_reboot dbus_interface #164

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vvolam
Copy link

@vvolam vvolam commented Sep 13, 2024

As part of sonic-net/sonic-gnmi#286 changes, we require dbus support for executing HALT method.

This PR adds support for execute_reboot for invoking reboot methods.

Copy link

@hdwhdw hdwhdw left a comment

Choose a reason for hiding this comment

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

Just some nits not particularly related to this PR.

tests/host_modules/systemd_service_test.py Outdated Show resolved Hide resolved
tests/host_modules/systemd_service_test.py Outdated Show resolved Hide resolved
@saiarcot895
Copy link
Contributor

Please update the tests.

@vvolam
Copy link
Author

vvolam commented Sep 19, 2024

/azpw run

@mssonicbld
Copy link

/AzurePipelines run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

if rebootmethod in REBOOTMETHOD_COLD_BOOT_VALUES:
cmd = ['/usr/local/bin/reboot']
elif rebootmethod in REBOOTMETHOD_HALT_BOOT_VALUES:
cmd = ['/usr/local/bin/reboot','-p']
Copy link
Contributor

Choose a reason for hiding this comment

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

-p

I could not find the implementation of -p in sonic repos.

Copy link
Author

Choose a reason for hiding this comment

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

@qiluo-msft, this change is upcoming in sonic-utilties which is work-in-progress. If the existing image does not have "-p", command will fail. Thank you!

from unittest import mock
from host_modules import systemd_service

class RebootMethod(Enum):
Copy link

Choose a reason for hiding this comment

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

Can you take a look at https://github.com/openconfig/gnoi/blob/8e23e5d63965c3787a5331e330b3a9450a302130/system/system.proto#L78

If you import system.pb.go that the proto generated, you will get access to this exact enum. Please don't redefine it as it might leads to conflict in the future.

host_modules/systemd_service.py Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants