From c3e856e6fc9cf33d30d8eb7cbd16095d3215cd40 Mon Sep 17 00:00:00 2001 From: Justin Bennett Date: Thu, 6 Jul 2023 17:23:17 -0400 Subject: [PATCH] Remove internal/external disk type from `PhysicalDisk` view (#3496) --- nexus/db-model/src/physical_disk.rs | 1 - nexus/db-model/src/physical_disk_kind.rs | 13 +------------ nexus/tests/integration_tests/sleds.rs | 5 +---- nexus/types/src/external_api/views.rs | 9 --------- openapi/nexus.json | 11 ----------- 5 files changed, 2 insertions(+), 37 deletions(-) diff --git a/nexus/db-model/src/physical_disk.rs b/nexus/db-model/src/physical_disk.rs index 93afdba89c..c40ebd9a9b 100644 --- a/nexus/db-model/src/physical_disk.rs +++ b/nexus/db-model/src/physical_disk.rs @@ -74,7 +74,6 @@ impl From for views::PhysicalDisk { vendor: disk.vendor, serial: disk.serial, model: disk.model, - disk_type: disk.variant.into(), } } } diff --git a/nexus/db-model/src/physical_disk_kind.rs b/nexus/db-model/src/physical_disk_kind.rs index a642f656a5..469ae4f085 100644 --- a/nexus/db-model/src/physical_disk_kind.rs +++ b/nexus/db-model/src/physical_disk_kind.rs @@ -3,7 +3,7 @@ // file, You can obtain one at https://mozilla.org/MPL/2.0/. use super::impl_enum_type; -use nexus_types::{external_api::views, internal_api}; +use nexus_types::internal_api; use serde::{Deserialize, Serialize}; impl_enum_type!( @@ -28,14 +28,3 @@ impl From for PhysicalDiskKind { } } } - -impl From for views::PhysicalDiskType { - fn from(kind: PhysicalDiskKind) -> Self { - use views::PhysicalDiskType as api; - use PhysicalDiskKind as db; - match kind { - db::M2 => api::Internal, - db::U2 => api::External, - } - } -} diff --git a/nexus/tests/integration_tests/sleds.rs b/nexus/tests/integration_tests/sleds.rs index de585b7b2d..4692d2aeb2 100644 --- a/nexus/tests/integration_tests/sleds.rs +++ b/nexus/tests/integration_tests/sleds.rs @@ -17,9 +17,7 @@ use nexus_test_utils::start_sled_agent; use nexus_test_utils::SLED_AGENT_UUID; use nexus_test_utils_macros::nexus_test; use omicron_nexus::external_api::views::SledInstance; -use omicron_nexus::external_api::views::{ - PhysicalDisk, PhysicalDiskType, Sled, -}; +use omicron_nexus::external_api::views::{PhysicalDisk, Sled}; use omicron_nexus::internal_api::params as internal_params; use omicron_sled_agent::sim; use std::str::FromStr; @@ -124,7 +122,6 @@ async fn test_physical_disk_create_list_delete( assert_eq!(disks[0].vendor, "v"); assert_eq!(disks[0].serial, "s"); assert_eq!(disks[0].model, "m"); - assert_eq!(disks[0].disk_type, PhysicalDiskType::External); // Delete that disk using the internal API, observe it in the external API delete_physical_disk(&internal_client, "v", "s", "m", sled_id).await; diff --git a/nexus/types/src/external_api/views.rs b/nexus/types/src/external_api/views.rs index 2fe9450a7f..628be8c15b 100644 --- a/nexus/types/src/external_api/views.rs +++ b/nexus/types/src/external_api/views.rs @@ -325,13 +325,6 @@ pub struct Switch { // PHYSICAL DISKS -#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub enum PhysicalDiskType { - Internal, - External, -} - /// View of a Physical Disk /// /// Physical disks reside in a particular sled and are used to store both @@ -347,8 +340,6 @@ pub struct PhysicalDisk { pub vendor: String, pub serial: String, pub model: String, - - pub disk_type: PhysicalDiskType, } // SILO USERS diff --git a/openapi/nexus.json b/openapi/nexus.json index 537e5280c2..947a757dec 100644 --- a/openapi/nexus.json +++ b/openapi/nexus.json @@ -10588,9 +10588,6 @@ "description": "View of a Physical Disk\n\nPhysical disks reside in a particular sled and are used to store both Instance Disk data as well as internal metadata.", "type": "object", "properties": { - "disk_type": { - "$ref": "#/components/schemas/PhysicalDiskType" - }, "id": { "description": "unique, immutable, system-controlled identifier for each resource", "type": "string", @@ -10623,7 +10620,6 @@ } }, "required": [ - "disk_type", "id", "model", "serial", @@ -10653,13 +10649,6 @@ "items" ] }, - "PhysicalDiskType": { - "type": "string", - "enum": [ - "internal", - "external" - ] - }, "Project": { "description": "View of a Project", "type": "object",