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 smoke test for VCR replacement #872

Merged
merged 4 commits into from
Feb 27, 2025

Conversation

gjcolombo
Copy link
Contributor

Add a smoke test for Crucible VCR replacement:

  • Add a CrucibleDisk function to get a disk's current VCR.
  • Add a TestVm framework to send a VCR replacement request.
  • Fix a couple of bugs in Crucible disk setup:
    • The id field in the VCR's CrucibleOpts needs to be the same in the old and new VCRs, so use the disk ID for it instead of calling Uuid::new_v4() every time the VCR is generated.
    • When using a Blank disk source, properly account for the fact that the disk source size is given in bytes, not gibibytes.

Also add a couple of bells and whistles to allow this test to be transformed into a test of VCR replacement during VM startup:

  • Make PHD's VmSpec type a public type and amend Framework to allow tests to create a VM from a spec. This gives tests a way to access a config's Crucible disks before actually launching a VM (and sending an instance spec to Propolis).
  • Reorganize the CrucibleDisk types to wrap the disk innards in a Mutex, allowing them to be mutated through the Arc references that tests get. This will eventually be used to allow tests to override the downstairs addresses in a disk's VCRs before launching a VM that uses that disk, which will be used to test fixes for want Crucible VCR replacement to be able to proceed before a VM has fully started #841. In the meantime, use the mutex to protect the VCR generation number, which no longer needs to be an AtomicU64.

@gjcolombo gjcolombo requested review from iximeow and leftwo February 24, 2025 23:03
Copy link
Member

@hawkw hawkw left a comment

Choose a reason for hiding this comment

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

this is pretty straightforward! i had a couple teensy nitpicks.

Copy link
Member

@iximeow iximeow left a comment

Choose a reason for hiding this comment

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

+1 to Eliza's comments, plus maybe bonus wrinkle in the new test?

@gjcolombo
Copy link
Contributor Author

Thanks for the reviews! I'll rebase and merge this later today; should have a PR with a fix for #841 up shortly after.

Add a smoke test for Crucible VCR replacement:

- Add a `CrucibleDisk` function to get a disk's current VCR.
- Add a `TestVm` framework to send a VCR replacement request.
- Fix a couple of bugs in Crucible disk setup:
  - The `id` field in the VCR's `CrucibleOpts` needs to be the same in
    the old and new VCRs, so use the disk ID for it instead of
    calling `Uuid::new_v4()` every time the VCR is generated.
  - When using a `Blank` disk source, properly account for the fact
    that the disk source size is given in bytes, not gibibytes.

Also add a couple of bells and whistles to allow this test to be
transformed into a test of VCR replacement during VM startup:

- Make PHD's `VmSpec` type a public type and amend `Framework` to allow
  tests to create a VM from a spec. This gives tests a way to access
  a config's Crucible disks before actually launching a VM (and sending
  an instance spec to Propolis).
- Reorganize the `CrucibleDisk` types to wrap the disk innards in a
  `Mutex`, allowing them to be mutated through the `Arc` references that
  tests get. This will eventually be used to allow tests to override the
  downstairs addresses in a disk's VCRs before launching a VM that uses
  that disk, which will be used to test #841. In the meantime, use the
  mutex to protect the VCR generation number, which no longer needs to
  be an `AtomicU64`.
Copy link
Contributor

@leftwo leftwo left a comment

Choose a reason for hiding this comment

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

I think any questions I have are more applicable to #873, so I'll go review that now :)

@@ -310,7 +360,7 @@ impl super::DiskConfig for CrucibleDisk {
control: None,
read_only: false,
},
gen,
r#gen: self.generation,
Copy link
Contributor

Choose a reason for hiding this comment

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

This is what I wanted to see!


// Create a blank data disk on which to perform VCR replacement. This is
// necessary because Crucible doesn't permit VCR replacements for volumes
// whose read-only parents are local files (which is true for artifact-based
Copy link
Contributor

Choose a reason for hiding this comment

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

We should update that. Crucible does support replacement of read only parents now, so perhaps we need to update the file based backend?

Though, testing on a data disk is also needed, so not like this is bad or wrong.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We're tracking this with oxidecomputer/crucible#1658.

@gjcolombo gjcolombo merged commit 42b8735 into master Feb 27, 2025
11 checks passed
@gjcolombo gjcolombo deleted the gjcolombo/phd-vcr-smoke-test branch February 27, 2025 00:18
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.

4 participants