Skip to content

Don't return None from BlockData::block_for_req when attachment is paused#711

Merged
gjcolombo merged 4 commits into
masterfrom
gjcolombo/fix-709
Jun 14, 2024
Merged

Don't return None from BlockData::block_for_req when attachment is paused#711
gjcolombo merged 4 commits into
masterfrom
gjcolombo/fix-709

Conversation

@gjcolombo

Copy link
Copy Markdown
Contributor

Change BlockData::block_for_req so that it doesn't return early when the device/backend pair is paused. (The async block backend's request future doesn't have this issue.)

Add PHD tests for guest reboot (both in-guest and API-driven) to verify the fix; the non-Crucible variants of these tests fail without this fix and pass with them. The Crucible variants (which use the async driver) pass without issue, but it's useful to get coverage there, too.

Fix PHD's raw-buffering serial adapter so that, if a caller asks to wait for a string to appear in the buffer, the buffer properly trims its contents when the wait is satisfied. This is needed to keep the new tests from passing trivially; without the fix, the first login sequence to appear on the serial console satisfies all of the "wait for guest to boot" calls in the rest of the test.

Tests: PHD runs of Alpine and Debian 11 w/new test cases.

Fixes #709. Fixes #710.

@gjcolombo gjcolombo requested a review from pfmooney June 14, 2024 03:51
@gjcolombo

Copy link
Copy Markdown
Contributor Author

The new Clippy failures seem to be Rust 1.79-related--I only started seeing them locally after a rustup update. I'll investigate these and deal with them in a separate PR.

The failed PHD run seems to be due to an error downloading an artifact from Buildomat:

phd-runner: test phd_tests::migrate::from_base::migration_from_base_and_back ... FAILED: constructing test VM
    
    Caused by:
        0: building environment for new VM
        1: setting up VM execution environment
        2: request or response body error: error reading a body from connection: stream error received: unexpected internal error encountered
        3: error reading a body from connection: stream error received: unexpected internal error encountered
        4: stream error received: unexpected internal error encountered

    Stack backtrace:
       0: anyhow::error::<impl core::convert::From<E> for anyhow::Error>::from
                 at /home/build/.cargo/registry/src/index.crates.io-6f17d22bba15001f/anyhow-1.0.83/src/backtrace.rs:27:14
       1: <core::result::Result<T,F> as core::ops::try_trait::FromResidual<core::result::Result<core::convert::Infallible,E>>>::from_residual
                 at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/result.rs:1964:27
       2: phd_framework::artifacts::buildomat::<impl phd_framework::artifacts::DownloadConfig>::download_buildomat_uri::{{closure}}
                 at ./oxidecomputer/propolis/phd-tests/framework/src/artifacts/buildomat.rs:258:21
       3: phd_framework::artifacts::store::<impl phd_framework::artifacts::DownloadConfig>::download_buildomat_artifact::{{closure}}
                 at ./oxidecomputer/propolis/phd-tests/framework/src/artifacts/store.rs:589:72
       4: phd_framework::artifacts::store::StoredArtifact::ensure::{{closure}}
                 at ./oxidecomputer/propolis/phd-tests/framework/src/artifacts/store.rs:116:22
       5: phd_framework::artifacts::store::Store::get_propolis_server::{{closure}}
                 at ./oxidecomputer/propolis/phd-tests/framework/src/artifacts/store.rs:392:65

I've submitted this for a rerun.

@pfmooney pfmooney left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for fixing this.

Comment thread lib/propolis/src/block/attachment.rs Outdated
Comment on lines 73 to 75
match check_state(att_state) {
Err(ReqError::Stopped | ReqError::Detached) => {
return None;
}
Ok(())
| Err(ReqError::Paused | ReqError::NonePending) => {
let _guard = self.cv.wait(guard).unwrap();
continue;
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would just make the calls to is_attached() and is_stopped() here, instead of using check_state. Handling the NonePending error case is misleading, since check_state never emits it. It suggest that more is being checked than really is.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good call, I'll fix this up.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Should be fixed in 099e2be.

@gjcolombo gjcolombo force-pushed the gjcolombo/fix-709 branch from 8fb8f43 to 099e2be Compare June 14, 2024 19:03
@gjcolombo gjcolombo requested a review from pfmooney June 14, 2024 19:26
@gjcolombo gjcolombo merged commit 61e1481 into master Jun 14, 2024
@gjcolombo gjcolombo deleted the gjcolombo/fix-709 branch June 14, 2024 19:33
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.

PHD: raw buffer backend doesn't properly consume characters after matching Guest reboot got stuck at unmounting /boot/efi

2 participants