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

Added ip_power control for BareMetal platform #3550

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

paulli2017
Copy link
Contributor

No description provided.

@squirrelsc
Copy link
Member

Please rebase on latest main to avoid conflict.


def on(self, port: int) -> None:
request_on = f"{self._request_cmd}{port}=1"
requests.get(request_on)
Copy link
Member

Choose a reason for hiding this comment

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

Follow the internal example to check the status, make sure it's reliable.

paull and others added 6 commits January 13, 2025 09:33
# This is the 1st commit message:

Added ip_power control for BareMetal platform

# The commit message microsoft#2 will be skipped:

# Added tftp deployment on BareMetal platform (microsoft#3422)
#
# Co-authored-by: paull <[email protected]>
@squirrelsc
Copy link
Member

If you merge from main, please use rebase.

@squirrelsc
Copy link
Member

Use git rebase -i and git add/reset -p to merge commits to make each commit meaningful.


def off(self, port: str) -> None:
request_off = f"{self._request_cmd}{port}=0"
self._set_ip_power(request_off)
Copy link
Member

Choose a reason for hiding this comment

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

How long to wait, to make sure the turn off stable?

)

def _set_ip_power(self, power_cmd: str) -> None:
try:
Copy link
Member

Choose a reason for hiding this comment

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

If there is no specific reason, don't overwrite the existing exception. The raw call trace is lost by doing this. Refer to below pattern.

        response = requests.get(power_cmd, timeout=REQUEST_TIMEOUT)
        response.raise_for_status()
        self._log.debug(f"Command {power_cmd} done in set_ip_power")

state: features.StopState = features.StopState.Shutdown,
) -> None:
request_off = f"{self._request_cmd}=0"
self._set_ip_power(request_off)
Copy link
Member

Choose a reason for hiding this comment

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

As mentioned before, please check how long is safe to make sure the power off is totally done.

return Ip9285StartStop
else:
raise NotImplementedError(
f"start_stop type {self.runbook.start_stop.type} " f"is not supported."
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
f"start_stop type {self.runbook.start_stop.type} " f"is not supported."
f"start_stop type {self.runbook.start_stop.type} is not supported."

def deploy(self, environment: Environment) -> Any:
# connect to serial console
for node in environment.nodes.list():
# start serial console to save all log
_ = node.features[features.SerialConsole]
_ = node.features[features.StartStop]
Copy link
Member

Choose a reason for hiding this comment

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

It doesn't need to follow above SerialConsole line. The SerialConsole must collect log from beginning, so I wrote previous line. The StartStop feature doesn't need to do the same.

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.

2 participants