Skip to content

Commit 0c7a689

Browse files
committed
PR feedback & comment cleanup
1 parent d0e3eb5 commit 0c7a689

File tree

3 files changed

+28
-11
lines changed

3 files changed

+28
-11
lines changed

bin/propolis-server/src/lib/vm/objects.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ impl VmObjectsLocked {
267267
// that all devices resume before any vCPUs do.
268268
self.resume_kernel_vm();
269269
self.resume_devices();
270-
self.vcpu_tasks.resume_all();
270+
self.resume_vcpus();
271271
}
272272

273273
/// Resumes this VM's vCPU tasks.
@@ -276,7 +276,7 @@ impl VmObjectsLocked {
276276
/// needs fine-grained control over the order in which devices and vCPUs
277277
/// start. When pausing and resuming a VM that's already been started, use
278278
/// [`Self::pause`] and [`Self::resume`] instead.
279-
pub(crate) async fn resume_vcpus(&mut self) {
279+
pub(crate) fn resume_vcpus(&mut self) {
280280
self.vcpu_tasks.resume_all();
281281
}
282282

@@ -310,7 +310,7 @@ impl VmObjectsLocked {
310310
// Resume devices so they're ready to do more work, then resume
311311
// vCPUs.
312312
self.resume_devices();
313-
self.vcpu_tasks.resume_all();
313+
self.resume_vcpus();
314314
}
315315

316316
/// Pauses all of a VM's devices.

bin/propolis-server/src/lib/vm/state_driver.rs

+12-7
Original file line numberDiff line numberDiff line change
@@ -536,11 +536,12 @@ impl StateDriver {
536536

537537
// The start sequence is arranged so that calls to block backends can be
538538
// interleaved with processing of requests from the external request
539-
// queue. This allows Nexus to reconfigure Crucible volumes while they
540-
// are being activated, which is necessary to unwedge activations that
541-
// are targeting a downstairs that became invalid between the time Nexus
542-
// passed its address to a VM and the time the VM actually tried to
543-
// connect to it.
539+
// queue. This allows Nexus to reconfigure Crucible backends while they
540+
// are being activated, which can be necessary if the VM's original
541+
// specification specifies a Crucible downstairs server that is offline
542+
// or unavailable. (Downstairs instances can disappear at any time,
543+
// e.g. due to sled failure, so these configurations aren't necessarily
544+
// client errors.)
544545
//
545546
// Before getting into any of that, handle the synchronous portions of
546547
// VM startup. First, ensure that the kernel VM and all its associated
@@ -584,7 +585,11 @@ impl StateDriver {
584585
info!(log, "starting block backend {}", name);
585586
let res = backend.start().await;
586587
if let Err(e) = &res {
587-
error!(log, "startup failed for {}: {:?}", name, e);
588+
error!(
589+
log,
590+
"startup failed for block backend {}: {:?}", name, e
591+
);
592+
588593
return res;
589594
}
590595
}
@@ -614,7 +619,7 @@ impl StateDriver {
614619
res = &mut block_backend_fut => {
615620
if res.is_ok() {
616621
let objects = &self.objects;
617-
objects.lock_exclusive().await.resume_vcpus().await;
622+
objects.lock_exclusive().await.resume_vcpus();
618623
self.publish_steady_state(InstanceState::Running);
619624
info!(&self.log, "VM successfully started");
620625
}

phd-tests/tests/src/crucible/smoke.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,16 @@ async fn vcr_replace_during_start_test(ctx: &Framework) {
108108
5,
109109
);
110110

111+
// Configure the disk so that when the VM starts, it will have an invalid
112+
// downstairs address.
111113
let spec = config.vm_spec(ctx).await?;
112114
let disk_hdl =
113115
spec.get_disk_by_device_name(DATA_DISK_NAME).cloned().unwrap();
114116
let disk = disk_hdl.as_crucible().unwrap();
115117
disk.enable_vcr_black_hole();
116118

119+
// Try to start the VM, but don't wait for it to boot; it should get stuck
120+
// while activating using an invalid downstairs address.
117121
let mut vm = ctx.spawn_vm_with_spec(spec, None).await?;
118122
vm.launch().await?;
119123

@@ -125,9 +129,17 @@ async fn vcr_replace_during_start_test(ctx: &Framework) {
125129
.await
126130
.unwrap_err();
127131

132+
// Fix the disk's downstairs address and send a replacement request. This
133+
// should be processed and should allow the VM to boot.
128134
disk.disable_vcr_black_hole();
129135
disk.set_generation(2);
130136
vm.replace_crucible_vcr(disk).await?;
131-
132137
vm.wait_to_boot().await?;
138+
139+
assert_eq!(vm.get().await?.instance.state, InstanceState::Running);
140+
141+
// VCR replacements should continue to be accepted now that the instance is
142+
// running.
143+
disk.set_generation(3);
144+
vm.replace_crucible_vcr(disk).await?;
133145
}

0 commit comments

Comments
 (0)