From 59b6bfc3ecbe3c51596049c88dfba0ff7fee0f84 Mon Sep 17 00:00:00 2001 From: iximeow Date: Fri, 27 Sep 2024 23:33:07 +0000 Subject: [PATCH] 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 --- phd-tests/framework/src/test_vm/config.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/phd-tests/framework/src/test_vm/config.rs b/phd-tests/framework/src/test_vm/config.rs index 14d92fb32..2ffa98bd6 100644 --- a/phd-tests/framework/src/test_vm/config.rs +++ b/phd-tests/framework/src/test_vm/config.rs @@ -273,7 +273,7 @@ impl<'dr> VmConfig<'dr> { // name. It then derives a backend name from the disk name. Match // that name derivation here so PHD tests match the API as used by // Nexus. - let backend_name = format!("{}-backend", device_name); + let backend_name = device_name_to_backend_name(device_name); let device_spec = match req.interface { DiskInterface::Virtio => { StorageDeviceV0::VirtioDisk(VirtioDisk { @@ -333,15 +333,21 @@ impl<'dr> VmConfig<'dr> { } } +fn device_name_to_backend_name(device_name: &str) -> String { + format!("{}-backend", device_name) +} + async fn make_disk<'req>( - name: String, + device_name: String, framework: &Framework, req: &DiskRequest<'req>, ) -> anyhow::Result> { + let backend_name = device_name_to_backend_name(&device_name); + Ok(match req.backend { DiskBackend::File => framework .disk_factory - .create_file_backed_disk(name, &req.source) + .create_file_backed_disk(backend_name, &req.source) .await .with_context(|| { format!("creating new file-backed disk from {:?}", req.source,) @@ -349,7 +355,7 @@ async fn make_disk<'req>( DiskBackend::Crucible { min_disk_size_gib, block_size } => framework .disk_factory .create_crucible_disk( - name, + backend_name, &req.source, min_disk_size_gib, block_size, @@ -364,7 +370,7 @@ async fn make_disk<'req>( as Arc, DiskBackend::InMemory { readonly } => framework .disk_factory - .create_in_memory_disk(name, &req.source, readonly) + .create_in_memory_disk(backend_name, &req.source, readonly) .await .with_context(|| { format!("creating new in-memory disk from {:?}", req.source)