Skip to content

Commit 59b6bfc

Browse files
committed
at least make the crucible tests find backend names again
this is not ideal! but newtyping BackendName and DeviceName stretches through into propolis-api-types and is just more than i want to change here
1 parent 22b5a08 commit 59b6bfc

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

phd-tests/framework/src/test_vm/config.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ impl<'dr> VmConfig<'dr> {
273273
// name. It then derives a backend name from the disk name. Match
274274
// that name derivation here so PHD tests match the API as used by
275275
// Nexus.
276-
let backend_name = format!("{}-backend", device_name);
276+
let backend_name = device_name_to_backend_name(device_name);
277277
let device_spec = match req.interface {
278278
DiskInterface::Virtio => {
279279
StorageDeviceV0::VirtioDisk(VirtioDisk {
@@ -333,23 +333,29 @@ impl<'dr> VmConfig<'dr> {
333333
}
334334
}
335335

336+
fn device_name_to_backend_name(device_name: &str) -> String {
337+
format!("{}-backend", device_name)
338+
}
339+
336340
async fn make_disk<'req>(
337-
name: String,
341+
device_name: String,
338342
framework: &Framework,
339343
req: &DiskRequest<'req>,
340344
) -> anyhow::Result<Arc<dyn DiskConfig>> {
345+
let backend_name = device_name_to_backend_name(&device_name);
346+
341347
Ok(match req.backend {
342348
DiskBackend::File => framework
343349
.disk_factory
344-
.create_file_backed_disk(name, &req.source)
350+
.create_file_backed_disk(backend_name, &req.source)
345351
.await
346352
.with_context(|| {
347353
format!("creating new file-backed disk from {:?}", req.source,)
348354
})? as Arc<dyn DiskConfig>,
349355
DiskBackend::Crucible { min_disk_size_gib, block_size } => framework
350356
.disk_factory
351357
.create_crucible_disk(
352-
name,
358+
backend_name,
353359
&req.source,
354360
min_disk_size_gib,
355361
block_size,
@@ -364,7 +370,7 @@ async fn make_disk<'req>(
364370
as Arc<dyn DiskConfig>,
365371
DiskBackend::InMemory { readonly } => framework
366372
.disk_factory
367-
.create_in_memory_disk(name, &req.source, readonly)
373+
.create_in_memory_disk(backend_name, &req.source, readonly)
368374
.await
369375
.with_context(|| {
370376
format!("creating new in-memory disk from {:?}", req.source)

0 commit comments

Comments
 (0)