Skip to content

Commit

Permalink
Remove internal/external disk type from PhysicalDisk view (#3496)
Browse files Browse the repository at this point in the history
  • Loading branch information
zephraph authored Jul 6, 2023
1 parent 3ffbcf1 commit c3e856e
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 37 deletions.
1 change: 0 additions & 1 deletion nexus/db-model/src/physical_disk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ impl From<PhysicalDisk> for views::PhysicalDisk {
vendor: disk.vendor,
serial: disk.serial,
model: disk.model,
disk_type: disk.variant.into(),
}
}
}
Expand Down
13 changes: 1 addition & 12 deletions nexus/db-model/src/physical_disk_kind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand All @@ -28,14 +28,3 @@ impl From<internal_api::params::PhysicalDiskKind> for PhysicalDiskKind {
}
}
}

impl From<PhysicalDiskKind> 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,
}
}
}
5 changes: 1 addition & 4 deletions nexus/tests/integration_tests/sleds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
9 changes: 0 additions & 9 deletions nexus/types/src/external_api/views.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -347,8 +340,6 @@ pub struct PhysicalDisk {
pub vendor: String,
pub serial: String,
pub model: String,

pub disk_type: PhysicalDiskType,
}

// SILO USERS
Expand Down
11 changes: 0 additions & 11 deletions openapi/nexus.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -10623,7 +10620,6 @@
}
},
"required": [
"disk_type",
"id",
"model",
"serial",
Expand Down Expand Up @@ -10653,13 +10649,6 @@
"items"
]
},
"PhysicalDiskType": {
"type": "string",
"enum": [
"internal",
"external"
]
},
"Project": {
"description": "View of a Project",
"type": "object",
Expand Down

0 comments on commit c3e856e

Please sign in to comment.