Skip to content

docs: clarify graceful shutdown and reboot action completion - #712

Open
UmutAlisoglu wants to merge 1 commit into
hetznercloud:mainfrom
UmutAlisoglu:codex/document-graceful-shutdown
Open

UmutAlisoglu wants to merge 1 commit into
hetznercloud:mainfrom
UmutAlisoglu:codex/document-graceful-shutdown

Conversation

@UmutAlisoglu

Copy link
Copy Markdown

Waiting for an ACPI shutdown action can finish while the guest is still running, so immediately changing the server type can raise server_not_stopped. Add this distinction to both BoundServer and ServersClient shutdown/reboot docstrings, as requested in #495.

The server reference includes a bounded status-polling example: wait for the action, reload before checking Server.STATUS_OFF, and raise a timeout after 60 checks. It does not silently force the power off. Reboot notes distinguish sending the ACPI request from guest/service readiness.

Validation on Windows / Python 3.13.7:

  • Fresh Sphinx HTML build with -E -W: passes.
  • All 1,000 unit tests pass.
  • Executed the exact documentation example with a simulated server: immediate stop (1 check/no sleeps), delayed stop (3 checks/2 sleeps), and no stop (60 checks/59 sleeps then timeout). Verified action waiting precedes polling. No live API calls or actual sleeps.
  • All applicable repository pre-commit hooks and diff check pass.
  • Parsed source AST matches unchanged main after removing docstrings; runtime behavior is unchanged.

Refs #495; the broader helper/API design request remains open. AI assistance was used to prepare and validate the documentation. Signed off.

Signed-off-by: Umut Alisoglu <umutalisoglu@gmail.com>

@jooola jooola left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the contribution. Only a few nits.

Comment thread hcloud/servers/client.py
Comment on lines +282 to +285
The returned action finishes when the request has been sent. Waiting
for it does not guarantee that the guest operating system has rebooted
or that its services are ready. The guest may ignore ACPI requests.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
The returned action finishes when the request has been sent. Waiting
for it does not guarantee that the guest operating system has rebooted
or that its services are ready. The guest may ignore ACPI requests.
The returned action finishes when the ACPI request has been sent. Waiting
for it does not guarantee that the guest operating system has rebooted
or that its services are ready. The guest may ignore ACPI requests.

Comment thread hcloud/servers/client.py
Comment on lines +300 to +304
The returned action finishes when the request has been sent, not when
the guest operating system has stopped. After waiting for the action,
reload the server and poll its status until it is ``off`` before an
operation that requires a stopped server. The guest may ignore ACPI,
so polling should have a timeout.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
The returned action finishes when the request has been sent, not when
the guest operating system has stopped. After waiting for the action,
reload the server and poll its status until it is ``off`` before an
operation that requires a stopped server. The guest may ignore ACPI,
so polling should have a timeout.
The returned action finishes when the ACPI request has been sent, not when
the guest operating system has stopped. After waiting for the action,
reload the server and poll its status until it is ``off`` before an
operation that requires a stopped server. The guest may ignore ACPI,
so polling should have a timeout.

Comment thread hcloud/servers/client.py
Comment on lines +874 to +877
The returned action finishes when the request has been sent. Waiting
for it does not guarantee that the guest operating system has rebooted
or that its services are ready. The guest may ignore ACPI requests.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
The returned action finishes when the request has been sent. Waiting
for it does not guarantee that the guest operating system has rebooted
or that its services are ready. The guest may ignore ACPI requests.
The returned action finishes when the ACPI request has been sent. Waiting
for it does not guarantee that the guest operating system has rebooted
or that its services are ready. The guest may ignore ACPI requests.

Comment thread hcloud/servers/client.py
Comment on lines +902 to +906
The returned action finishes when the request has been sent, not when
the guest operating system has stopped. After waiting for the action,
reload the server and poll its status until it is ``off`` before an
operation that requires a stopped server. The guest may ignore ACPI,
so polling should have a timeout.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
The returned action finishes when the request has been sent, not when
the guest operating system has stopped. After waiting for the action,
reload the server and poll its status until it is ``off`` before an
operation that requires a stopped server. The guest may ignore ACPI,
so polling should have a timeout.
The returned action finishes when the ACPI request has been sent, not when
the guest operating system has stopped. After waiting for the action,
reload the server and poll its status until it is ``off`` before an
operation that requires a stopped server. The guest may ignore ACPI,
so polling should have a timeout.

@codecov

codecov Bot commented Oct 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.40%. Comparing base (62cbd25) to head (13ac0ac).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #712   +/-   ##
=======================================
  Coverage   97.40%   97.40%           
=======================================
  Files          76       76           
  Lines        4128     4128           
=======================================
  Hits         4021     4021           
  Misses        107      107           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
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