Skip to content

Commit

Permalink
don't depend on Propolis "disk attachment states" anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
gjcolombo committed Oct 30, 2024
1 parent 0749318 commit 8f8ba2a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 19 deletions.
11 changes: 2 additions & 9 deletions sled-agent/src/common/disk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use chrono::Utc;
use omicron_common::api::external::DiskState;
use omicron_common::api::external::Error;
use omicron_common::api::internal::nexus::DiskRuntimeState;
use propolis_client::types::DiskAttachmentState as PropolisDiskState;
use sled_agent_types::disk::DiskStateRequested;
use uuid::Uuid;

Expand Down Expand Up @@ -47,15 +46,9 @@ impl DiskStates {
/// Propolis.
pub fn observe_transition(
&mut self,
observed: &PropolisDiskState,
observed: &DiskState,
) -> Option<Action> {
let next = match observed {
PropolisDiskState::Attached(uuid) => DiskState::Attached(*uuid),
PropolisDiskState::Detached => DiskState::Detached,
PropolisDiskState::Destroyed => DiskState::Destroyed,
PropolisDiskState::Faulted => DiskState::Faulted,
};
self.transition(next, None);
self.transition(observed.clone(), None);
None
}

Expand Down
14 changes: 4 additions & 10 deletions sled-agent/src/sim/disk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ use omicron_common::api::internal::nexus::ProducerEndpoint;
use omicron_common::api::internal::nexus::ProducerKind;
use oximeter_producer::LogConfig;
use oximeter_producer::Server as ProducerServer;
use propolis_client::types::DiskAttachmentState as PropolisDiskState;
use sled_agent_types::disk::DiskStateRequested;
use std::net::{Ipv6Addr, SocketAddr};
use std::sync::Arc;
Expand Down Expand Up @@ -222,18 +221,13 @@ impl Simulatable for SimDisk {

fn execute_desired_transition(&mut self) -> Option<DiskAction> {
if let Some(desired) = self.state.desired() {
// These operations would typically be triggered via responses from
// Propolis, but for a simulated sled agent, this does not exist.
//
// Instead, we make transitions to new states based entirely on the
// value of "desired".
let observed = match desired {
DiskStateRequested::Attached(uuid) => {
PropolisDiskState::Attached(*uuid)
DiskState::Attached(*uuid)
}
DiskStateRequested::Detached => PropolisDiskState::Detached,
DiskStateRequested::Destroyed => PropolisDiskState::Destroyed,
DiskStateRequested::Faulted => PropolisDiskState::Faulted,
DiskStateRequested::Detached => DiskState::Detached,
DiskStateRequested::Destroyed => DiskState::Destroyed,
DiskStateRequested::Faulted => DiskState::Faulted,
};
self.state.observe_transition(&observed)
} else {
Expand Down

0 comments on commit 8f8ba2a

Please sign in to comment.