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

PHD: add guest adapter for WS2022 #607

Merged
merged 4 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions phd-tests/framework/src/guest_os/windows_server_2022.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,24 @@

use super::{CommandSequence, CommandSequenceEntry, GuestOs};

/// Provides a guest OS adapter for Windows Server 2022 images. This adapter
/// assumes the following:
///
/// - The image has been generalized (by running `sysprep /generalize`) and is
/// configured so that on first boot it will skip the out-of-box experience
/// (OOBE) and initialize the local administrator account with the appropriate
/// password. See [MSDN's Windows Setup
/// documentation](https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/generalize?view=windows-11)
/// for more details.
Comment on lines +15 to +20
Copy link
Member

Choose a reason for hiding this comment

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

this is lovely, thank you for expanding on it!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My pleasure! One additional detail here (I mentioned this in DMs, but adding here as well for posterity) is that the (WIP) Windows image builder currently generates generalized images (so that we don't have to worry about any specialization conflicts if they're used as the read-only base images for multiple VMs), and I leveraged that here to create the test image I used to test this adapter. It might be possible to create an image that's technically been specialized already (so that Setup doesn't have to run and we don't have to wait for this reboot) but can still be reused across multiple VMs, but I'd have to do some research to figure out how.

/// - Cygwin is installed to C:\cygwin and can be launched by invoking
/// C:\cygwin\cygwin.bat.
pub(super) struct WindowsServer2022;

impl GuestOs for WindowsServer2022 {
fn get_login_sequence(&self) -> CommandSequence {
CommandSequence(vec![
// The image is generalized and needs to be specialized. Let it boot
// once, then wait for it to boot again and only then start waiting
// for the command prompt to become available.
// Assume the image will need to reboot one last time after being
// specialized.
CommandSequenceEntry::WaitFor(
"Computer is booting, SAC started and initialized.",
),
Expand Down
2 changes: 1 addition & 1 deletion phd-tests/framework/src/test_vm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ impl TestVm {
async fn send_serial_str_async(&self, string: &str) -> Result<()> {
let mut bytes = Vec::new();
bytes.extend_from_slice(string.as_bytes());
bytes.extend_from_slice(&[b'\n']);
bytes.push(b'\n');
self.send_serial_bytes_async(bytes).await
}

Expand Down
Loading