-
Notifications
You must be signed in to change notification settings - Fork 22
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
PHD: support guest-initiated reboot #785
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
While in many cases a procedure like "`reboot` and wait for login" is sufficient to reboot a guest, it is not sufficient for *all* cases. For Windows, the command is spelled `shutdown /r` instead. And on Debian (at least 11), `reboot` will immediately take the guest down instead of printing a new shell prompt first. So, have guest OS adapters provide commands that impel a guest to reboot, and wait for that reboot to occur (rather than the naive initial approach of reboot, wait for shell prompt, wait for login prompt, proceed). Fixes #783.
gjcolombo
approved these changes
Oct 10, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for putting this together!
iximeow
added a commit
that referenced
this pull request
Oct 19, 2024
some smoketests instigated a graceful reboot by sending `reboot\n` to the serial console, but Windows guests are rewarded (via Cygwin) with ``` bash: reboot: command not found ``` as of #785 there is now a TestVm helper `graceful_reboot` that does this in whatever way the guest adapter desires, so use that instead. unfortunately `graceful_reboot` is only mostly right for Windows guests, so fix that here too: `shutdown` immediately terminates the cmd.exe session, at which point the SAC redraws the previous screen, which happens to have all the sigils we look for to detect that Windows has freshly booted. we then log back into the imminently-shutdown Windows, shutdown takes effect, and PHD becomes fully desynchronized from the guest state. so, look for "BdsDxe: loading " as an outside-the-guest-OS sigil that tells us we're watching a fresh boot. this comes from OVMF, so a booted guest will have clobbered the message and not know to redraw it even if it seeks to recreate a previous display. other tests depend on Linux-specific features like `efivarfs` or `mount -o ro`, so skip them on non-Linux guests.
iximeow
added a commit
that referenced
this pull request
Oct 19, 2024
some smoketests instigated a graceful reboot by sending `reboot\n` to the serial console, but Windows guests are rewarded (via Cygwin) with ``` bash: reboot: command not found ``` as of #785 there is now a TestVm helper `graceful_reboot` that does this in whatever way the guest adapter desires, so use that instead. unfortunately `graceful_reboot` is only mostly right for Windows guests, so fix that here too: `shutdown` immediately terminates the cmd.exe session, at which point the SAC redraws the previous screen, which happens to have all the sigils we look for to detect that Windows has freshly booted. we then log back into the imminently-shutdown Windows, shutdown takes effect, and PHD becomes fully desynchronized from the guest state. so, look for "BdsDxe: loading " as an outside-the-guest-OS sigil that tells us we're watching a fresh boot. this comes from OVMF, so a booted guest will have clobbered the message and not know to redraw it even if it seeks to recreate a previous display. other tests depend on Linux-specific features like `efivarfs` or `mount -o ro`, so skip them on non-Linux guests.
iximeow
added a commit
that referenced
this pull request
Oct 22, 2024
some smoketests instigated a graceful reboot by sending `reboot\n` to the serial console, but Windows guests are rewarded (via Cygwin) with ``` bash: reboot: command not found ``` as of #785 there is now a TestVm helper `graceful_reboot` that does this in whatever way the guest adapter desires, so use that instead. unfortunately `graceful_reboot` is only mostly right for Windows guests, so fix that here too: `shutdown` immediately terminates the cmd.exe session, at which point the SAC redraws the previous screen, which happens to have all the sigils we look for to detect that Windows has freshly booted. we then log back into the imminently-shutdown Windows, shutdown takes effect, and PHD becomes fully desynchronized from the guest state. so, look for "BdsDxe: loading " as an outside-the-guest-OS sigil that tells us we're watching a fresh boot. this comes from OVMF, so a booted guest will have clobbered the message and not know to redraw it even if it seeks to recreate a previous display. other tests depend on Linux-specific features like `efivarfs` or `mount -o ro`, so skip them on non-Linux guests.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While in many cases a procedure like "
reboot
and wait for login" is sufficient to reboot a guest, it is not sufficient for all cases. For Windows, the command is spelledshutdown /r
instead. And on Debian (at least 11),reboot
will immediately take the guest down instead of printing a new shell prompt first.So, have guest OS adapters provide commands that impel a guest to reboot, and wait for that reboot to occur (rather than the naive initial approach of reboot, wait for shell prompt, wait for login prompt, proceed).
Fixes #783.
(since the boot order tests are pretty Linux-specific what with efivarfs, the Windows
graceful_reboot
implementations are for completeness. I don't have a good Windows guest to try running them with at the moment, even...)