-
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: add smoke test for VCR replacement #872
Conversation
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.
this is pretty straightforward! i had a couple teensy nitpicks.
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.
+1 to Eliza's comments, plus maybe bonus wrinkle in the new test?
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`.
1f04b2f
to
ca88843
Compare
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.
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, |
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.
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 |
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.
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.
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.
We're tracking this with oxidecomputer/crucible#1658.
Add a smoke test for Crucible VCR replacement:
CrucibleDisk
function to get a disk's current VCR.TestVm
framework to send a VCR replacement request.id
field in the VCR'sCrucibleOpts
needs to be the same in the old and new VCRs, so use the disk ID for it instead of callingUuid::new_v4()
every time the VCR is generated.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:
VmSpec
type a public type and amendFramework
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).CrucibleDisk
types to wrap the disk innards in aMutex
, allowing them to be mutated through theArc
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 anAtomicU64
.