Skip to content

Commit

Permalink
purge VmmState::Creating from APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkw committed Sep 1, 2024
1 parent 01bd26c commit f171767
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 38 deletions.
2 changes: 0 additions & 2 deletions clients/nexus-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ impl From<omicron_common::api::internal::nexus::VmmState> for types::VmmState {
fn from(s: omicron_common::api::internal::nexus::VmmState) -> Self {
use omicron_common::api::internal::nexus::VmmState as Input;
match s {
Input::Creating => types::VmmState::Creating,
Input::Starting => types::VmmState::Starting,
Input::Running => types::VmmState::Running,
Input::Stopping => types::VmmState::Stopping,
Expand All @@ -112,7 +111,6 @@ impl From<types::VmmState> for omicron_common::api::internal::nexus::VmmState {
fn from(s: types::VmmState) -> Self {
use omicron_common::api::internal::nexus::VmmState as Output;
match s {
types::VmmState::Creating => Output::Creating,
types::VmmState::Starting => Output::Starting,
types::VmmState::Running => Output::Running,
types::VmmState::Stopping => Output::Stopping,
Expand Down
2 changes: 0 additions & 2 deletions clients/sled-agent-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ impl From<omicron_common::api::internal::nexus::VmmState> for types::VmmState {
fn from(s: omicron_common::api::internal::nexus::VmmState) -> Self {
use omicron_common::api::internal::nexus::VmmState as Input;
match s {
Input::Creating => types::VmmState::Creating,
Input::Starting => types::VmmState::Starting,
Input::Running => types::VmmState::Running,
Input::Stopping => types::VmmState::Stopping,
Expand Down Expand Up @@ -144,7 +143,6 @@ impl From<types::VmmState> for omicron_common::api::internal::nexus::VmmState {
fn from(s: types::VmmState) -> Self {
use omicron_common::api::internal::nexus::VmmState as Output;
match s {
types::VmmState::Creating => Output::Creating,
types::VmmState::Starting => Output::Starting,
types::VmmState::Running => Output::Running,
types::VmmState::Stopping => Output::Stopping,
Expand Down
9 changes: 1 addition & 8 deletions common/src/api/external/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1064,14 +1064,7 @@ impl From<crate::api::internal::nexus::VmmState> for InstanceState {
fn from(state: crate::api::internal::nexus::VmmState) -> Self {
use crate::api::internal::nexus::VmmState as InternalVmmState;
match state {
// An instance with a VMM which is in the `Creating` state maps to
// `InstanceState::Starting`, rather than `InstanceState::Creating`.
// If we are still creating the VMM, this is because we are
// attempting to *start* the instance; instances may be created
// without creating a VMM to run them, and then started later.
InternalVmmState::Creating | InternalVmmState::Starting => {
Self::Starting
}
InternalVmmState::Starting => Self::Starting,
InternalVmmState::Running => Self::Running,
InternalVmmState::Stopping => Self::Stopping,
InternalVmmState::Stopped => Self::Stopped,
Expand Down
6 changes: 0 additions & 6 deletions common/src/api/internal/nexus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,6 @@ pub struct InstanceRuntimeState {
)]
#[serde(rename_all = "snake_case")]
pub enum VmmState {
/// The VMM is known to Nexus, but may not yet exist on a sled.
///
/// VMM records are always inserted into the database in this state, and
/// then transition to 'starting' or 'migrating' once a sled-agent reports
/// that the VMM has been registered.
Creating,
/// The VMM is initializing and has not started running guest CPUs yet.
Starting,
/// The VMM has finished initializing and may be running guest CPUs.
Expand Down
11 changes: 6 additions & 5 deletions nexus/db-model/src/vmm_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ impl From<VmmState> for omicron_common::api::internal::nexus::VmmState {
fn from(value: VmmState) -> Self {
use omicron_common::api::internal::nexus::VmmState as Output;
match value {
VmmState::Creating => Output::Creating,
VmmState::Starting => Output::Starting,
// The `Creating` state is internal to Nexus; the outside world
// should treat it as equivalent to `Starting`.
VmmState::Creating | VmmState::Starting => Output::Starting,
VmmState::Running => Output::Running,
VmmState::Stopping => Output::Stopping,
VmmState::Stopped => Output::Stopped,
Expand All @@ -97,8 +98,9 @@ impl From<VmmState> for sled_agent_client::types::VmmState {
fn from(value: VmmState) -> Self {
use sled_agent_client::types::VmmState as Output;
match value {
VmmState::Creating => Output::Creating,
VmmState::Starting => Output::Starting,
// The `Creating` state is internal to Nexus; the outside world
// should treat it as equivalent to `Starting`.
VmmState::Creating | VmmState::Starting => Output::Starting,
VmmState::Running => Output::Running,
VmmState::Stopping => Output::Stopping,
VmmState::Stopped => Output::Stopped,
Expand All @@ -114,7 +116,6 @@ impl From<ApiState> for VmmState {
fn from(value: ApiState) -> Self {
use VmmState as Output;
match value {
ApiState::Creating => Output::Creating,
ApiState::Starting => Output::Starting,
ApiState::Running => Output::Running,
ApiState::Stopping => Output::Stopping,
Expand Down
7 changes: 0 additions & 7 deletions openapi/nexus-internal.json
Original file line number Diff line number Diff line change
Expand Up @@ -5436,13 +5436,6 @@
"VmmState": {
"description": "One of the states that a VMM can be in.",
"oneOf": [
{
"description": "The VMM is known to Nexus, but may not yet exist on a sled.\n\nVMM records are always inserted into the database in this state, and then transition to 'starting' or 'migrating' once a sled-agent reports that the VMM has been registered.",
"type": "string",
"enum": [
"creating"
]
},
{
"description": "The VMM is initializing and has not started running guest CPUs yet.",
"type": "string",
Expand Down
7 changes: 0 additions & 7 deletions openapi/sled-agent.json
Original file line number Diff line number Diff line change
Expand Up @@ -5234,13 +5234,6 @@
"VmmState": {
"description": "One of the states that a VMM can be in.",
"oneOf": [
{
"description": "The VMM is known to Nexus, but may not yet exist on a sled.\n\nVMM records are always inserted into the database in this state, and then transition to 'starting' or 'migrating' once a sled-agent reports that the VMM has been registered.",
"type": "string",
"enum": [
"creating"
]
},
{
"description": "The VMM is initializing and has not started running guest CPUs yet.",
"type": "string",
Expand Down
1 change: 0 additions & 1 deletion sled-agent/src/sim/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ impl SimInstanceInner {
}
VmmStateRequested::Running => {
match self.next_resting_state() {
VmmState::Creating => todo!("eliza: should sled-agents even know about this state??"),
VmmState::Starting => {
self.queue_propolis_state(
PropolisInstanceState::Running,
Expand Down

0 comments on commit f171767

Please sign in to comment.