Skip to content

Commit

Permalink
[π˜€π—½π—Ώ] initial version
Browse files Browse the repository at this point in the history
Created using spr 1.3.5
  • Loading branch information
sunshowers committed Dec 4, 2023
1 parent 15115a4 commit dc26fa6
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 29 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 4 additions & 9 deletions nexus/db-model/src/sled_provision_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,14 @@ impl From<SledProvisionState> for views::SledProvisionState {
}
}

impl TryFrom<views::SledProvisionState> for SledProvisionState {
type Error = UnknownSledProvisionState;

fn try_from(state: views::SledProvisionState) -> Result<Self, Self::Error> {
impl From<views::SledProvisionState> for SledProvisionState {
fn from(state: views::SledProvisionState) -> Self {
match state {
views::SledProvisionState::Provisionable => {
Ok(SledProvisionState::Provisionable)
SledProvisionState::Provisionable
}
views::SledProvisionState::NonProvisionable => {
Ok(SledProvisionState::NonProvisionable)
}
views::SledProvisionState::Unknown => {
Err(UnknownSledProvisionState)
SledProvisionState::NonProvisionable
}
}
}
Expand Down
5 changes: 1 addition & 4 deletions nexus/src/external_api/http_entrypoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4504,10 +4504,7 @@ async fn sled_set_provision_state(

let opctx = crate::context::op_context_for_external_api(&rqctx).await?;
// Convert the external `SledProvisionState` into our internal data model.
let new_state =
db::model::SledProvisionState::try_from(provision_state).map_err(
|error| HttpError::for_bad_request(None, format!("{error}")),
)?;
let new_state = db::model::SledProvisionState::from(provision_state);

let sled_lookup = nexus.sled_lookup(&opctx, &path.sled_id)?;

Expand Down
1 change: 0 additions & 1 deletion nexus/types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ parse-display.workspace = true
schemars = { workspace = true, features = ["chrono", "uuid1"] }
serde.workspace = true
serde_json.workspace = true
serde_with.workspace = true
steno.workspace = true
strum.workspace = true
uuid.workspace = true
Expand Down
7 changes: 0 additions & 7 deletions nexus/types/src/external_api/views.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ use omicron_common::api::external::{
};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use serde_with::rust::deserialize_ignore_any;
use std::collections::BTreeMap;
use std::collections::BTreeSet;
use std::net::IpAddr;
Expand Down Expand Up @@ -311,12 +310,6 @@ pub enum SledProvisionState {
/// resources will continue to be on this sled unless manually migrated
/// off.
NonProvisionable,

/// This is a state that isn't known yet.
///
/// This is defined to avoid API breakage.
#[serde(other, deserialize_with = "deserialize_ignore_any")]
Unknown,
}

/// An operator's view of an instance running on a given sled
Expand Down
7 changes: 0 additions & 7 deletions openapi/nexus.json
Original file line number Diff line number Diff line change
Expand Up @@ -13192,13 +13192,6 @@
"enum": [
"non_provisionable"
]
},
{
"description": "This is a state that isn't known yet.\n\nThis is defined to avoid API breakage.",
"type": "string",
"enum": [
"unknown"
]
}
]
},
Expand Down

0 comments on commit dc26fa6

Please sign in to comment.