diff --git a/nexus/mgs-updates/src/test_util/host_phase_2_test_state.rs b/nexus/mgs-updates/src/test_util/host_phase_2_test_state.rs index 4df57e21773..cf2d408b945 100644 --- a/nexus/mgs-updates/src/test_util/host_phase_2_test_state.rs +++ b/nexus/mgs-updates/src/test_util/host_phase_2_test_state.rs @@ -200,7 +200,6 @@ mod api_impl { use dropshot::StreamingBody; use dropshot::TypedBody; use iddqd::IdOrdMap; - use omicron_common::api::internal::nexus::DiskRuntimeState; use omicron_common::api::internal::shared::ExternalIpGatewayMap; use omicron_common::api::internal::shared::SledIdentifiers; use omicron_common::api::internal::shared::VirtualNetworkInterfaceHost; @@ -218,12 +217,9 @@ mod api_impl { use sled_agent_types::bootstore::BootstoreStatus; use sled_agent_types::dataset::LocalStorageDatasetDeleteRequest; use sled_agent_types::dataset::LocalStorageDatasetEnsureRequest; - use sled_agent_types::debug::ChickenSwitchDestroyOrphanedDatasets; use sled_agent_types::debug::OperatorSwitchZonePolicy; use sled_agent_types::diagnostics::SledDiagnosticsLogsDownloadPathParm; use sled_agent_types::diagnostics::SledDiagnosticsLogsDownloadQueryParam; - use sled_agent_types::disk::DiskEnsureBody; - use sled_agent_types::disk::DiskPathParam; use sled_agent_types::firewall_rules::VpcFirewallRulesEnsureBody; use sled_agent_types::instance::InstanceEnsureBody; use sled_agent_types::instance::InstanceExternalIpBody; @@ -252,7 +248,6 @@ mod api_impl { use sled_agent_types::inventory::OmicronSledConfig; use sled_agent_types::inventory::OmicronSledUpdateDisposition; use sled_agent_types::inventory::SledCpuFamily; - use sled_agent_types::inventory::SledRole; use sled_agent_types::inventory::SvcsEnabledNotOnlineResult; use sled_agent_types::probes::ProbeSet; use sled_agent_types::sled::AddSledRequest; @@ -271,7 +266,6 @@ mod api_impl { use sled_agent_types::zone_bundle::ZoneBundleId; use sled_agent_types::zone_bundle::ZoneBundleMetadata; use sled_agent_types::zone_bundle::ZonePathParam; - use sled_agent_types_versions::v1; use sled_agent_types_versions::v20; use sled_agent_types_versions::v25; use sled_agent_types_versions::v26; @@ -583,12 +577,6 @@ mod api_impl { unimplemented!() } - async fn sled_role_get_v1( - _rqctx: RequestContext, - ) -> Result, HttpError> { - unimplemented!() - } - async fn vmm_register( _rqctx: RequestContext, _path_params: Path, @@ -679,14 +667,6 @@ mod api_impl { } } - async fn disk_put( - _rqctx: RequestContext, - _path_params: Path, - _body: TypedBody, - ) -> Result, HttpError> { - unimplemented!() - } - async fn artifact_config_get( _rqctx: RequestContext, ) -> Result, HttpError> { @@ -767,15 +747,6 @@ mod api_impl { unimplemented!() } - async fn read_network_bootstore_config_cache( - _rqctx: RequestContext, - ) -> Result< - HttpResponseOk, - HttpError, - > { - unimplemented!() - } - async fn write_network_bootstore_config_v48( _rqctx: RequestContext, _body: TypedBody, @@ -839,13 +810,6 @@ mod api_impl { unimplemented!() } - async fn write_network_bootstore_config_v1( - _rqctx: RequestContext, - _body: TypedBody, - ) -> Result { - unimplemented!() - } - async fn sled_add( _rqctx: RequestContext, _body: TypedBody, @@ -972,22 +936,6 @@ mod api_impl { unimplemented!() } - async fn chicken_switch_destroy_orphaned_datasets_get_v1( - _request_context: RequestContext, - ) -> Result< - HttpResponseOk, - HttpError, - > { - unimplemented!() - } - - async fn chicken_switch_destroy_orphaned_datasets_put_v1( - _request_context: RequestContext, - _body: TypedBody, - ) -> Result { - unimplemented!() - } - async fn debug_operator_switch_zone_policy_get( _request_context: RequestContext, ) -> Result, HttpError> diff --git a/openapi/sled-agent/sled-agent-1.0.0-2da304.json.gitstub b/openapi/sled-agent/sled-agent-1.0.0-2da304.json.gitstub deleted file mode 100644 index 5c0d7afef1c..00000000000 --- a/openapi/sled-agent/sled-agent-1.0.0-2da304.json.gitstub +++ /dev/null @@ -1 +0,0 @@ -a582b520e5926304437d844dd68dcb03dd1d04cf:openapi/sled-agent/sled-agent-1.0.0-2da304.json diff --git a/openapi/sled-agent/sled-agent-10.0.0-898597.json.gitstub b/openapi/sled-agent/sled-agent-10.0.0-898597.json.gitstub deleted file mode 100644 index e062fa9e003..00000000000 --- a/openapi/sled-agent/sled-agent-10.0.0-898597.json.gitstub +++ /dev/null @@ -1 +0,0 @@ -f062472edf65eb3d66179a9d8dfb66619f458c96:openapi/sled-agent/sled-agent-10.0.0-898597.json diff --git a/openapi/sled-agent/sled-agent-11.0.0-5f3d9f.json.gitstub b/openapi/sled-agent/sled-agent-11.0.0-5f3d9f.json.gitstub deleted file mode 100644 index 098636c88f4..00000000000 --- a/openapi/sled-agent/sled-agent-11.0.0-5f3d9f.json.gitstub +++ /dev/null @@ -1 +0,0 @@ -99c3f3ef97f80d1401c54ce0c625af125d4faef3:openapi/sled-agent/sled-agent-11.0.0-5f3d9f.json diff --git a/openapi/sled-agent/sled-agent-12.0.0-ffacab.json.gitstub b/openapi/sled-agent/sled-agent-12.0.0-ffacab.json.gitstub deleted file mode 100644 index e64b80c3b63..00000000000 --- a/openapi/sled-agent/sled-agent-12.0.0-ffacab.json.gitstub +++ /dev/null @@ -1 +0,0 @@ -63c01899a7668044841021075711919160c90b1e:openapi/sled-agent/sled-agent-12.0.0-ffacab.json diff --git a/openapi/sled-agent/sled-agent-13.0.0-c4af95.json.gitstub b/openapi/sled-agent/sled-agent-13.0.0-c4af95.json.gitstub deleted file mode 100644 index c7b741e0b70..00000000000 --- a/openapi/sled-agent/sled-agent-13.0.0-c4af95.json.gitstub +++ /dev/null @@ -1 +0,0 @@ -29da4b2d1a23cf9bf659b7962c2cd5ade6d7af0a:openapi/sled-agent/sled-agent-13.0.0-c4af95.json diff --git a/openapi/sled-agent/sled-agent-14.0.0-bca1c8.json.gitstub b/openapi/sled-agent/sled-agent-14.0.0-bca1c8.json.gitstub deleted file mode 100644 index 495b9e9b29f..00000000000 --- a/openapi/sled-agent/sled-agent-14.0.0-bca1c8.json.gitstub +++ /dev/null @@ -1 +0,0 @@ -8ae817f7284debada072ecde2cb925515dddcb88:openapi/sled-agent/sled-agent-14.0.0-bca1c8.json diff --git a/openapi/sled-agent/sled-agent-15.0.0-92bd2d.json.gitstub b/openapi/sled-agent/sled-agent-15.0.0-92bd2d.json.gitstub deleted file mode 100644 index 7efff716e69..00000000000 --- a/openapi/sled-agent/sled-agent-15.0.0-92bd2d.json.gitstub +++ /dev/null @@ -1 +0,0 @@ -ec9b6ccc010316b586cce160f85937b92dfc277f:openapi/sled-agent/sled-agent-15.0.0-92bd2d.json diff --git a/openapi/sled-agent/sled-agent-16.0.0-1923e2.json.gitstub b/openapi/sled-agent/sled-agent-16.0.0-1923e2.json.gitstub deleted file mode 100644 index 005123829b9..00000000000 --- a/openapi/sled-agent/sled-agent-16.0.0-1923e2.json.gitstub +++ /dev/null @@ -1 +0,0 @@ -9163f85d9c0a8bc68a247f81c2543d30beb710ff:openapi/sled-agent/sled-agent-16.0.0-1923e2.json diff --git a/openapi/sled-agent/sled-agent-17.0.0-cb6649.json.gitstub b/openapi/sled-agent/sled-agent-17.0.0-cb6649.json.gitstub deleted file mode 100644 index c6d2d632aca..00000000000 --- a/openapi/sled-agent/sled-agent-17.0.0-cb6649.json.gitstub +++ /dev/null @@ -1 +0,0 @@ -8b491f85be637556afcefebccaacd95d215a7028:openapi/sled-agent/sled-agent-17.0.0-cb6649.json diff --git a/openapi/sled-agent/sled-agent-18.0.0-93d4c3.json.gitstub b/openapi/sled-agent/sled-agent-18.0.0-93d4c3.json.gitstub deleted file mode 100644 index 550e5098efe..00000000000 --- a/openapi/sled-agent/sled-agent-18.0.0-93d4c3.json.gitstub +++ /dev/null @@ -1 +0,0 @@ -16c22eb154598b1b40f5ac73cbc2183219b4c133:openapi/sled-agent/sled-agent-18.0.0-93d4c3.json diff --git a/openapi/sled-agent/sled-agent-19.0.0-c56f15.json.gitstub b/openapi/sled-agent/sled-agent-19.0.0-c56f15.json.gitstub deleted file mode 100644 index 343f6422452..00000000000 --- a/openapi/sled-agent/sled-agent-19.0.0-c56f15.json.gitstub +++ /dev/null @@ -1 +0,0 @@ -becbbb616f5f18b59cc42e511c148734c2ba3831:openapi/sled-agent/sled-agent-19.0.0-c56f15.json diff --git a/openapi/sled-agent/sled-agent-2.0.0-a3e161.json.gitstub b/openapi/sled-agent/sled-agent-2.0.0-a3e161.json.gitstub deleted file mode 100644 index 82c35ef97f0..00000000000 --- a/openapi/sled-agent/sled-agent-2.0.0-a3e161.json.gitstub +++ /dev/null @@ -1 +0,0 @@ -33d4f825192acc9d0425b5eac6ea7624ecc0da84:openapi/sled-agent/sled-agent-2.0.0-a3e161.json diff --git a/openapi/sled-agent/sled-agent-20.0.0-fb6298.json.gitstub b/openapi/sled-agent/sled-agent-20.0.0-fb6298.json.gitstub deleted file mode 100644 index 69c848f2c6b..00000000000 --- a/openapi/sled-agent/sled-agent-20.0.0-fb6298.json.gitstub +++ /dev/null @@ -1 +0,0 @@ -4a456c997977e03d2e0c85fcb8c590514418b695:openapi/sled-agent/sled-agent-20.0.0-fb6298.json diff --git a/openapi/sled-agent/sled-agent-21.0.0-f22cee.json.gitstub b/openapi/sled-agent/sled-agent-21.0.0-f22cee.json.gitstub deleted file mode 100644 index 32ce909730a..00000000000 --- a/openapi/sled-agent/sled-agent-21.0.0-f22cee.json.gitstub +++ /dev/null @@ -1 +0,0 @@ -d3ef1db023bfbaf8fa1ac559809b58b795b703f7:openapi/sled-agent/sled-agent-21.0.0-f22cee.json diff --git a/openapi/sled-agent/sled-agent-22.0.0-c0f464.json.gitstub b/openapi/sled-agent/sled-agent-22.0.0-c0f464.json.gitstub deleted file mode 100644 index 261d46d52f2..00000000000 --- a/openapi/sled-agent/sled-agent-22.0.0-c0f464.json.gitstub +++ /dev/null @@ -1 +0,0 @@ -3cb178f675b63ead216e5a39ccea28624486867d:openapi/sled-agent/sled-agent-22.0.0-c0f464.json diff --git a/openapi/sled-agent/sled-agent-23.0.0-4cab57.json.gitstub b/openapi/sled-agent/sled-agent-23.0.0-4cab57.json.gitstub deleted file mode 100644 index add2ded450f..00000000000 --- a/openapi/sled-agent/sled-agent-23.0.0-4cab57.json.gitstub +++ /dev/null @@ -1 +0,0 @@ -7c10008923222e095463fdc38324e4f789cb7e3e:openapi/sled-agent/sled-agent-23.0.0-4cab57.json diff --git a/openapi/sled-agent/sled-agent-3.0.0-f44f77.json.gitstub b/openapi/sled-agent/sled-agent-3.0.0-f44f77.json.gitstub deleted file mode 100644 index e5b59c151c4..00000000000 --- a/openapi/sled-agent/sled-agent-3.0.0-f44f77.json.gitstub +++ /dev/null @@ -1 +0,0 @@ -4f5153721993b7f2a96e48f49ef0b42144deff32:openapi/sled-agent/sled-agent-3.0.0-f44f77.json diff --git a/openapi/sled-agent/sled-agent-4.0.0-fd6727.json.gitstub b/openapi/sled-agent/sled-agent-4.0.0-fd6727.json.gitstub deleted file mode 100644 index 770102e3b6c..00000000000 --- a/openapi/sled-agent/sled-agent-4.0.0-fd6727.json.gitstub +++ /dev/null @@ -1 +0,0 @@ -e76962a5f67b8c5bf813ee24a7600634de708b35:openapi/sled-agent/sled-agent-4.0.0-fd6727.json diff --git a/openapi/sled-agent/sled-agent-5.0.0-253577.json.gitstub b/openapi/sled-agent/sled-agent-5.0.0-253577.json.gitstub deleted file mode 100644 index 0927193e0b7..00000000000 --- a/openapi/sled-agent/sled-agent-5.0.0-253577.json.gitstub +++ /dev/null @@ -1 +0,0 @@ -4d5bdc6d348b27761348d763c4085f060bcefc18:openapi/sled-agent/sled-agent-5.0.0-253577.json diff --git a/openapi/sled-agent/sled-agent-6.0.0-d37dd7.json.gitstub b/openapi/sled-agent/sled-agent-6.0.0-d37dd7.json.gitstub deleted file mode 100644 index 0366fa5a446..00000000000 --- a/openapi/sled-agent/sled-agent-6.0.0-d37dd7.json.gitstub +++ /dev/null @@ -1 +0,0 @@ -c009adbad528a212beb85212b2c509768f594aa8:openapi/sled-agent/sled-agent-6.0.0-d37dd7.json diff --git a/openapi/sled-agent/sled-agent-7.0.0-62acb3.json.gitstub b/openapi/sled-agent/sled-agent-7.0.0-62acb3.json.gitstub deleted file mode 100644 index b1a3d4745e7..00000000000 --- a/openapi/sled-agent/sled-agent-7.0.0-62acb3.json.gitstub +++ /dev/null @@ -1 +0,0 @@ -18058fcad61863324e3be38f17001ed5760d1458:openapi/sled-agent/sled-agent-7.0.0-62acb3.json diff --git a/openapi/sled-agent/sled-agent-8.0.0-0e6bcf.json.gitstub b/openapi/sled-agent/sled-agent-8.0.0-0e6bcf.json.gitstub deleted file mode 100644 index d7fbb306c88..00000000000 --- a/openapi/sled-agent/sled-agent-8.0.0-0e6bcf.json.gitstub +++ /dev/null @@ -1 +0,0 @@ -73fa6628a393118f927264586d15069b201ba4b7:openapi/sled-agent/sled-agent-8.0.0-0e6bcf.json diff --git a/openapi/sled-agent/sled-agent-9.0.0-12ab86.json.gitstub b/openapi/sled-agent/sled-agent-9.0.0-12ab86.json.gitstub deleted file mode 100644 index 8e5f55fd19c..00000000000 --- a/openapi/sled-agent/sled-agent-9.0.0-12ab86.json.gitstub +++ /dev/null @@ -1 +0,0 @@ -f493515c1a1545cb71d6578d12055668a4198cb0:openapi/sled-agent/sled-agent-9.0.0-12ab86.json diff --git a/sled-agent/api/src/lib.rs b/sled-agent/api/src/lib.rs index 9e287fdfdb8..322cf64a5d9 100644 --- a/sled-agent/api/src/lib.rs +++ b/sled-agent/api/src/lib.rs @@ -12,17 +12,13 @@ use dropshot::{ StreamingBody, TypedBody, }; use dropshot_api_manager_types::api_versions; -use omicron_common::api::internal::{ - nexus::DiskRuntimeState, - shared::{ - ExternalIpGatewayMap, ResolvedVpcRouteSet, ResolvedVpcRouteState, - SledIdentifiers, VirtualNetworkInterfaceHost, - }, +use omicron_common::api::internal::shared::{ + ExternalIpGatewayMap, ResolvedVpcRouteSet, ResolvedVpcRouteState, + SledIdentifiers, VirtualNetworkInterfaceHost, }; use sled_agent_types_versions::{ - latest, v1, v4, v6, v7, v9, v10, v11, v12, v14, v16, v17, v18, v20, v22, - v24, v25, v26, v28, v29, v30, v31, v32, v33, v34, v37, v39, v40, v41, v42, - v43, v46, v47, v48, v49, v50, + latest, v1, v11, v14, v18, v20, v22, v24, v25, v26, v28, v29, v30, v31, + v32, v33, v34, v37, v39, v40, v41, v42, v43, v46, v47, v48, v49, v50, }; use sled_diagnostics::SledDiagnosticsQueryOutput; use slog_error_chain::InlineErrorChain; @@ -67,29 +63,8 @@ api_versions!([ (26, RACK_NETWORK_CONFIG_NOT_OPTIONAL), (25, BOOTSTORE_VERSIONING), (24, ADD_ZPOOL_HEALTH_TO_INVENTORY), - (23, REMOVE_READ_BOOTSTORE_CONFIG_CACHE), - (22, REMOVE_HEALTH_MONITOR_KEEP_CHECKS), - (21, REMOVE_DISK_PUT), - (20, BGP_V6), - (19, ADD_ROT_ATTESTATION), - (18, ADD_ATTACHED_SUBNETS), - (17, TWO_TYPES_OF_DELEGATED_ZVOL), - (16, MEASUREMENT_PROPER_INVENTORY), - (15, ADD_TRUST_QUORUM_STATUS), - (14, MEASUREMENTS), - (13, ADD_TRUST_QUORUM), - (12, ADD_SMF_SERVICES_HEALTH_CHECK), - (11, ADD_DUAL_STACK_EXTERNAL_IP_CONFIG), - (10, ADD_DUAL_STACK_SHARED_NETWORK_INTERFACES), - (9, DELEGATE_ZVOL_TO_PROPOLIS), - (8, REMOVE_SLED_ROLE), - (7, MULTICAST_SUPPORT), - (6, ADD_PROBE_PUT_ENDPOINT), - (5, NEWTYPE_UUID_BUMP), - (4, ADD_NEXUS_LOCKSTEP_PORT_TO_INVENTORY), - (3, ADD_SWITCH_ZONE_OPERATOR_POLICY), - (2, REMOVE_DESTROY_ORPHANED_DATASETS_CHICKEN_SWITCH), - (1, INITIAL), + // Versions before this have been retired. We no longer support them in any + // server, nor expect them from any client. ]); // WHEN CHANGING THE API (part 2 of 2): @@ -412,7 +387,7 @@ pub trait SledAgentApi { operation_id = "omicron_config_put", method = PUT, path = "/omicron-config", - versions = VERSION_MEASUREMENTS..VERSION_ADD_UPDATE_DISPOSITION, + versions = ..VERSION_ADD_UPDATE_DISPOSITION, }] async fn omicron_config_put_v14( rqctx: RequestContext, @@ -421,74 +396,6 @@ pub trait SledAgentApi { Self::omicron_config_put_v49(rqctx, body.map(Into::into)).await } - #[endpoint { - operation_id = "omicron_config_put", - method = PUT, - path = "/omicron-config", - versions = - VERSION_ADD_DUAL_STACK_EXTERNAL_IP_CONFIG..VERSION_MEASUREMENTS, - }] - async fn omicron_config_put_v11( - rqctx: RequestContext, - body: TypedBody, - ) -> Result { - let body = body.try_map(v14::inventory::OmicronSledConfig::try_from)?; - Self::omicron_config_put_v14(rqctx, body).await - } - - #[endpoint { - operation_id = "omicron_config_put", - method = PUT, - path = "/omicron-config", - versions = - VERSION_ADD_DUAL_STACK_SHARED_NETWORK_INTERFACES..VERSION_ADD_DUAL_STACK_EXTERNAL_IP_CONFIG, - }] - async fn omicron_config_put_v10( - rqctx: RequestContext, - body: TypedBody, - ) -> Result { - let body = body.try_map(v11::inventory::OmicronSledConfig::try_from)?; - Self::omicron_config_put_v11(rqctx, body).await - } - - #[endpoint { - operation_id = "omicron_config_put", - method = PUT, - path = "/omicron-config", - versions = - VERSION_ADD_NEXUS_LOCKSTEP_PORT_TO_INVENTORY..VERSION_ADD_DUAL_STACK_SHARED_NETWORK_INTERFACES, - }] - async fn omicron_config_put_v4( - rqctx: RequestContext, - body: TypedBody, - ) -> Result { - let body = body.try_map(v10::inventory::OmicronSledConfig::try_from)?; - Self::omicron_config_put_v10(rqctx, body).await - } - - #[endpoint { - operation_id = "omicron_config_put", - method = PUT, - path = "/omicron-config", - versions = ..VERSION_ADD_NEXUS_LOCKSTEP_PORT_TO_INVENTORY, - }] - async fn omicron_config_put_v1( - rqctx: RequestContext, - body: TypedBody, - ) -> Result { - Self::omicron_config_put_v4(rqctx, body.map(Into::into)).await - } - - #[endpoint { - operation_id = "sled_role_get", - method = GET, - path = "/sled-role", - versions = ..VERSION_REMOVE_SLED_ROLE, - }] - async fn sled_role_get_v1( - rqctx: RequestContext, - ) -> Result, HttpError>; - #[endpoint { operation_id = "vmm_register", method = PUT, @@ -561,8 +468,7 @@ pub trait SledAgentApi { operation_id = "vmm_register", method = PUT, path = "/vmms/{propolis_id}", - versions = - VERSION_ADD_ATTACHED_SUBNETS..VERSION_ADD_VSOCK_COMPONENT + versions = ..VERSION_ADD_VSOCK_COMPONENT }] async fn vmm_register_v18( rqctx: RequestContext, @@ -572,95 +478,6 @@ pub trait SledAgentApi { Self::vmm_register_v29(rqctx, path_params, body.map(Into::into)).await } - #[endpoint { - operation_id = "vmm_register", - method = PUT, - path = "/vmms/{propolis_id}", - versions = - VERSION_TWO_TYPES_OF_DELEGATED_ZVOL..VERSION_ADD_ATTACHED_SUBNETS - }] - async fn vmm_register_v17( - rqctx: RequestContext, - path_params: Path, - body: TypedBody, - ) -> Result, HttpError> { - Self::vmm_register_v18(rqctx, path_params, body.map(Into::into)).await - } - - #[endpoint { - operation_id = "vmm_register", - method = PUT, - path = "/vmms/{propolis_id}", - versions = VERSION_ADD_DUAL_STACK_EXTERNAL_IP_CONFIG..VERSION_TWO_TYPES_OF_DELEGATED_ZVOL - }] - async fn vmm_register_v11( - rqctx: RequestContext, - path_params: Path, - body: TypedBody, - ) -> Result, HttpError> { - Self::vmm_register_v17(rqctx, path_params, body.map(Into::into)).await - } - - #[endpoint { - operation_id = "vmm_register", - method = PUT, - path = "/vmms/{propolis_id}", - versions = - VERSION_ADD_DUAL_STACK_SHARED_NETWORK_INTERFACES..VERSION_ADD_DUAL_STACK_EXTERNAL_IP_CONFIG - }] - async fn vmm_register_v10( - rqctx: RequestContext, - path_params: Path, - body: TypedBody, - ) -> Result, HttpError> { - let body = body.try_map(v11::instance::InstanceEnsureBody::try_from)?; - Self::vmm_register_v11(rqctx, path_params, body).await - } - - #[endpoint { - method = PUT, - path = "/vmms/{propolis_id}", - operation_id = "vmm_register", - versions = - VERSION_DELEGATE_ZVOL_TO_PROPOLIS..VERSION_ADD_DUAL_STACK_SHARED_NETWORK_INTERFACES - }] - async fn vmm_register_v9( - rqctx: RequestContext, - path_params: Path, - body: TypedBody, - ) -> Result, HttpError> { - let body = body.try_map(v10::instance::InstanceEnsureBody::try_from)?; - Self::vmm_register_v10(rqctx, path_params, body).await - } - - #[endpoint { - operation_id = "vmm_register", - method = PUT, - path = "/vmms/{propolis_id}", - versions = VERSION_MULTICAST_SUPPORT..VERSION_DELEGATE_ZVOL_TO_PROPOLIS - }] - async fn vmm_register_v7( - rqctx: RequestContext, - path_params: Path, - body: TypedBody, - ) -> Result, HttpError> { - Self::vmm_register_v9(rqctx, path_params, body.map(Into::into)).await - } - - #[endpoint { - operation_id = "vmm_register", - method = PUT, - path = "/vmms/{propolis_id}", - versions = ..VERSION_MULTICAST_SUPPORT - }] - async fn vmm_register_v1( - rqctx: RequestContext, - path_params: Path, - body: TypedBody, - ) -> Result, HttpError> { - Self::vmm_register_v7(rqctx, path_params, body.map(Into::into)).await - } - #[endpoint { method = DELETE, path = "/vmms/{propolis_id}" @@ -715,7 +532,6 @@ pub trait SledAgentApi { #[endpoint { method = PUT, path = "/vmms/{propolis_id}/multicast-group", - versions = VERSION_MULTICAST_SUPPORT.., }] async fn vmm_join_multicast_group( rqctx: RequestContext, @@ -726,7 +542,6 @@ pub trait SledAgentApi { #[endpoint { method = DELETE, path = "/vmms/{propolis_id}/multicast-group", - versions = VERSION_MULTICAST_SUPPORT.., }] async fn vmm_leave_multicast_group( rqctx: RequestContext, @@ -734,17 +549,6 @@ pub trait SledAgentApi { body: TypedBody, ) -> Result; - #[endpoint { - method = PUT, - path = "/disks/{disk_id}", - versions = ..VERSION_REMOVE_DISK_PUT, - }] - async fn disk_put( - rqctx: RequestContext, - path_params: Path, - body: TypedBody, - ) -> Result, HttpError>; - #[endpoint { method = GET, path = "/artifacts-config" @@ -827,7 +631,7 @@ pub trait SledAgentApi { operation_id = "vpc_firewall_rules_put", method = PUT, path = "/vpc/{vpc_id}/firewall/rules", - versions = VERSION_ADD_DUAL_STACK_SHARED_NETWORK_INTERFACES..VERSION_ADD_ICMPV6_FIREWALL_SUPPORT, + versions = ..VERSION_ADD_ICMPV6_FIREWALL_SUPPORT, }] async fn vpc_firewall_rules_put_v11( rqctx: RequestContext, @@ -839,23 +643,6 @@ pub trait SledAgentApi { Self::vpc_firewall_rules_put(rqctx, path_params, body).await } - #[endpoint { - operation_id = "vpc_firewall_rules_put", - method = PUT, - path = "/vpc/{vpc_id}/firewall/rules", - versions = ..VERSION_ADD_DUAL_STACK_SHARED_NETWORK_INTERFACES, - }] - async fn vpc_firewall_rules_put_v1( - rqctx: RequestContext, - path_params: Path, - body: TypedBody, - ) -> Result { - let body = body.try_map( - v11::firewall_rules::VpcFirewallRulesEnsureBody::try_from, - )?; - Self::vpc_firewall_rules_put_v11(rqctx, path_params, body).await - } - /// Create a mapping from a virtual NIC to a physical host // Keep interface_id to maintain parity with the simulated sled agent, which // requires interface_id on the path. @@ -917,7 +704,7 @@ pub trait SledAgentApi { #[endpoint { method = POST, path = "/switch-ports", - versions = VERSION_BGP_V6..VERSION_STRONGER_BGP_UNNUMBERED_TYPES, + versions = ..VERSION_STRONGER_BGP_UNNUMBERED_TYPES, }] async fn uplink_ensure_v20( rqctx: RequestContext, @@ -935,66 +722,6 @@ pub trait SledAgentApi { .await } - #[endpoint { - method = POST, - path = "/switch-ports", - versions = ..VERSION_BGP_V6, - }] - async fn uplink_ensure_v1( - rqctx: RequestContext, - body: TypedBody, - ) -> Result { - Self::uplink_ensure_v20(rqctx, body.map(From::from)).await - } - - /// This API endpoint is only reading the local sled agent's view of the - /// bootstore. The boostore is a distributed data store that is eventually - /// consistent. Reads from individual nodes may not represent the latest state. - // THIS HAS BEEN REMOVED AND SHOULD NOT BE RESTORED. Reading from the - // bootstore cache is inherently racy; the bootstore is eventually - // consistent, and reads from different nodes may return different values. - // Instead, callers should read from CRDB. - #[endpoint { - method = GET, - path = "/network-bootstore-config", - versions = VERSION_BGP_V6..VERSION_REMOVE_READ_BOOTSTORE_CONFIG_CACHE, - }] - async fn read_network_bootstore_config_cache( - rqctx: RequestContext, - ) -> Result< - HttpResponseOk, - HttpError, - >; - - /// This API endpoint is only reading the local sled agent's view of the - /// bootstore. The boostore is a distributed data store that is eventually - /// consistent. Reads from individual nodes may not represent the latest state. - #[endpoint { - method = GET, - path = "/network-bootstore-config", - versions = ..VERSION_BGP_V6, - }] - async fn read_network_bootstore_config_cache_v1( - rqctx: RequestContext, - ) -> Result< - HttpResponseOk, - HttpError, - > { - let result: v1::early_networking::EarlyNetworkConfig = - Self::read_network_bootstore_config_cache(rqctx) - .await? - .0 - .try_into() - .map_err(|e| { - HttpError::for_bad_request( - None, - format!("error getting v1 config: {e}"), - ) - })?; - - Ok(HttpResponseOk(result)) - } - // ------------------------------------------------------------------------- // WARNING WARNING WARNING // @@ -1151,7 +878,7 @@ pub trait SledAgentApi { #[endpoint { method = PUT, path = "/network-bootstore-config", - versions = VERSION_BGP_V6..VERSION_BOOTSTORE_VERSIONING, + versions = ..VERSION_BOOTSTORE_VERSIONING, operation_id = "write_network_bootstore_config", }] async fn write_network_bootstore_config_v20( @@ -1159,19 +886,6 @@ pub trait SledAgentApi { body: TypedBody, ) -> Result; - // As described above, this must not forward to newer versions; sled-agent - // must implement this by faithfully serializing the requested version. - #[endpoint { - method = PUT, - path = "/network-bootstore-config", - versions = ..VERSION_BGP_V6, - operation_id = "write_network_bootstore_config", - }] - async fn write_network_bootstore_config_v1( - rqctx: RequestContext, - body: TypedBody, - ) -> Result; - /// Add a sled to a rack that was already initialized via RSS #[endpoint { method = PUT, @@ -1345,7 +1059,7 @@ pub trait SledAgentApi { operation_id = "inventory", method = GET, path = "/inventory", - versions = VERSION_REMOVE_HEALTH_MONITOR_KEEP_CHECKS..VERSION_ADD_ZPOOL_HEALTH_TO_INVENTORY, + versions = ..VERSION_ADD_ZPOOL_HEALTH_TO_INVENTORY, }] async fn inventory_v22( rqctx: RequestContext, @@ -1355,109 +1069,6 @@ pub trait SledAgentApi { }) } - /// Fetch basic information about this sled - #[endpoint { - operation_id = "inventory", - method = GET, - path = "/inventory", - versions = VERSION_MEASUREMENT_PROPER_INVENTORY..VERSION_REMOVE_HEALTH_MONITOR_KEEP_CHECKS, - }] - async fn inventory_v16( - rqctx: RequestContext, - ) -> Result, HttpError> { - Self::inventory_v22(rqctx).await.map(|HttpResponseOk(inv)| { - HttpResponseOk(v16::inventory::Inventory::from(inv)) - }) - } - - /// Fetch basic information about this sled - #[endpoint { - operation_id = "inventory", - method = GET, - path = "/inventory", - versions = VERSION_MEASUREMENTS..VERSION_MEASUREMENT_PROPER_INVENTORY, - }] - async fn inventory_v14( - rqctx: RequestContext, - ) -> Result, HttpError> { - let HttpResponseOk(inventory) = Self::inventory_v16(rqctx).await?; - inventory.try_into().map_err(HttpError::from).map(HttpResponseOk) - } - - /// Fetch basic information about this sled - #[endpoint { - operation_id = "inventory", - method = GET, - path = "/inventory", - versions = VERSION_ADD_SMF_SERVICES_HEALTH_CHECK..VERSION_MEASUREMENTS, - }] - async fn inventory_v12( - rqctx: RequestContext, - ) -> Result, HttpError> { - let HttpResponseOk(inventory) = Self::inventory_v14(rqctx).await?; - inventory.try_into().map_err(HttpError::from).map(HttpResponseOk) - } - - /// Fetch basic information about this sled - #[endpoint { - operation_id = "inventory", - method = GET, - path = "/inventory", - versions = VERSION_ADD_DUAL_STACK_EXTERNAL_IP_CONFIG..VERSION_ADD_SMF_SERVICES_HEALTH_CHECK, - }] - async fn inventory_v11( - rqctx: RequestContext, - ) -> Result, HttpError> { - Self::inventory_v12(rqctx).await.map(|HttpResponseOk(inv)| { - HttpResponseOk(v11::inventory::Inventory::from(inv)) - }) - } - - /// Fetch basic information about this sled - #[endpoint { - operation_id = "inventory", - method = GET, - path = "/inventory", - versions = - VERSION_ADD_DUAL_STACK_SHARED_NETWORK_INTERFACES..VERSION_ADD_DUAL_STACK_EXTERNAL_IP_CONFIG, - }] - async fn inventory_v10( - rqctx: RequestContext, - ) -> Result, HttpError> { - let HttpResponseOk(inventory) = Self::inventory_v11(rqctx).await?; - inventory.try_into().map_err(HttpError::from).map(HttpResponseOk) - } - - /// Fetch basic information about this sled - #[endpoint { - operation_id = "inventory", - method = GET, - path = "/inventory", - versions = - VERSION_ADD_NEXUS_LOCKSTEP_PORT_TO_INVENTORY..VERSION_ADD_DUAL_STACK_SHARED_NETWORK_INTERFACES, - }] - async fn inventory_v4( - rqctx: RequestContext, - ) -> Result, HttpError> { - let HttpResponseOk(inventory) = Self::inventory_v10(rqctx).await?; - inventory.try_into().map_err(HttpError::from).map(HttpResponseOk) - } - - /// Fetch basic information about this sled - #[endpoint { - operation_id = "inventory", - method = GET, - path = "/inventory", - versions = ..VERSION_ADD_NEXUS_LOCKSTEP_PORT_TO_INVENTORY, - }] - async fn inventory_v1( - rqctx: RequestContext, - ) -> Result, HttpError> { - Self::inventory_v4(rqctx).await.map(|HttpResponseOk(inv)| { - HttpResponseOk(v1::inventory::Inventory::from(inv)) - }) - } - /// Fetch sled identifiers #[endpoint { method = GET, @@ -1610,45 +1221,12 @@ pub trait SledAgentApi { >, ) -> Result, HttpError>; - /// This endpoint reports the status of the `destroy_orphaned_datasets` - /// chicken switch. It will be removed with omicron#6177. - #[endpoint { - operation_id = "chicken_switch_destroy_orphaned_datasets_get", - method = GET, - path = "/chicken-switch/destroy-orphaned-datasets", - versions = ..VERSION_REMOVE_DESTROY_ORPHANED_DATASETS_CHICKEN_SWITCH, - }] - async fn chicken_switch_destroy_orphaned_datasets_get_v1( - request_context: RequestContext, - ) -> Result< - HttpResponseOk, - HttpError, - >; - - /// This endpoint sets the `destroy_orphaned_datasets` chicken switch - /// (allowing sled-agent to delete datasets it believes are orphaned). It - /// will be removed with omicron#6177. - #[endpoint { - operation_id = "chicken_switch_destroy_orphaned_datasets_put", - method = PUT, - path = "/chicken-switch/destroy-orphaned-datasets", - // This should have been removed in - // `VERSION_REMOVE_DESTROY_ORPHANED_DATASETS_CHICKEN_SWITCH`, but was - // overlooked. This removes it as of the next version instead. - versions = ..VERSION_ADD_SWITCH_ZONE_OPERATOR_POLICY, - }] - async fn chicken_switch_destroy_orphaned_datasets_put_v1( - request_context: RequestContext, - body: TypedBody, - ) -> Result; - /// A debugging endpoint only used by `omdb` that allows us to test /// restarting the switch zone without restarting sled-agent. See /// for context. #[endpoint { method = GET, path = "/debug/switch-zone-policy", - versions = VERSION_ADD_SWITCH_ZONE_OPERATOR_POLICY.., }] async fn debug_operator_switch_zone_policy_get( request_context: RequestContext, @@ -1668,7 +1246,6 @@ pub trait SledAgentApi { #[endpoint { method = PUT, path = "/debug/switch-zone-policy", - versions = VERSION_ADD_SWITCH_ZONE_OPERATOR_POLICY.., }] async fn debug_operator_switch_zone_policy_put( request_context: RequestContext, @@ -1683,116 +1260,38 @@ pub trait SledAgentApi { #[endpoint { method = PUT, path = "/probes", - versions = VERSION_ADD_DUAL_STACK_SHARED_NETWORK_INTERFACES.., }] async fn probes_put( request_context: RequestContext, body: TypedBody, ) -> Result; - /// Update the entire set of probe zones on this sled. - /// - /// Probe zones are used to debug networking configuration. They look - /// similar to instances, in that they have an OPTE port on a VPC subnet and - /// external addresses, but no actual VM. - #[endpoint { - operation_id = "probes_put", - method = PUT, - path = "/probes", - versions = - VERSION_ADD_PROBE_PUT_ENDPOINT..VERSION_ADD_DUAL_STACK_SHARED_NETWORK_INTERFACES, - }] - async fn probes_put_v6( - request_context: RequestContext, - body: TypedBody, - ) -> Result { - let body = body.try_map(latest::probes::ProbeSet::try_from)?; - Self::probes_put(request_context, body).await - } - /// Create a local storage dataset #[endpoint { operation_id = "local_storage_dataset_ensure", method = POST, path = "/local-storage", - versions = VERSION_TWO_TYPES_OF_DELEGATED_ZVOL.., }] async fn local_storage_dataset_ensure( request_context: RequestContext, body: TypedBody, ) -> Result; - /// Create a local storage dataset - #[endpoint { - operation_id = "local_storage_dataset_ensure", - method = POST, - path = "/local-storage/{zpool_id}/{dataset_id}", - versions = VERSION_DELEGATE_ZVOL_TO_PROPOLIS..VERSION_TWO_TYPES_OF_DELEGATED_ZVOL, - }] - async fn local_storage_dataset_ensure_v9( - request_context: RequestContext, - path_params: Path, - body: TypedBody, - ) -> Result { - let path_params = path_params.into_inner(); - let body = body.into_inner(); - - Self::local_storage_dataset_ensure( - request_context, - latest::dataset::LocalStorageDatasetEnsureRequest::from( - path_params.zpool_id, - path_params.dataset_id, - body, - ) - .into(), - ) - .await - } - /// Delete a local storage dataset #[endpoint { operation_id = "local_storage_dataset_delete", method = DELETE, path = "/local-storage", - versions = VERSION_TWO_TYPES_OF_DELEGATED_ZVOL.., }] async fn local_storage_dataset_delete( request_context: RequestContext, body: TypedBody, ) -> Result; - /// Delete a local storage dataset - #[endpoint { - operation_id = "local_storage_dataset_delete", - method = DELETE, - path = "/local-storage/{zpool_id}/{dataset_id}", - versions = VERSION_DELEGATE_ZVOL_TO_PROPOLIS..VERSION_TWO_TYPES_OF_DELEGATED_ZVOL, - }] - async fn local_storage_dataset_delete_v9( - request_context: RequestContext, - path_params: Path, - ) -> Result { - let path_params = path_params.into_inner(); - - Self::local_storage_dataset_delete( - request_context, - latest::dataset::LocalStorageDatasetDeleteRequest { - zpool_id: path_params.zpool_id, - dataset_id: path_params.dataset_id, - // This version of the API assumed it would be using the - // encrypted dataset. - encrypted_at_rest: true, - } - .into(), - ) - .await - } - /// Initiate a trust quorum reconfiguration #[endpoint { method = POST, path = "/trust-quorum/configuration", - versions = VERSION_ADD_TRUST_QUORUM.., }] async fn trust_quorum_reconfigure( request_context: RequestContext, @@ -1803,7 +1302,6 @@ pub trait SledAgentApi { #[endpoint { method = POST, path = "/trust-quorum/upgrade", - versions = VERSION_ADD_TRUST_QUORUM.., }] async fn trust_quorum_upgrade_from_lrtq( request_context: RequestContext, @@ -1814,7 +1312,6 @@ pub trait SledAgentApi { #[endpoint { method = PUT, path = "/trust-quorum/commit", - versions = VERSION_ADD_TRUST_QUORUM.., }] async fn trust_quorum_commit( request_context: RequestContext, @@ -1825,7 +1322,6 @@ pub trait SledAgentApi { #[endpoint { method = GET, path = "/trust-quorum/coordinator-status", - versions = VERSION_ADD_TRUST_QUORUM.., }] async fn trust_quorum_coordinator_status( request_context: RequestContext, @@ -1838,7 +1334,6 @@ pub trait SledAgentApi { #[endpoint { method = PUT, path = "/trust-quorum/prepare-and-commit", - versions = VERSION_ADD_TRUST_QUORUM.., }] async fn trust_quorum_prepare_and_commit( request_context: RequestContext, @@ -1852,7 +1347,6 @@ pub trait SledAgentApi { #[endpoint { method = PUT, path = "/trust-quorum/proxy/commit", - versions = VERSION_ADD_TRUST_QUORUM.., }] async fn trust_quorum_proxy_commit( request_context: RequestContext, @@ -1863,7 +1357,6 @@ pub trait SledAgentApi { #[endpoint { method = PUT, path = "/trust-quorum/proxy/prepare-and-commit", - versions = VERSION_ADD_TRUST_QUORUM.., }] async fn trust_quorum_proxy_prepare_and_commit( request_context: RequestContext, @@ -1877,7 +1370,6 @@ pub trait SledAgentApi { #[endpoint { method = GET, path = "/trust-quorum/proxy/status", - versions = VERSION_ADD_TRUST_QUORUM.., }] async fn trust_quorum_proxy_status( request_context: RequestContext, @@ -1888,7 +1380,6 @@ pub trait SledAgentApi { #[endpoint { method = GET, path = "/trust-quorum/status", - versions = VERSION_ADD_TRUST_QUORUM_STATUS.., }] async fn trust_quorum_status( request_context: RequestContext, @@ -1898,7 +1389,6 @@ pub trait SledAgentApi { #[endpoint { method = GET, path = "/trust-quorum/network-config", - versions = VERSION_ADD_TRUST_QUORUM_STATUS.., }] async fn trust_quorum_network_config_get( request_context: RequestContext, @@ -1911,7 +1401,6 @@ pub trait SledAgentApi { #[endpoint { method = PUT, path = "/trust-quorum/network-config", - versions = VERSION_ADD_TRUST_QUORUM_STATUS.., }] async fn trust_quorum_network_config_put( request_context: RequestContext, @@ -1922,7 +1411,6 @@ pub trait SledAgentApi { #[endpoint { method = PUT, path = "/vmms/{propolis_id}/attached-subnets", - versions = VERSION_ADD_ATTACHED_SUBNETS.., }] async fn vmm_put_attached_subnets( request_context: RequestContext, @@ -1934,7 +1422,6 @@ pub trait SledAgentApi { #[endpoint { method = DELETE, path = "/vmms/{propolis_id}/attached-subnets", - versions = VERSION_ADD_ATTACHED_SUBNETS.., }] async fn vmm_delete_attached_subnets( request_context: RequestContext, @@ -1945,7 +1432,6 @@ pub trait SledAgentApi { #[endpoint { method = POST, path = "/vmms/{propolis_id}/attached-subnets", - versions = VERSION_ADD_ATTACHED_SUBNETS.., }] async fn vmm_post_attached_subnet( request_context: RequestContext, @@ -1957,7 +1443,6 @@ pub trait SledAgentApi { #[endpoint { method = DELETE, path = "/vmms/{propolis_id}/attached-subnets/{subnet}", - versions = VERSION_ADD_ATTACHED_SUBNETS.., }] async fn vmm_delete_attached_subnet( request_context: RequestContext, @@ -1968,7 +1453,6 @@ pub trait SledAgentApi { #[endpoint { method = GET, path = "/rot/{rot}/measurement-log", - versions = VERSION_ADD_ROT_ATTESTATION.., }] async fn rot_measurement_log( request_context: RequestContext, @@ -1979,7 +1463,6 @@ pub trait SledAgentApi { #[endpoint { method = GET, path = "/rot/{rot}/certificate-chain", - versions = VERSION_ADD_ROT_ATTESTATION.., }] async fn rot_certificate_chain( request_context: RequestContext, @@ -1990,7 +1473,6 @@ pub trait SledAgentApi { #[endpoint { method = POST, path = "/rot/{rot}/attest", - versions = VERSION_ADD_ROT_ATTESTATION.., }] async fn rot_attest( request_context: RequestContext, diff --git a/sled-agent/src/common/disk.rs b/sled-agent/src/common/disk.rs index cec63d745e6..56cbdf2e142 100644 --- a/sled-agent/src/common/disk.rs +++ b/sled-agent/src/common/disk.rs @@ -4,11 +4,6 @@ //! Describes the states of network-attached storage. -use chrono::Utc; -use omicron_common::api::external::DiskState; -use omicron_common::api::external::Error; -use omicron_common::api::internal::nexus::DiskRuntimeState; -use sled_agent_types::disk::DiskStateRequested; use uuid::Uuid; /// Action to be taken on behalf of state transition. @@ -18,171 +13,3 @@ pub enum Action { Detach(Uuid), Destroy, } - -/// The disk state is a combination of the last-known state, as well as an -/// "objective" state which the sled agent will work towards achieving. -#[derive(Clone, Debug)] -pub struct DiskStates { - current: DiskRuntimeState, - desired: Option, -} - -impl DiskStates { - pub fn new(current: DiskRuntimeState) -> Self { - DiskStates { current, desired: None } - } - - /// Returns the current disk state. - pub fn current(&self) -> &DiskRuntimeState { - &self.current - } - - /// Returns the desired disk state, if any exists. - pub fn desired(&self) -> &Option { - &self.desired - } - - /// Update the known state of a disk based on an observed state from - /// Propolis. - pub fn observe_transition( - &mut self, - observed: &DiskState, - ) -> Option { - self.transition(observed.clone(), None); - None - } - - /// Attempts to move from the current state to the requested "target" state. - /// - /// On success, returns the action, if any, which is necessary to carry - /// out this state transition. - pub fn request_transition( - &mut self, - target: &DiskStateRequested, - ) -> Result, Error> { - match target { - DiskStateRequested::Detached => self.request_detach(), - DiskStateRequested::Attached(uuid) => self.request_attach(*uuid), - DiskStateRequested::Destroyed => self.request_destroy(), - DiskStateRequested::Faulted => self.request_fault(), - } - } - - // Transitions to a new DiskState value, updating the timestamp and - // generation number. - // - // This transition always succeeds. - fn transition( - &mut self, - next: DiskState, - desired: Option, - ) { - // TODO: Deal with no-op transition? - self.current = DiskRuntimeState { - disk_state: next, - generation: self.current.generation.next(), - time_updated: Utc::now(), - }; - self.desired = desired; - } - - fn request_detach(&mut self) -> Result, Error> { - match self.current.disk_state { - // Already detached or can detach immediately. - DiskState::Creating | DiskState::Detached => { - self.transition(DiskState::Detached, None); - return Ok(None); - } - // Currently attached - enter detached through detaching. - DiskState::Attaching(uuid) - | DiskState::Attached(uuid) - | DiskState::Detaching(uuid) => { - self.transition( - DiskState::Detaching(uuid), - Some(DiskStateRequested::Detached), - ); - return Ok(Some(Action::Detach(uuid))); - } - // Cannot detach. - DiskState::Finalizing - | DiskState::Maintenance - | DiskState::ImportReady - | DiskState::ImportingFromUrl - | DiskState::ImportingFromBulkWrites - | DiskState::Destroyed - | DiskState::Faulted => { - return Err(Error::invalid_request(format!( - "cannot detach from {}", - self.current.disk_state - ))); - } - }; - } - - fn request_attach(&mut self, uuid: Uuid) -> Result, Error> { - match self.current.disk_state { - // Currently attached - only legal to attach to current ID - // (which is a no-op anyway). - DiskState::Attaching(id) | DiskState::Attached(id) => { - if uuid != id { - return Err(Error::invalid_request( - "disk is already attached", - )); - } - return Ok(None); - } - // Not attached - enter attached through attaching. - DiskState::Creating | DiskState::Detached => { - self.transition( - DiskState::Attaching(uuid), - Some(DiskStateRequested::Attached(uuid)), - ); - return Ok(Some(Action::Attach(uuid))); - } - // Cannot attach. - DiskState::Finalizing - | DiskState::Maintenance - | DiskState::ImportReady - | DiskState::ImportingFromUrl - | DiskState::ImportingFromBulkWrites - | DiskState::Detaching(_) - | DiskState::Destroyed - | DiskState::Faulted => { - return Err(Error::invalid_request(format!( - "cannot attach from {}", - self.current.disk_state - ))); - } - } - } - - fn request_destroy(&mut self) -> Result, Error> { - if self.current.disk_state.is_attached() { - let id = *self.current.disk_state.attached_instance_id().unwrap(); - self.transition( - DiskState::Detaching(id), - Some(DiskStateRequested::Destroyed), - ); - return Ok(Some(Action::Detach(id))); - } else { - self.transition(DiskState::Destroyed, None); - return Ok(Some(Action::Destroy)); - } - } - - fn request_fault(&mut self) -> Result, Error> { - if self.current.disk_state.is_attached() { - let id = *self.current.disk_state.attached_instance_id().unwrap(); - self.transition( - DiskState::Detaching(id), - Some(DiskStateRequested::Faulted), - ); - return Ok(Some(Action::Detach(id))); - } else { - self.transition(DiskState::Faulted, None); - // Unlike "destroy", no action necessary to identify that - // the attached disk is now faulted. - return Ok(None); - } - } -} diff --git a/sled-agent/src/fakes/nexus.rs b/sled-agent/src/fakes/nexus.rs index d267fda213c..de59fc28d80 100644 --- a/sled-agent/src/fakes/nexus.rs +++ b/sled-agent/src/fakes/nexus.rs @@ -18,8 +18,8 @@ use omicron_common::api::external::Error; use omicron_uuid_kinds::{OmicronZoneUuid, PropolisUuid, SledUuid}; use schemars::JsonSchema; use serde::Deserialize; +use sled_agent_types::instance::VmmPathParam; use sled_agent_types_versions::v1::instance::SledVmmState; -use sled_agent_types_versions::v1::instance::VmmPathParam; use transient_dns_server::TransientDnsServer; /// Implements a fake Nexus. diff --git a/sled-agent/src/http_entrypoints.rs b/sled-agent/src/http_entrypoints.rs index e9752232a91..ae06f1ea808 100644 --- a/sled-agent/src/http_entrypoints.rs +++ b/sled-agent/src/http_entrypoints.rs @@ -17,7 +17,6 @@ use dropshot::{ Query, RequestContext, StreamingBody, TypedBody, }; use omicron_common::api::external::Error; -use omicron_common::api::internal::nexus::DiskRuntimeState; use omicron_common::api::internal::shared::{ ExternalIpGatewayMap, ResolvedVpcRouteSet, ResolvedVpcRouteState, SledIdentifiers, VirtualNetworkInterfaceHost, @@ -40,7 +39,6 @@ use sled_agent_types::debug::OperatorSwitchZonePolicy; use sled_agent_types::diagnostics::{ SledDiagnosticsLogsDownloadPathParam, SledDiagnosticsLogsDownloadQueryParam, }; -use sled_agent_types::disk::{DiskEnsureBody, DiskPathParam}; use sled_agent_types::early_networking::EarlyNetworkConfigEnvelope; use sled_agent_types::firewall_rules::VpcFirewallRulesEnsureBody; use sled_agent_types::instance::SledVmmState; @@ -78,9 +76,7 @@ use trust_quorum_types::messages::{ use trust_quorum_types::status::{CommitStatus, CoordinatorStatus, NodeStatus}; // Fixed identifiers for prior versions only -use sled_agent_types_versions::{ - v1, v20, v25, v26, v30, v33, v39, v42, v47, v48, -}; +use sled_agent_types_versions::{v20, v25, v26, v30, v33, v39, v42, v47, v48}; use sled_diagnostics::{ SledDiagnosticsCommandHttpOutput, SledDiagnosticsQueryOutput, }; @@ -604,17 +600,6 @@ impl SledAgentApi for SledAgentImpl { .await } - async fn sled_role_get_v1( - rqctx: RequestContext, - ) -> Result, HttpError> { - let sa = rqctx.context(); - sa.latencies() - .instrument_dropshot_handler(&rqctx, async { - Ok(HttpResponseOk(sa.get_role())) - }) - .await - } - async fn vmm_register( rqctx: RequestContext, path_params: Path, @@ -740,29 +725,6 @@ impl SledAgentApi for SledAgentImpl { .await } - async fn disk_put( - rqctx: RequestContext, - path_params: Path, - body: TypedBody, - ) -> Result, HttpError> { - let sa = rqctx.context(); - let disk_id = path_params.into_inner().disk_id; - let body_args = body.into_inner(); - sa.latencies() - .instrument_dropshot_handler(&rqctx, async { - Ok(HttpResponseOk( - sa.disk_ensure( - disk_id, - body_args.initial_runtime.clone(), - body_args.target.clone(), - ) - .await - .map_err(|e| Error::from(e))?, - )) - }) - .await - } - async fn artifact_list( rqctx: RequestContext, ) -> Result, HttpError> { @@ -933,83 +895,6 @@ impl SledAgentApi for SledAgentImpl { .await } - async fn read_network_bootstore_config_cache( - rqctx: RequestContext, - ) -> Result< - HttpResponseOk, - HttpError, - > { - // This endpoint has been removed, so we're forever pinned to returning - // a `v20::early_networking::EarlyNetworkConfigBody`. If a new version - // of that type is added, we'll need to update this code to convert from - // the version we get back from `deserialize_from_bootstore()` into the - // v20 version we need. - // - // Use shorter names so rustfmt doesn't give up on this function. - use v20::early_networking::EarlyNetworkConfigBody as BodyV20; - use v26::early_networking::EarlyNetworkConfigBody as BodyV26; - use v30::early_networking::EarlyNetworkConfigBody as BodyV30; - use v33::system_networking::SystemNetworkingConfig as BodyV33; - use v39::system_networking::SystemNetworkingConfig as BodyV39; - use v42::system_networking::SystemNetworkingConfig as BodyV42; - use v47::system_networking::SystemNetworkingConfig as BodyV47; - type LatestEnvelope = EarlyNetworkConfigEnvelope; - - let sa = rqctx.context(); - sa.latencies() - .instrument_dropshot_handler(&rqctx, async { - let bs = sa.bootstore(); - - // It's a little awkward to create a new subscription - // (i.e., a new `watch::Receiver`) any time we receive this - // dropshot request, but this request is deprecated anyway so we - // don't expect it to be called in practice. - let config = bs.network_config_subscribe().borrow().clone(); - let config = match config { - Some(config) => { - let latest_version_body = - LatestEnvelope::deserialize_from_bootstore(&config) - .and_then(|envelope| { - envelope.deserialize_body() - }) - .map_err(|err| { - HttpError::for_internal_error(format!( - "failed to deserialize \ - early network config: {}", - InlineErrorChain::new(&err), - )) - })?; - let body_v42 = BodyV42::try_from(BodyV47::from( - latest_version_body, - )) - .map_err(|err| { - HttpError::for_internal_error(format!( - "failed to downconvert early network \ - config: {err:#}" - )) - })?; - let body = BodyV20::from(BodyV26::from(BodyV30::from( - BodyV33::from(BodyV39::from(body_v42)), - ))); - v20::early_networking::EarlyNetworkConfig { - generation: config.generation, - schema_version: BodyV20::SCHEMA_VERSION, - body, - } - } - None => { - return Err(HttpError::for_unavail( - None, - "early network config does not exist yet".into(), - )); - } - }; - - Ok(HttpResponseOk(config)) - }) - .await - } - async fn write_network_bootstore_config_v48( rqctx: RequestContext, body: TypedBody, @@ -1192,31 +1077,6 @@ impl SledAgentApi for SledAgentImpl { Ok(HttpResponseUpdatedNoContent()) } - // As explained in `sled-agent-api`, we must faithfully implement old - // versions of `write_network_bootstore_config()` _without_ upconverting the - // request into the latest bootstore `NetworkConfig` we understand. - async fn write_network_bootstore_config_v1( - rqctx: RequestContext, - body: TypedBody, - ) -> Result { - let sa = rqctx.context(); - let config = body.into_inner(); - sa.latencies() - .instrument_dropshot_handler(&rqctx, async { - let bs = sa.bootstore(); - bs.update_network_config(NetworkConfig::from(config)) - .await - .map_err(|e| { - HttpError::for_internal_error(format!( - "failed to write updated config to boot store: {}", - InlineErrorChain::new(&e) - )) - })?; - Ok(HttpResponseUpdatedNoContent()) - }) - .await - } - async fn sled_add( rqctx: RequestContext, body: TypedBody, @@ -1522,59 +1382,6 @@ impl SledAgentApi for SledAgentImpl { .await } - async fn chicken_switch_destroy_orphaned_datasets_get_v1( - request_context: RequestContext, - ) -> Result< - HttpResponseOk, - HttpError, - > { - let sa = request_context.context(); - sa.latencies() - .instrument_dropshot_handler(&request_context, async { - // This API has been removed, but we still provide an endpoint for - // backwards compatibility. Only `omdb` ever called this endpoint, so we - // could probably just always return an error, but we can at least - // attempt to do something reasonable. We've removed this chicken switch - // and always attempt to destroy orphans, so we can just claim the - // chicken switch is always in that state. - let destroy_orphans = true; - Ok(HttpResponseOk( - v1::debug::ChickenSwitchDestroyOrphanedDatasets { - destroy_orphans, - }, - )) - }) - .await - } - - async fn chicken_switch_destroy_orphaned_datasets_put_v1( - request_context: RequestContext, - body: TypedBody, - ) -> Result { - let sa = request_context.context(); - let v1::debug::ChickenSwitchDestroyOrphanedDatasets { destroy_orphans } = - body.into_inner(); - sa.latencies() - .instrument_dropshot_handler(&request_context, async { - // This API has been removed, but we still provide an endpoint for - // backwards compatibility. Only `omdb` ever called this endpoint, so we - // could probably just always return an error, but we can at least - // attempt to do something reasonable. We've removed this chicken switch - // and always attempt to destroy orphans, so we can treat requests to - // destroy orphans as successful and attempts to disable it as an error. - if destroy_orphans { - Ok(HttpResponseUpdatedNoContent()) - } else { - Err(HttpError::for_bad_request( - None, - "orphaned dataset destruction can no longer be disabled" - .to_string(), - )) - } - }) - .await - } - async fn debug_operator_switch_zone_policy_get( request_context: RequestContext, ) -> Result, HttpError> { diff --git a/sled-agent/src/sim/http_entrypoints.rs b/sled-agent/src/sim/http_entrypoints.rs index 1d513c37e4a..f8b9725466b 100644 --- a/sled-agent/src/sim/http_entrypoints.rs +++ b/sled-agent/src/sim/http_entrypoints.rs @@ -24,7 +24,6 @@ use dropshot::RequestContext; use dropshot::StreamingBody; use dropshot::TypedBody; use dropshot::endpoint; -use omicron_common::api::internal::nexus::DiskRuntimeState; use omicron_common::api::internal::shared::ExternalIpGatewayMap; use omicron_common::api::internal::shared::SledIdentifiers; use omicron_common::api::internal::shared::VirtualNetworkInterfaceHost; @@ -51,7 +50,6 @@ use sled_agent_types::debug::OperatorSwitchZonePolicy; use sled_agent_types::diagnostics::{ SledDiagnosticsLogsDownloadPathParam, SledDiagnosticsLogsDownloadQueryParam, }; -use sled_agent_types::disk::{DiskEnsureBody, DiskPathParam}; use sled_agent_types::early_networking::EarlyNetworkConfigEnvelope; use sled_agent_types::firewall_rules::VpcFirewallRulesEnsureBody; use sled_agent_types::instance::SledVmmState; @@ -80,9 +78,6 @@ use sled_agent_types::zone_bundle::{ BundleUtilization, CleanupContext, CleanupContextUpdate, CleanupCount, ZoneBundleFilter, ZoneBundleId, ZoneBundleMetadata, ZonePathParam, }; -use sled_hardware_types::BaseboardId; -// Fixed identifiers for prior versions only -use sled_agent_types_versions::v1; use sled_agent_types_versions::v20; use sled_agent_types_versions::v25; use sled_agent_types_versions::v26; @@ -93,7 +88,7 @@ use sled_agent_types_versions::v42; use sled_agent_types_versions::v47; use sled_agent_types_versions::v48; use sled_diagnostics::SledDiagnosticsQueryOutput; -use slog_error_chain::InlineErrorChain; +use sled_hardware_types::BaseboardId; use std::collections::BTreeMap; use std::sync::Arc; use trust_quorum_types::messages::{ @@ -243,24 +238,6 @@ impl SledAgentApi for SledAgentSimImpl { Ok(HttpResponseUpdatedNoContent()) } - async fn disk_put( - rqctx: RequestContext, - path_params: Path, - body: TypedBody, - ) -> Result, HttpError> { - let sa = rqctx.context(); - let disk_id = path_params.into_inner().disk_id; - let body_args = body.into_inner(); - Ok(HttpResponseOk( - sa.disk_ensure( - disk_id, - body_args.initial_runtime.clone(), - body_args.target.clone(), - ) - .await?, - )) - } - async fn artifact_config_get( rqctx: RequestContext, ) -> Result, HttpError> { @@ -393,60 +370,6 @@ impl SledAgentApi for SledAgentSimImpl { Ok(HttpResponseOk(vnics)) } - async fn read_network_bootstore_config_cache( - rqctx: RequestContext, - ) -> Result< - HttpResponseOk, - HttpError, - > { - // Read the current envelope, then convert it back down to the version - // we have to report for this (now-removed!) API endpoint. - use v20::early_networking::EarlyNetworkConfigBody as BodyV20; - use v26::early_networking::EarlyNetworkConfigBody as BodyV26; - use v30::early_networking::EarlyNetworkConfigBody as BodyV30; - use v33::system_networking::SystemNetworkingConfig as BodyV33; - use v39::system_networking::SystemNetworkingConfig as BodyV39; - use v42::system_networking::SystemNetworkingConfig as BodyV42; - use v47::system_networking::SystemNetworkingConfig as BodyV47; - - let config = - rqctx.context().bootstore_network_config.lock().unwrap().clone(); - - let envelope = - EarlyNetworkConfigEnvelope::deserialize_from_bootstore(&config) - .map_err(|err| { - HttpError::for_internal_error(format!( - "could not deserialize bootstore contents: {}", - InlineErrorChain::new(&err) - )) - })?; - let latest_version_body = - envelope.deserialize_body().map_err(|err| { - HttpError::for_internal_error(format!( - "could not deserialize early network config body: {}", - InlineErrorChain::new(&err) - )) - })?; - - // Downconvert from the current version to the v20 version we have to - // return from this endpoint. - let body_v42 = BodyV42::try_from(BodyV47::from(latest_version_body)) - .map_err(|err| { - HttpError::for_internal_error(format!( - "failed to downconvert early network config: {err:#}" - )) - })?; - let body = BodyV20::from(BodyV26::from(BodyV30::from(BodyV33::from( - BodyV39::from(body_v42), - )))); - - Ok(HttpResponseOk(v20::early_networking::EarlyNetworkConfig { - generation: config.generation, - schema_version: BodyV20::SCHEMA_VERSION, - body, - })) - } - async fn write_network_bootstore_config_v48( rqctx: RequestContext, body: TypedBody, @@ -564,19 +487,6 @@ impl SledAgentApi for SledAgentSimImpl { )) } - async fn write_network_bootstore_config_v1( - _rqctx: RequestContext, - _body: TypedBody, - ) -> Result { - // Real sled-agent has to support this endpoint for backwards - // compatibility during an update; sim-sled-agent doesn't. - Err(HttpError::for_bad_request( - None, - "old bootstore APIs not supported in simulated sled-agent" - .to_string(), - )) - } - /// Fetch basic information about this sled async fn inventory( rqctx: RequestContext, @@ -971,12 +881,6 @@ impl SledAgentApi for SledAgentSimImpl { method_unimplemented() } - async fn sled_role_get_v1( - _rqctx: RequestContext, - ) -> Result, HttpError> { - method_unimplemented() - } - async fn sled_identifiers( _rqctx: RequestContext, ) -> Result, HttpError> { @@ -1070,22 +974,6 @@ impl SledAgentApi for SledAgentSimImpl { method_unimplemented() } - async fn chicken_switch_destroy_orphaned_datasets_get_v1( - _request_context: RequestContext, - ) -> Result< - HttpResponseOk, - HttpError, - > { - method_unimplemented() - } - - async fn chicken_switch_destroy_orphaned_datasets_put_v1( - _request_context: RequestContext, - _body: TypedBody, - ) -> Result { - method_unimplemented() - } - async fn debug_operator_switch_zone_policy_get( _request_context: RequestContext, ) -> Result, HttpError> { diff --git a/sled-agent/src/sim/sled_agent.rs b/sled-agent/src/sim/sled_agent.rs index f2a62aba68d..02869ea4422 100644 --- a/sled-agent/src/sim/sled_agent.rs +++ b/sled-agent/src/sim/sled_agent.rs @@ -26,7 +26,6 @@ use dropshot::HttpError; use futures::Stream; use iddqd::IdOrdMap; use omicron_common::api::external::{ByteCount, Error, ResourceType}; -use omicron_common::api::internal::nexus::DiskRuntimeState; use omicron_common::api::internal::shared::{ ResolvedVpcRoute, ResolvedVpcRouteSet, ResolvedVpcRouteState, RouterId, RouterKind, RouterVersion, VirtualNetworkInterfaceHost, @@ -47,7 +46,6 @@ use sled_agent_health_monitor::HealthMonitorHandle; use sled_agent_types::attached_subnet::{AttachedSubnet, AttachedSubnets}; use sled_agent_types::dataset::LocalStorageDatasetEnsureRequest; use sled_agent_types::disk::DiskIdentity; -use sled_agent_types::disk::DiskStateRequested; use sled_agent_types::disk::DiskVariant; use sled_agent_types::early_networking::EarlyNetworkConfigEnvelope; use sled_agent_types::early_networking::PortConfig; @@ -570,15 +568,6 @@ impl SledAgent { Ok(()) } - pub async fn disk_ensure( - self: &Arc, - _disk_id: Uuid, - _initial_state: DiskRuntimeState, - _target: DiskStateRequested, - ) -> Result { - unimplemented!("Disk attachment not yet implemented"); - } - pub fn artifact_store(&self) -> &ArtifactStore { self.repo_depot.app_private() } diff --git a/sled-agent/src/sled_agent.rs b/sled-agent/src/sled_agent.rs index f354b6835a6..0e3db4b87a5 100644 --- a/sled-agent/src/sled_agent.rs +++ b/sled-agent/src/sled_agent.rs @@ -47,7 +47,6 @@ use omicron_common::address::{ Ipv6Subnet, SLED_PREFIX_LENGTH, get_sled_address, }; use omicron_common::api::external::{ByteCount, ByteCountRangeError, Vni}; -use omicron_common::api::internal::nexus::DiskRuntimeState; use omicron_common::api::internal::shared::DelegatedZvol; use omicron_common::api::internal::shared::{ ExternalIpGatewayMap, ResolvedVpcRouteSet, ResolvedVpcRouteState, @@ -78,7 +77,6 @@ use sled_agent_types::attached_subnet::AttachedSubnets; use sled_agent_types::dataset::LocalStorageDatasetDeleteRequest; use sled_agent_types::dataset::LocalStorageDatasetEnsureRequest; use sled_agent_types::disk::CompressionAlgorithm; -use sled_agent_types::disk::DiskStateRequested; use sled_agent_types::early_networking::EarlyNetworkConfigEnvelope; use sled_agent_types::instance::ResolvedVpcFirewallRule; use sled_agent_types::instance::{ @@ -1049,15 +1047,6 @@ impl SledAgent { self.inner.config_reconciler.set_sled_config(config).await } - /// Returns whether or not the sled believes itself to be a scrimlet - pub fn get_role(&self) -> SledRole { - if self.inner.hardware.is_scrimlet() { - SledRole::Scrimlet - } else { - SledRole::Gimlet - } - } - /// Idempotently ensures that a given instance is registered with this sled, /// i.e., that it can be addressed by future calls to /// [`Self::instance_ensure_state`]. @@ -1170,19 +1159,6 @@ impl SledAgent { .map_err(|e| Error::Instance(e)) } - /// Idempotently ensures that the given virtual disk is attached (or not) as - /// specified. - /// - /// NOTE: Not yet implemented. - pub async fn disk_ensure( - &self, - _disk_id: Uuid, - _initial_state: DiskRuntimeState, - _target: DiskStateRequested, - ) -> Result { - todo!("Disk attachment not yet implemented"); - } - pub fn artifact_store(&self) -> &ArtifactStore { &self.inner.repo_depot.app_private() } diff --git a/sled-agent/types/versions/src/add_attached_subnets/instance.rs b/sled-agent/types/versions/src/add_attached_subnets/instance.rs index e226b32374c..aabef85da32 100644 --- a/sled-agent/types/versions/src/add_attached_subnets/instance.rs +++ b/sled-agent/types/versions/src/add_attached_subnets/instance.rs @@ -69,20 +69,6 @@ pub struct InstanceSledLocalConfig { pub delegated_zvols: Vec, } -impl From for InstanceEnsureBody { - fn from(v17: v17::instance::InstanceEnsureBody) -> InstanceEnsureBody { - InstanceEnsureBody { - vmm_spec: v17.vmm_spec, - local_config: v17.local_config.into(), - vmm_runtime: v17.vmm_runtime, - instance_id: v17.instance_id, - migration_id: v17.migration_id, - propolis_addr: v17.propolis_addr, - metadata: v17.metadata, - } - } -} - impl From for InstanceSledLocalConfig { fn from( v17: v17::instance::InstanceSledLocalConfig, diff --git a/sled-agent/types/versions/src/add_dual_stack_external_ip_config/firewall_rules.rs b/sled-agent/types/versions/src/add_dual_stack_external_ip_config/firewall_rules.rs index 2ad8f868902..ebe29360686 100644 --- a/sled-agent/types/versions/src/add_dual_stack_external_ip_config/firewall_rules.rs +++ b/sled-agent/types/versions/src/add_dual_stack_external_ip_config/firewall_rules.rs @@ -4,8 +4,8 @@ //! Firewall rule types for version `ADD_DUAL_STACK_EXTERNAL_IP_CONFIG`. +use crate::v10; use crate::v10::instance::ResolvedVpcFirewallRule; -use crate::{v9, v10}; use omicron_common::api::external; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; @@ -28,18 +28,3 @@ impl TryFrom Ok(Self { vni: v10.vni, rules: v10.rules }) } } - -impl TryFrom - for VpcFirewallRulesEnsureBody -{ - type Error = external::Error; - - fn try_from( - v9: v9::firewall_rules::VpcFirewallRulesEnsureBody, - ) -> Result { - // Chain through v10 - let v10 = - v10::firewall_rules::VpcFirewallRulesEnsureBody::try_from(v9)?; - Self::try_from(v10) - } -} diff --git a/sled-agent/types/versions/src/add_dual_stack_external_ip_config/instance.rs b/sled-agent/types/versions/src/add_dual_stack_external_ip_config/instance.rs index 3b0cf0ce026..62d5d945f40 100644 --- a/sled-agent/types/versions/src/add_dual_stack_external_ip_config/instance.rs +++ b/sled-agent/types/versions/src/add_dual_stack_external_ip_config/instance.rs @@ -5,62 +5,26 @@ use std::net::IpAddr; use std::net::Ipv4Addr; use std::net::Ipv6Addr; -use std::net::SocketAddr; use itertools::Either; use itertools::Itertools; use omicron_common::api::external; use omicron_common::api::external::Hostname; use omicron_common::api::internal::shared::DhcpConfig; -use omicron_uuid_kinds::InstanceUuid; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use uuid::Uuid; use super::inventory::SourceNatConfig; use super::inventory::SourceNatConfigV4; use super::inventory::SourceNatConfigV6; use crate::impls::inventory::SourceNatConfigError; use crate::v1; -use crate::v1::instance::InstanceMetadata; -use crate::v1::instance::VmmRuntimeState; -use crate::v1::instance::VmmSpec; use crate::v7::instance::InstanceMulticastMembership; use crate::v9::instance::DelegatedZvol; use crate::v10; use crate::v10::instance::ResolvedVpcFirewallRule; use crate::v10::inventory::NetworkInterface; -/// The body of a request to ensure that a instance and VMM are known to a sled -/// agent. -#[derive(Serialize, Deserialize, JsonSchema)] -pub struct InstanceEnsureBody { - /// The virtual hardware configuration this virtual machine should have when - /// it is started. - pub vmm_spec: VmmSpec, - - /// Information about the sled-local configuration that needs to be - /// established to make the VM's virtual hardware fully functional. - pub local_config: InstanceSledLocalConfig, - - /// The initial VMM runtime state for the VMM being registered. - pub vmm_runtime: VmmRuntimeState, - - /// The ID of the instance for which this VMM is being created. - pub instance_id: InstanceUuid, - - /// The ID of the migration in to this VMM, if this VMM is being - /// ensured is part of a migration in. If this is `None`, the VMM is not - /// being created due to a migration. - pub migration_id: Option, - - /// The address at which this VMM should serve a Propolis server API. - pub propolis_addr: SocketAddr, - - /// Metadata used to track instance statistics. - pub metadata: InstanceMetadata, -} - /// Describes sled-local configuration that a sled-agent must establish to make /// the instance's virtual hardware fully functional. #[derive(Clone, Debug, Serialize, Deserialize, JsonSchema)] @@ -74,24 +38,6 @@ pub struct InstanceSledLocalConfig { pub delegated_zvols: Vec, } -impl TryFrom for InstanceEnsureBody { - type Error = external::Error; - - fn try_from( - v10: v10::instance::InstanceEnsureBody, - ) -> Result { - Ok(Self { - vmm_spec: v10.vmm_spec, - local_config: v10.local_config.try_into()?, - vmm_runtime: v10.vmm_runtime, - instance_id: v10.instance_id, - migration_id: v10.migration_id, - propolis_addr: v10.propolis_addr, - metadata: v10.metadata, - }) - } -} - impl TryFrom for InstanceSledLocalConfig { diff --git a/sled-agent/types/versions/src/add_dual_stack_external_ip_config/inventory.rs b/sled-agent/types/versions/src/add_dual_stack_external_ip_config/inventory.rs index 589338430f9..74d29d33c65 100644 --- a/sled-agent/types/versions/src/add_dual_stack_external_ip_config/inventory.rs +++ b/sled-agent/types/versions/src/add_dual_stack_external_ip_config/inventory.rs @@ -12,12 +12,10 @@ use iddqd::IdOrdMap; use iddqd::id_upcast; use omicron_common::{ address::{Ip, NUM_SOURCE_NAT_PORTS}, - api::external::ByteCount, zpool_name::ZpoolName, }; use omicron_generation_kinds::Generation; use omicron_ledger::Ledgerable; -use omicron_uuid_kinds::SledUuid; use omicron_uuid_kinds::{DatasetUuid, OmicronZoneUuid}; use omicron_uuid_kinds::{MupdateOverrideUuid, PhysicalDiskUuid}; use schemars::JsonSchema; @@ -26,36 +24,13 @@ use serde::{Deserialize, Serialize}; use crate::impls::inventory::SourceNatConfigError; use crate::v1::disk::DatasetConfig; use crate::v1::disk::OmicronPhysicalDiskConfig; -use crate::v1::inventory::Baseboard; use crate::v1::inventory::{ BootPartitionContents, ConfigReconcilerInventoryResult, - HostPhase2DesiredSlots, InventoryDataset, InventoryDisk, InventoryZpool, - OmicronZoneDataset, OmicronZoneImageSource, OrphanedDataset, - RemoveMupdateOverrideInventory, SledRole, ZoneImageResolverInventory, + HostPhase2DesiredSlots, OmicronZoneDataset, OmicronZoneImageSource, + OrphanedDataset, RemoveMupdateOverrideInventory, }; use crate::v10; use crate::v10::inventory::NetworkInterface; -use sled_hardware_types::SledCpuFamily; - -/// Identity and basic status information about this sled agent -#[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] -pub struct Inventory { - pub sled_id: SledUuid, - pub sled_agent_address: SocketAddrV6, - pub sled_role: SledRole, - pub baseboard: Baseboard, - pub usable_hardware_threads: u32, - pub usable_physical_ram: ByteCount, - pub cpu_family: SledCpuFamily, - pub reservoir_size: ByteCount, - pub disks: Vec, - pub zpools: Vec, - pub datasets: Vec, - pub ledgered_sled_config: Option, - pub reconciler_status: ConfigReconcilerInventoryStatus, - pub last_reconciliation: Option, - pub zone_image_resolver: ZoneImageResolverInventory, -} /// Describes the last attempt made by the sled-agent-config-reconciler to /// reconcile the current sled config against the actual state of the sled. @@ -291,36 +266,6 @@ fn default_nexus_lockstep_port() -> u16 { use omicron_common::api::external; -impl TryFrom for Inventory { - type Error = external::Error; - - fn try_from(v10: v10::inventory::Inventory) -> Result { - Ok(Self { - sled_id: v10.sled_id, - sled_agent_address: v10.sled_agent_address, - sled_role: v10.sled_role, - baseboard: v10.baseboard, - usable_hardware_threads: v10.usable_hardware_threads, - usable_physical_ram: v10.usable_physical_ram, - cpu_family: v10.cpu_family, - reservoir_size: v10.reservoir_size, - disks: v10.disks, - zpools: v10.zpools, - datasets: v10.datasets, - ledgered_sled_config: v10 - .ledgered_sled_config - .map(TryInto::try_into) - .transpose()?, - reconciler_status: v10.reconciler_status.try_into()?, - last_reconciliation: v10 - .last_reconciliation - .map(TryInto::try_into) - .transpose()?, - zone_image_resolver: v10.zone_image_resolver, - }) - } -} - impl TryFrom for OmicronSledConfig { type Error = external::Error; @@ -527,37 +472,6 @@ impl TryFrom for OmicronZonesConfig { } } -// Conversions from v11 to v10 for response types -impl TryFrom for v10::inventory::Inventory { - type Error = external::Error; - - fn try_from(v11: Inventory) -> Result { - Ok(Self { - sled_id: v11.sled_id, - sled_agent_address: v11.sled_agent_address, - sled_role: v11.sled_role, - baseboard: v11.baseboard, - usable_hardware_threads: v11.usable_hardware_threads, - usable_physical_ram: v11.usable_physical_ram, - cpu_family: v11.cpu_family, - reservoir_size: v11.reservoir_size, - disks: v11.disks, - zpools: v11.zpools, - datasets: v11.datasets, - ledgered_sled_config: v11 - .ledgered_sled_config - .map(TryInto::try_into) - .transpose()?, - reconciler_status: v11.reconciler_status.try_into()?, - last_reconciliation: v11 - .last_reconciliation - .map(TryInto::try_into) - .transpose()?, - zone_image_resolver: v11.zone_image_resolver, - }) - } -} - impl TryFrom for v10::inventory::OmicronSledConfig { type Error = external::Error; diff --git a/sled-agent/types/versions/src/add_dual_stack_shared_network_interfaces/firewall_rules.rs b/sled-agent/types/versions/src/add_dual_stack_shared_network_interfaces/firewall_rules.rs index df5e46b6e71..6ab8ab9121f 100644 --- a/sled-agent/types/versions/src/add_dual_stack_shared_network_interfaces/firewall_rules.rs +++ b/sled-agent/types/versions/src/add_dual_stack_shared_network_interfaces/firewall_rules.rs @@ -4,7 +4,6 @@ //! Firewall rule types for version `ADD_DUAL_STACK_SHARED_NETWORK_INTERFACES`. -use crate::v9; use crate::v10::instance::ResolvedVpcFirewallRule; use omicron_common::api::external; use schemars::JsonSchema; @@ -16,22 +15,3 @@ pub struct VpcFirewallRulesEnsureBody { pub vni: external::Vni, pub rules: Vec, } - -impl TryFrom - for VpcFirewallRulesEnsureBody -{ - type Error = external::Error; - - fn try_from( - v9: v9::firewall_rules::VpcFirewallRulesEnsureBody, - ) -> Result { - Ok(Self { - vni: v9.vni, - rules: v9 - .rules - .into_iter() - .map(TryInto::try_into) - .collect::>()?, - }) - } -} diff --git a/sled-agent/types/versions/src/add_dual_stack_shared_network_interfaces/instance.rs b/sled-agent/types/versions/src/add_dual_stack_shared_network_interfaces/instance.rs index 16c08c4aece..0b37264b529 100644 --- a/sled-agent/types/versions/src/add_dual_stack_shared_network_interfaces/instance.rs +++ b/sled-agent/types/versions/src/add_dual_stack_shared_network_interfaces/instance.rs @@ -3,21 +3,16 @@ // file, You can obtain one at https://mozilla.org/MPL/2.0/. use std::collections::HashSet; -use std::net::{IpAddr, SocketAddr}; +use std::net::IpAddr; use omicron_common::api::external; use omicron_common::api::external::Hostname; use omicron_common::api::internal::nexus::HostIdentifier; use omicron_common::api::internal::shared::DhcpConfig; -use omicron_uuid_kinds::InstanceUuid; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use uuid::Uuid; use super::inventory::NetworkInterface; -use crate::v1::instance::InstanceMetadata; -use crate::v1::instance::VmmRuntimeState; -use crate::v1::instance::VmmSpec; use crate::v1::inventory::SourceNatConfig; use crate::v7::instance::InstanceMulticastMembership; use crate::v9; @@ -66,36 +61,6 @@ pub struct ResolvedVpcFirewallRule { pub priority: external::VpcFirewallRulePriority, } -/// The body of a request to ensure that a instance and VMM are known to a sled -/// agent. -#[derive(Serialize, Deserialize, JsonSchema)] -pub struct InstanceEnsureBody { - /// The virtual hardware configuration this virtual machine should have when - /// it is started. - pub vmm_spec: VmmSpec, - - /// Information about the sled-local configuration that needs to be - /// established to make the VM's virtual hardware fully functional. - pub local_config: InstanceSledLocalConfig, - - /// The initial VMM runtime state for the VMM being registered. - pub vmm_runtime: VmmRuntimeState, - - /// The ID of the instance for which this VMM is being created. - pub instance_id: InstanceUuid, - - /// The ID of the migration in to this VMM, if this VMM is being - /// ensured is part of a migration in. If this is `None`, the VMM is not - /// being created due to a migration. - pub migration_id: Option, - - /// The address at which this VMM should serve a Propolis server API. - pub propolis_addr: SocketAddr, - - /// Metadata used to track instance statistics. - pub metadata: InstanceMetadata, -} - /// Describes sled-local configuration that a sled-agent must establish to make /// the instance's virtual hardware fully functional. #[derive(Clone, Debug, Serialize, Deserialize, JsonSchema)] @@ -113,24 +78,6 @@ pub struct InstanceSledLocalConfig { pub delegated_zvols: Vec, } -impl TryFrom for InstanceEnsureBody { - type Error = external::Error; - - fn try_from( - v9: v9::instance::InstanceEnsureBody, - ) -> Result { - Ok(Self { - vmm_spec: v9.vmm_spec, - local_config: v9.local_config.try_into()?, - vmm_runtime: v9.vmm_runtime, - instance_id: v9.instance_id, - migration_id: v9.migration_id, - propolis_addr: v9.propolis_addr, - metadata: v9.metadata, - }) - } -} - impl TryFrom for InstanceSledLocalConfig { diff --git a/sled-agent/types/versions/src/add_dual_stack_shared_network_interfaces/inventory.rs b/sled-agent/types/versions/src/add_dual_stack_shared_network_interfaces/inventory.rs index 7b4aea3b060..57561af3b11 100644 --- a/sled-agent/types/versions/src/add_dual_stack_shared_network_interfaces/inventory.rs +++ b/sled-agent/types/versions/src/add_dual_stack_shared_network_interfaces/inventory.rs @@ -6,7 +6,6 @@ use std::collections::BTreeMap; use std::net::{IpAddr, Ipv6Addr, SocketAddr, SocketAddrV6}; use std::time::Duration; -use crate::v1::inventory::Baseboard; use chrono::{DateTime, Utc}; use iddqd::IdOrdItem; use iddqd::IdOrdMap; @@ -15,51 +14,28 @@ use omicron_common::api::internal::shared::PrivateIpConfig; use omicron_common::api::internal::shared::PrivateIpv4Config; use omicron_common::api::internal::shared::PrivateIpv6Config; use omicron_common::{ - api::external::{self, ByteCount, Name, Vni}, + api::external::{self, Name, Vni}, zpool_name::ZpoolName, }; use omicron_generation_kinds::Generation; use omicron_ledger::Ledgerable; -use omicron_uuid_kinds::SledUuid; use omicron_uuid_kinds::{DatasetUuid, OmicronZoneUuid}; use omicron_uuid_kinds::{MupdateOverrideUuid, PhysicalDiskUuid}; use oxnet::IpNet; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use sled_hardware_types::SledCpuFamily; use uuid::Uuid; use crate::v1::disk::DatasetConfig; use crate::v1::disk::OmicronPhysicalDiskConfig; use crate::v1::inventory::{ BootPartitionContents, ConfigReconcilerInventoryResult, - HostPhase2DesiredSlots, InventoryDataset, InventoryDisk, InventoryZpool, - NetworkInterfaceKind, OmicronZoneDataset, OmicronZoneImageSource, - OrphanedDataset, RemoveMupdateOverrideInventory, SledRole, SourceNatConfig, - ZoneImageResolverInventory, + HostPhase2DesiredSlots, NetworkInterfaceKind, OmicronZoneDataset, + OmicronZoneImageSource, OrphanedDataset, RemoveMupdateOverrideInventory, + SourceNatConfig, }; use crate::v4; -/// Identity and basic status information about this sled agent -#[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] -pub struct Inventory { - pub sled_id: SledUuid, - pub sled_agent_address: SocketAddrV6, - pub sled_role: SledRole, - pub baseboard: Baseboard, - pub usable_hardware_threads: u32, - pub usable_physical_ram: ByteCount, - pub cpu_family: SledCpuFamily, - pub reservoir_size: ByteCount, - pub disks: Vec, - pub zpools: Vec, - pub datasets: Vec, - pub ledgered_sled_config: Option, - pub reconciler_status: ConfigReconcilerInventoryStatus, - pub last_reconciliation: Option, - pub zone_image_resolver: ZoneImageResolverInventory, -} - /// Describes the last attempt made by the sled-agent-config-reconciler to /// reconcile the current sled config against the actual state of the sled. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, JsonSchema, Serialize)] @@ -292,55 +268,6 @@ fn default_nexus_lockstep_port() -> u16 { omicron_common::address::NEXUS_LOCKSTEP_PORT } -impl TryFrom for v4::inventory::Inventory { - type Error = external::Error; - - fn try_from(value: Inventory) -> Result { - let ledgered_sled_config = - value.ledgered_sled_config.map(TryInto::try_into).transpose()?; - let reconciler_status = value.reconciler_status.try_into()?; - let last_reconciliation = - value.last_reconciliation.map(TryInto::try_into).transpose()?; - Ok(Self { - sled_id: value.sled_id, - sled_agent_address: value.sled_agent_address, - sled_role: value.sled_role, - baseboard: value.baseboard, - usable_hardware_threads: value.usable_hardware_threads, - usable_physical_ram: value.usable_physical_ram, - cpu_family: value.cpu_family, - reservoir_size: value.reservoir_size, - disks: value.disks, - zpools: value.zpools, - datasets: value.datasets, - ledgered_sled_config, - reconciler_status, - last_reconciliation, - zone_image_resolver: value.zone_image_resolver, - }) - } -} - -impl TryFrom for v4::inventory::OmicronSledConfig { - type Error = external::Error; - - fn try_from(value: OmicronSledConfig) -> Result { - let zones = value - .zones - .into_iter() - .map(TryInto::try_into) - .collect::>()?; - Ok(Self { - generation: value.generation, - disks: value.disks, - datasets: value.datasets, - zones, - remove_mupdate_override: value.remove_mupdate_override, - host_phase_2: value.host_phase_2, - }) - } -} - impl TryFrom for v4::inventory::OmicronZoneConfig { type Error = external::Error; @@ -456,55 +383,8 @@ impl TryFrom for v4::inventory::OmicronZoneType { } } -impl TryFrom - for v4::inventory::ConfigReconcilerInventory -{ - type Error = external::Error; - - fn try_from(value: ConfigReconcilerInventory) -> Result { - Ok(Self { - last_reconciled_config: value.last_reconciled_config.try_into()?, - external_disks: value.external_disks, - datasets: value.datasets, - orphaned_datasets: value.orphaned_datasets, - zones: value.zones, - boot_partitions: value.boot_partitions, - remove_mupdate_override: value.remove_mupdate_override, - }) - } -} - -impl TryFrom - for v4::inventory::ConfigReconcilerInventoryStatus -{ - type Error = external::Error; - - fn try_from( - value: ConfigReconcilerInventoryStatus, - ) -> Result { - match value { - ConfigReconcilerInventoryStatus::NotYetRun => { - Ok(v4::inventory::ConfigReconcilerInventoryStatus::NotYetRun) - } - ConfigReconcilerInventoryStatus::Running { - config, - started_at, - running_for, - } => Ok(v4::inventory::ConfigReconcilerInventoryStatus::Running { - config: Box::new((*config).try_into()?), - started_at, - running_for, - }), - ConfigReconcilerInventoryStatus::Idle { completed_at, ran_for } => { - Ok(v4::inventory::ConfigReconcilerInventoryStatus::Idle { - completed_at, - ran_for, - }) - } - } - } -} - +// Required for the OmicronSledConfig conversion chain when reading old ledgered +// config impl TryFrom for OmicronSledConfig { type Error = external::Error; @@ -525,7 +405,6 @@ impl TryFrom for OmicronSledConfig { }) } } - impl TryFrom for OmicronZoneConfig { type Error = external::Error; diff --git a/sled-agent/types/versions/src/add_dual_stack_shared_network_interfaces/probes.rs b/sled-agent/types/versions/src/add_dual_stack_shared_network_interfaces/probes.rs index 45c44ce6a1c..99aaa3bdb89 100644 --- a/sled-agent/types/versions/src/add_dual_stack_shared_network_interfaces/probes.rs +++ b/sled-agent/types/versions/src/add_dual_stack_shared_network_interfaces/probes.rs @@ -96,15 +96,3 @@ impl From for IpKind { } } } - -impl TryFrom for ProbeSet { - type Error = ExternalError; - - fn try_from(v6: v6::probes::ProbeSet) -> Result { - v6.probes - .into_iter() - .map(TryInto::try_into) - .collect::>() - .map(|probes| Self { probes }) - } -} diff --git a/sled-agent/types/versions/src/add_health_monitor/inventory.rs b/sled-agent/types/versions/src/add_health_monitor/inventory.rs index 4a0aeee9c74..a99e426aa19 100644 --- a/sled-agent/types/versions/src/add_health_monitor/inventory.rs +++ b/sled-agent/types/versions/src/add_health_monitor/inventory.rs @@ -2,90 +2,18 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at https://mozilla.org/MPL/2.0/. -use crate::v1::inventory::Baseboard; use chrono::DateTime; use chrono::Utc; -use omicron_common::api::external::ByteCount; use omicron_common::snake_case_result; use omicron_common::snake_case_result::SnakeCaseResult; -use omicron_uuid_kinds::SledUuid; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use sled_hardware_types::SledCpuFamily; use std::fmt::Display; -use std::net::SocketAddrV6; -use crate::v1::inventory::InventoryDataset; -use crate::v1::inventory::InventoryDisk; -use crate::v1::inventory::InventoryZpool; -use crate::v1::inventory::SledRole; -use crate::v1::inventory::ZoneImageResolverInventory; -use crate::v11; pub use crate::v11::inventory::ConfigReconcilerInventory; pub use crate::v11::inventory::ConfigReconcilerInventoryStatus; pub use crate::v11::inventory::OmicronSledConfig; -/// Identity and basic status information about this sled agent -#[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] -pub struct Inventory { - pub sled_id: SledUuid, - pub sled_agent_address: SocketAddrV6, - pub sled_role: SledRole, - pub baseboard: Baseboard, - pub usable_hardware_threads: u32, - pub usable_physical_ram: ByteCount, - pub cpu_family: SledCpuFamily, - pub reservoir_size: ByteCount, - pub disks: Vec, - pub zpools: Vec, - pub datasets: Vec, - pub ledgered_sled_config: Option, - pub reconciler_status: ConfigReconcilerInventoryStatus, - pub last_reconciliation: Option, - pub zone_image_resolver: ZoneImageResolverInventory, - pub health_monitor: HealthMonitorInventory, -} - -impl From for v11::inventory::Inventory { - fn from(value: Inventory) -> Self { - let Inventory { - sled_id, - sled_agent_address, - sled_role, - baseboard, - usable_hardware_threads, - usable_physical_ram, - cpu_family, - reservoir_size, - disks, - zpools, - datasets, - ledgered_sled_config, - reconciler_status, - last_reconciliation, - zone_image_resolver, - health_monitor: _, - } = value; - Self { - sled_id, - sled_agent_address, - sled_role, - baseboard, - usable_hardware_threads, - usable_physical_ram, - cpu_family, - reservoir_size, - disks, - zpools, - datasets, - ledgered_sled_config, - reconciler_status, - last_reconciliation, - zone_image_resolver, - } - } -} - /// Fields of sled-agent inventory reported by the health monitor subsystem. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, JsonSchema, Serialize)] #[serde(rename_all = "snake_case")] diff --git a/sled-agent/types/versions/src/add_nexus_lockstep_port_to_inventory/inventory.rs b/sled-agent/types/versions/src/add_nexus_lockstep_port_to_inventory/inventory.rs index 432947b52d1..ff3389e0a15 100644 --- a/sled-agent/types/versions/src/add_nexus_lockstep_port_to_inventory/inventory.rs +++ b/sled-agent/types/versions/src/add_nexus_lockstep_port_to_inventory/inventory.rs @@ -2,7 +2,6 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at https://mozilla.org/MPL/2.0/. -use std::collections::BTreeMap; use std::net::{IpAddr, Ipv6Addr, SocketAddr, SocketAddrV6}; use std::time::Duration; @@ -11,47 +10,21 @@ use iddqd::IdOrdItem; use iddqd::IdOrdMap; use iddqd::id_upcast; use omicron_common::address::NEXUS_LOCKSTEP_PORT; -use omicron_common::api::external::ByteCount; use omicron_common::zpool_name::ZpoolName; use omicron_generation_kinds::Generation; use omicron_ledger::Ledgerable; -use omicron_uuid_kinds::{DatasetUuid, MupdateOverrideUuid, OmicronZoneUuid}; -use omicron_uuid_kinds::{PhysicalDiskUuid, SledUuid}; +use omicron_uuid_kinds::MupdateOverrideUuid; +use omicron_uuid_kinds::OmicronZoneUuid; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use crate::v1; use crate::v1::disk::DatasetConfig; use crate::v1::disk::OmicronPhysicalDiskConfig; -use crate::v1::inventory::Baseboard; use crate::v1::inventory::{ - BootPartitionContents, ConfigReconcilerInventoryResult, - HostPhase2DesiredSlots, InventoryDataset, InventoryDisk, InventoryZpool, - NetworkInterface, OmicronZoneDataset, OmicronZoneImageSource, - OrphanedDataset, RemoveMupdateOverrideInventory, SledRole, SourceNatConfig, - ZoneImageResolverInventory, + HostPhase2DesiredSlots, NetworkInterface, OmicronZoneDataset, + OmicronZoneImageSource, SourceNatConfig, }; -use sled_hardware_types::SledCpuFamily; - -/// Identity and basic status information about this sled agent -#[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] -pub struct Inventory { - pub sled_id: SledUuid, - pub sled_agent_address: SocketAddrV6, - pub sled_role: SledRole, - pub baseboard: Baseboard, - pub usable_hardware_threads: u32, - pub usable_physical_ram: ByteCount, - pub cpu_family: SledCpuFamily, - pub reservoir_size: ByteCount, - pub disks: Vec, - pub zpools: Vec, - pub datasets: Vec, - pub ledgered_sled_config: Option, - pub reconciler_status: ConfigReconcilerInventoryStatus, - pub last_reconciliation: Option, - pub zone_image_resolver: ZoneImageResolverInventory, -} /// Describes the set of Reconfigurator-managed configuration elements of a sled #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema, PartialEq, Eq)] @@ -226,24 +199,6 @@ fn default_nexus_lockstep_port() -> u16 { omicron_common::address::NEXUS_LOCKSTEP_PORT } -/// Describes the last attempt made by the sled-agent-config-reconciler to -/// reconcile the current sled config against the actual state of the sled. -#[derive(Clone, Debug, PartialEq, Eq, Deserialize, JsonSchema, Serialize)] -#[serde(rename_all = "snake_case")] -pub struct ConfigReconcilerInventory { - pub last_reconciled_config: OmicronSledConfig, - pub external_disks: - BTreeMap, - pub datasets: BTreeMap, - pub orphaned_datasets: IdOrdMap, - pub zones: BTreeMap, - pub boot_partitions: BootPartitionContents, - /// The result of removing the mupdate override file on disk. - /// - /// `None` if `remove_mupdate_override` was not provided in the sled config. - pub remove_mupdate_override: Option, -} - /// Status of the sled-agent-config-reconciler task. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, JsonSchema, Serialize)] #[serde(tag = "status", rename_all = "snake_case")] @@ -262,7 +217,7 @@ pub enum ConfigReconcilerInventoryStatus { /// /// This variant does not include the `OmicronSledConfig` used in the last /// attempt, because that's always available via - /// [`ConfigReconcilerInventory::last_reconciled_config`]. + /// `ConfigReconcilerInventory::last_reconciled_config`. Idle { completed_at: DateTime, ran_for: Duration }, } @@ -285,19 +240,6 @@ pub struct OmicronZonesConfig { pub zones: Vec, } -impl From for OmicronSledConfig { - fn from(value: v1::inventory::OmicronSledConfig) -> Self { - Self { - generation: value.generation, - disks: value.disks, - datasets: value.datasets, - zones: value.zones.into_iter().map(Into::into).collect(), - remove_mupdate_override: value.remove_mupdate_override, - host_phase_2: value.host_phase_2, - } - } -} - impl From for OmicronZoneConfig { fn from(value: v1::inventory::OmicronZoneConfig) -> Self { Self { @@ -391,41 +333,6 @@ impl From for OmicronZoneType { } } -impl From for v1::inventory::Inventory { - fn from(value: Inventory) -> Self { - Self { - sled_id: value.sled_id, - sled_agent_address: value.sled_agent_address, - sled_role: value.sled_role, - baseboard: value.baseboard, - usable_hardware_threads: value.usable_hardware_threads, - usable_physical_ram: value.usable_physical_ram, - cpu_family: value.cpu_family, - reservoir_size: value.reservoir_size, - disks: value.disks, - zpools: value.zpools, - datasets: value.datasets, - ledgered_sled_config: value.ledgered_sled_config.map(Into::into), - reconciler_status: value.reconciler_status.into(), - last_reconciliation: value.last_reconciliation.map(Into::into), - zone_image_resolver: value.zone_image_resolver, - } - } -} - -impl From for v1::inventory::OmicronSledConfig { - fn from(value: OmicronSledConfig) -> Self { - Self { - generation: value.generation, - disks: value.disks, - datasets: value.datasets, - zones: value.zones.into_iter().map(Into::into).collect(), - remove_mupdate_override: value.remove_mupdate_override, - host_phase_2: value.host_phase_2, - } - } -} - impl From for v1::inventory::OmicronZoneConfig { fn from(value: OmicronZoneConfig) -> Self { Self { @@ -513,41 +420,3 @@ impl From for v1::inventory::OmicronZoneType { } } } - -impl From - for v1::inventory::ConfigReconcilerInventory -{ - fn from(value: ConfigReconcilerInventory) -> Self { - Self { - last_reconciled_config: value.last_reconciled_config.into(), - external_disks: value.external_disks, - datasets: value.datasets, - orphaned_datasets: value.orphaned_datasets, - zones: value.zones, - boot_partitions: value.boot_partitions, - remove_mupdate_override: value.remove_mupdate_override, - } - } -} - -impl From - for v1::inventory::ConfigReconcilerInventoryStatus -{ - fn from(value: ConfigReconcilerInventoryStatus) -> Self { - match value { - ConfigReconcilerInventoryStatus::NotYetRun => Self::NotYetRun, - ConfigReconcilerInventoryStatus::Running { - config, - started_at, - running_for, - } => Self::Running { - config: Box::new((*config).into()), - started_at, - running_for, - }, - ConfigReconcilerInventoryStatus::Idle { completed_at, ran_for } => { - Self::Idle { completed_at, ran_for } - } - } - } -} diff --git a/sled-agent/types/versions/src/add_probe_put_endpoint/probes.rs b/sled-agent/types/versions/src/add_probe_put_endpoint/probes.rs index 8936c419000..1591fb82316 100644 --- a/sled-agent/types/versions/src/add_probe_put_endpoint/probes.rs +++ b/sled-agent/types/versions/src/add_probe_put_endpoint/probes.rs @@ -4,7 +4,6 @@ use crate::v1::inventory::NetworkInterface; use iddqd::IdHashItem; -use iddqd::IdHashMap; use iddqd::id_upcast; use omicron_uuid_kinds::ProbeUuid; use schemars::JsonSchema; @@ -54,10 +53,3 @@ pub enum IpKind { Ephemeral, Floating, } - -/// A set of probes that the target sled should run. -#[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] -pub struct ProbeSet { - /// The exact set of probes to run. - pub probes: IdHashMap, -} diff --git a/sled-agent/types/versions/src/bgp_v6/early_networking.rs b/sled-agent/types/versions/src/bgp_v6/early_networking.rs index 890c66bb1ee..60778b4dcf3 100644 --- a/sled-agent/types/versions/src/bgp_v6/early_networking.rs +++ b/sled-agent/types/versions/src/bgp_v6/early_networking.rs @@ -10,7 +10,6 @@ use oxnet::{IpNet, Ipv6Net}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use std::net::IpAddr; -use std::net::Ipv6Addr; use std::num::NonZeroU8; /// Network configuration required to bring up the control plane @@ -58,147 +57,6 @@ pub enum ConversionError { NotIpv4Net { field: String, net: oxnet::IpNet }, } -impl TryFrom for v1::EarlyNetworkConfig { - type Error = ConversionError; - - fn try_from(value: EarlyNetworkConfig) -> Result { - let rack_network_config = value - .body - .rack_network_config - .map(|v2_config| { - let ports = v2_config - .ports - .into_iter() - .map(|p| { - let bgp_peers = p - .bgp_peers - .into_iter() - .map(|peer| { - let addr = match peer.addr { - IpAddr::V4(v4) => Ok(v4), - other => { - let err = ConversionError::NotIpv4 { - field: "BgpPeerConfig.addr".into(), - addr: other, - }; - Err(err) - } - }?; - Ok(v1::BgpPeerConfig { - asn: peer.asn, - port: peer.port, - addr, - hold_time: peer.hold_time, - idle_hold_time: peer.idle_hold_time, - delay_open: peer.delay_open, - connect_retry: peer.connect_retry, - keepalive: peer.keepalive, - remote_asn: peer.remote_asn, - min_ttl: peer.min_ttl, - md5_auth_key: peer.md5_auth_key, - multi_exit_discriminator: peer - .multi_exit_discriminator, - communities: peer.communities, - local_pref: peer.local_pref, - enforce_first_as: peer.enforce_first_as, - allowed_import: peer.allowed_import, - allowed_export: peer.allowed_export, - vlan_id: peer.vlan_id, - }) - }) - .collect::, _>>()?; - - Ok(v1::PortConfig { - routes: p.routes, - addresses: p - .addresses - .into_iter() - .map(|a| v1::UplinkAddressConfig { - address: a.address.unwrap_or_else(|| { - IpNet::host_net(IpAddr::V6( - Ipv6Addr::UNSPECIFIED, - )) - }), - vlan_id: a.vlan_id, - }) - .collect(), - switch: p.switch, - port: p.port, - uplink_port_speed: p.uplink_port_speed, - uplink_port_fec: p.uplink_port_fec, - bgp_peers, - autoneg: p.autoneg, - lldp: p.lldp, - tx_eq: p.tx_eq, - }) - }) - .collect::, _>>()?; - - let infra_ip_first = match v2_config.infra_ip_first { - IpAddr::V4(ipv4_addr) => Ok(ipv4_addr), - _ => Err(ConversionError::NotIpv4 { - field: "RackNetworkConfig.infra_ip_first".into(), - addr: v2_config.infra_ip_first, - }), - }?; - - let infra_ip_last = match v2_config.infra_ip_last { - IpAddr::V4(ipv4_addr) => Ok(ipv4_addr), - _ => Err(ConversionError::NotIpv4 { - field: "RackNetworkConfig.infra_ip_last".into(), - addr: v2_config.infra_ip_last, - }), - }?; - - let mut bgp = vec![]; - - for bgp_config in v2_config.bgp { - let mut originate = vec![]; - - for prefix in bgp_config.originate { - match prefix { - IpNet::V4(ipv4_net) => { - originate.push(ipv4_net); - Ok(()) - } - _ => Err(ConversionError::NotIpv4Net { - field: "BgpConfig.originate".into(), - net: prefix, - }), - }? - } - let converted_config = v1::BgpConfig { - asn: bgp_config.asn, - originate, - shaper: bgp_config.shaper, - checker: bgp_config.checker, - }; - - bgp.push(converted_config); - } - - Ok(v1::RackNetworkConfig { - rack_subnet: v2_config.rack_subnet, - infra_ip_first, - infra_ip_last, - ports, - bgp, - bfd: v2_config.bfd, - }) - }) - .transpose()?; - - Ok(Self { - generation: value.generation, - schema_version: value.schema_version, - body: v1::EarlyNetworkConfigBody { - ntp_servers: value.body.ntp_servers, - rack_network_config, - }, - }) - } -} - /// This is the actual configuration of EarlyNetworking. /// /// We nest it below the "header" of `generation` and `schema_version` so that diff --git a/sled-agent/types/versions/src/bgp_v6/uplink.rs b/sled-agent/types/versions/src/bgp_v6/uplink.rs index 3146ae3cccc..7d0994bea9d 100644 --- a/sled-agent/types/versions/src/bgp_v6/uplink.rs +++ b/sled-agent/types/versions/src/bgp_v6/uplink.rs @@ -5,7 +5,6 @@ //! Uplink-related types for the Sled Agent API. use super::early_networking::UplinkAddressConfig; -use crate::v1; use crate::v1::early_networking::LldpPortConfig; use crate::v1::early_networking::TxEqConfig; use schemars::JsonSchema; @@ -17,12 +16,6 @@ pub struct SwitchPorts { pub uplinks: Vec, } -impl From for SwitchPorts { - fn from(value: v1::uplink::SwitchPorts) -> Self { - Self { uplinks: value.uplinks.into_iter().map(From::from).collect() } - } -} - #[derive(Clone, Debug, Deserialize, Serialize, PartialEq, JsonSchema)] pub struct HostPortConfig { /// Switchport to use for external connectivity @@ -36,14 +29,3 @@ pub struct HostPortConfig { pub tx_eq: Option, } - -impl From for HostPortConfig { - fn from(value: v1::uplink::HostPortConfig) -> Self { - Self { - port: value.port, - addrs: value.addrs.into_iter().map(From::from).collect(), - lldp: value.lldp, - tx_eq: value.tx_eq, - } - } -} diff --git a/sled-agent/types/versions/src/delegate_zvol_to_propolis/dataset.rs b/sled-agent/types/versions/src/delegate_zvol_to_propolis/dataset.rs deleted file mode 100644 index 6770c17b52a..00000000000 --- a/sled-agent/types/versions/src/delegate_zvol_to_propolis/dataset.rs +++ /dev/null @@ -1,25 +0,0 @@ -// This Source Code Form is subject to the terms of the Mozilla Public -// License, v. 2.0. If a copy of the MPL was not distributed with this -// file, You can obtain one at https://mozilla.org/MPL/2.0/. - -use omicron_common::api::external::ByteCount; -use omicron_uuid_kinds::{DatasetUuid, ExternalZpoolUuid}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -/// Path parameters for Local Storage dataset related requests. -#[derive(Serialize, Deserialize, JsonSchema)] -pub struct LocalStoragePathParam { - pub zpool_id: ExternalZpoolUuid, - pub dataset_id: DatasetUuid, -} - -/// Dataset and Volume details for a Local Storage dataset ensure request. -#[derive(Clone, Serialize, Deserialize, JsonSchema)] -pub struct LocalStorageDatasetEnsureRequest { - /// Size of the parent dataset - pub dataset_size: ByteCount, - - /// Size of the zvol - pub volume_size: ByteCount, -} diff --git a/sled-agent/types/versions/src/delegate_zvol_to_propolis/firewall_rules.rs b/sled-agent/types/versions/src/delegate_zvol_to_propolis/firewall_rules.rs deleted file mode 100644 index 07aaa064e4d..00000000000 --- a/sled-agent/types/versions/src/delegate_zvol_to_propolis/firewall_rules.rs +++ /dev/null @@ -1,18 +0,0 @@ -// This Source Code Form is subject to the terms of the Mozilla Public -// License, v. 2.0. If a copy of the MPL was not distributed with this -// file, You can obtain one at https://mozilla.org/MPL/2.0/. - -//! Firewall rule types added in version `DELEGATE_ZVOL_TO_PROPOLIS`. - -use omicron_common::api::external; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -use crate::v1::instance::ResolvedVpcFirewallRule; - -/// Update firewall rules for a VPC -#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema)] -pub struct VpcFirewallRulesEnsureBody { - pub vni: external::Vni, - pub rules: Vec, -} diff --git a/sled-agent/types/versions/src/delegate_zvol_to_propolis/instance.rs b/sled-agent/types/versions/src/delegate_zvol_to_propolis/instance.rs index d1cc7814b53..3964c92255d 100644 --- a/sled-agent/types/versions/src/delegate_zvol_to_propolis/instance.rs +++ b/sled-agent/types/versions/src/delegate_zvol_to_propolis/instance.rs @@ -2,56 +2,21 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at https://mozilla.org/MPL/2.0/. -use std::net::{IpAddr, SocketAddr}; +use std::net::IpAddr; use omicron_common::api::external::Hostname; use omicron_common::api::internal::shared::DhcpConfig; use omicron_uuid_kinds::DatasetUuid; use omicron_uuid_kinds::ExternalZpoolUuid; -use omicron_uuid_kinds::InstanceUuid; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use uuid::Uuid; -use crate::v1::instance::InstanceMetadata; use crate::v1::instance::ResolvedVpcFirewallRule; -use crate::v1::instance::VmmRuntimeState; -use crate::v1::instance::VmmSpec; use crate::v1::inventory::NetworkInterface; use crate::v1::inventory::SourceNatConfig; use crate::v7; use crate::v7::instance::InstanceMulticastMembership; -/// The body of a request to ensure that a instance and VMM are known to a sled -/// agent. -#[derive(Serialize, Deserialize, JsonSchema)] -pub struct InstanceEnsureBody { - /// The virtual hardware configuration this virtual machine should have when - /// it is started. - pub vmm_spec: VmmSpec, - - /// Information about the sled-local configuration that needs to be - /// established to make the VM's virtual hardware fully functional. - pub local_config: InstanceSledLocalConfig, - - /// The initial VMM runtime state for the VMM being registered. - pub vmm_runtime: VmmRuntimeState, - - /// The ID of the instance for which this VMM is being created. - pub instance_id: InstanceUuid, - - /// The ID of the migration in to this VMM, if this VMM is being - /// ensured is part of a migration in. If this is `None`, the VMM is not - /// being created due to a migration. - pub migration_id: Option, - - /// The address at which this VMM should serve a Propolis server API. - pub propolis_addr: SocketAddr, - - /// Metadata used to track instance statistics. - pub metadata: InstanceMetadata, -} - /// Describes sled-local configuration that a sled-agent must establish to make /// the instance's virtual hardware fully functional. /// @@ -80,20 +45,6 @@ pub enum DelegatedZvol { LocalStorage { zpool_id: ExternalZpoolUuid, dataset_id: DatasetUuid }, } -impl From for InstanceEnsureBody { - fn from(v7: v7::instance::InstanceEnsureBody) -> Self { - Self { - vmm_spec: v7.vmm_spec, - local_config: v7.local_config.into(), - vmm_runtime: v7.vmm_runtime, - instance_id: v7.instance_id, - migration_id: v7.migration_id, - propolis_addr: v7.propolis_addr, - metadata: v7.metadata, - } - } -} - impl From for InstanceSledLocalConfig { fn from(v7: v7::instance::InstanceSledLocalConfig) -> Self { Self { diff --git a/sled-agent/types/versions/src/delegate_zvol_to_propolis/mod.rs b/sled-agent/types/versions/src/delegate_zvol_to_propolis/mod.rs index 2e9bc097fc9..aea467d9d07 100644 --- a/sled-agent/types/versions/src/delegate_zvol_to_propolis/mod.rs +++ b/sled-agent/types/versions/src/delegate_zvol_to_propolis/mod.rs @@ -6,6 +6,4 @@ //! //! This version added support for delegating zvols to Propolis. -pub mod dataset; -pub mod firewall_rules; pub mod instance; diff --git a/sled-agent/types/versions/src/impls/disk.rs b/sled-agent/types/versions/src/impls/disk.rs index 64b39c3fa9a..6f205bc757f 100644 --- a/sled-agent/types/versions/src/impls/disk.rs +++ b/sled-agent/types/versions/src/impls/disk.rs @@ -3,7 +3,6 @@ // file, You can obtain one at https://mozilla.org/MPL/2.0/. use crate::latest::disk::CompressionAlgorithm; -use crate::latest::disk::DiskStateRequested; use crate::latest::disk::DiskVariant; use crate::latest::disk::GzipLevel; use crate::latest::disk::M2Slot; @@ -12,18 +11,6 @@ use omicron_common::zpool_name::ZpoolKind; use std::fmt; use std::str::FromStr; -impl DiskStateRequested { - /// Returns whether the requested state is attached to an Instance or not. - pub fn is_attached(&self) -> bool { - match self { - DiskStateRequested::Detached => false, - DiskStateRequested::Destroyed => false, - DiskStateRequested::Faulted => false, - DiskStateRequested::Attached(_) => true, - } - } -} - impl M2Slot { /// Flip from `A` to `B` or vice versa. pub fn toggled(self) -> Self { diff --git a/sled-agent/types/versions/src/initial/debug.rs b/sled-agent/types/versions/src/initial/debug.rs deleted file mode 100644 index e5f03c08391..00000000000 --- a/sled-agent/types/versions/src/initial/debug.rs +++ /dev/null @@ -1,18 +0,0 @@ -// This Source Code Form is subject to the terms of the Mozilla Public -// License, v. 2.0. If a copy of the MPL was not distributed with this -// file, You can obtain one at https://mozilla.org/MPL/2.0/. - -//! Debug/chicken-switch types for Sled Agent API v1. - -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -/// Chicken switch for orphaned dataset destruction. -/// -/// This type is used in both GET and PUT operations (in versions 1-2). -#[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] -pub struct ChickenSwitchDestroyOrphanedDatasets { - /// If true, sled-agent will attempt to destroy durable ZFS datasets that it - /// believes were associated with now-expunged Omicron zones. - pub destroy_orphans: bool, -} diff --git a/sled-agent/types/versions/src/initial/disk.rs b/sled-agent/types/versions/src/initial/disk.rs index e0bf329b346..23e3010f82a 100644 --- a/sled-agent/types/versions/src/initial/disk.rs +++ b/sled-agent/types/versions/src/initial/disk.rs @@ -7,20 +7,12 @@ use iddqd::IdOrdItem; use iddqd::id_upcast; use omicron_common::api::external::ByteCount; -use omicron_common::api::internal::nexus::DiskRuntimeState; use omicron_common::disk::DatasetName; use omicron_uuid_kinds::DatasetUuid; use omicron_uuid_kinds::PhysicalDiskUuid; use omicron_uuid_kinds::ZpoolUuid; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use uuid::Uuid; - -/// Path parameters for Disk requests. -#[derive(Deserialize, JsonSchema)] -pub struct DiskPathParam { - pub disk_id: Uuid, -} /// Information about a zpool. #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema, PartialEq)] @@ -47,26 +39,6 @@ pub enum DiskVariant { M2, } -/// Sent from to a sled agent to establish the runtime state of a Disk -#[derive(Serialize, Deserialize, JsonSchema)] -pub struct DiskEnsureBody { - /// Last runtime state of the Disk known to Nexus (used if the agent has - /// never seen this Disk before). - pub initial_runtime: DiskRuntimeState, - /// requested runtime state of the Disk - pub target: DiskStateRequested, -} - -/// Used to request a Disk state change -#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize, JsonSchema)] -#[serde(rename_all = "lowercase", tag = "state", content = "instance")] -pub enum DiskStateRequested { - Detached, - Attached(Uuid), - Destroyed, - Faulted, -} - /// Describes an M.2 slot, often in the context of writing a system image to /// it. #[derive( diff --git a/sled-agent/types/versions/src/initial/early_networking.rs b/sled-agent/types/versions/src/initial/early_networking.rs index 25f108dbff4..4ebf073c946 100644 --- a/sled-agent/types/versions/src/initial/early_networking.rs +++ b/sled-agent/types/versions/src/initial/early_networking.rs @@ -4,151 +4,10 @@ //! Types for network setup required to bring up the control plane. -use bootstore::schemes::v0 as bootstore; -use oxnet::{IpNet, Ipv4Net, Ipv6Net}; +use oxnet::IpNet; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use std::net::{IpAddr, Ipv4Addr}; - -/// Network configuration required to bring up the control plane -/// -/// The fields in this structure are those from -/// `RackInitializeRequest` necessary for use beyond RSS. -/// This is just for the initial rack configuration and cold boot purposes. -/// Updates come from Nexus. -#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema, PartialEq)] -pub struct EarlyNetworkConfig { - // The current generation number of data as stored in CRDB. - // The initial generation is set during RSS time and then only mutated - // by Nexus. - pub generation: u64, - - // Which version of the data structure do we have. This is to help with - // deserialization and conversion in future updates. - pub schema_version: u32, - - // The actual configuration details - pub body: EarlyNetworkConfigBody, -} - -impl From for bootstore::NetworkConfig { - fn from(value: EarlyNetworkConfig) -> Self { - // We're serializing in-memory; this can only fail if - // `EarlyNetworkConfig` contains types that can't be represented as - // JSON, which (a) should never happen and (b) we should catch - // immediately in tests. - let blob = serde_json::to_vec(&value) - .expect("EarlyNetworkConfig can always be serialized as JSON"); - - // Yes this is duplicated, but that seems fine. - let generation = value.generation; - - bootstore::NetworkConfig { generation, blob } - } -} - -/// This is the actual configuration of EarlyNetworking. -/// -/// We nest it below the "header" of `generation` and `schema_version` so that -/// we can perform partial deserialization of `EarlyNetworkConfig` to only read -/// the header and defer deserialization of the body once we know the schema -/// version. This is possible via the use of [`serde_json::value::RawValue`] in -/// future (post-v1) deserialization paths. -#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema, PartialEq)] -pub struct EarlyNetworkConfigBody { - /// The external NTP server addresses. - pub ntp_servers: Vec, - - // Rack network configuration as delivered from RSS or Nexus - pub rack_network_config: Option, -} - -/// Initial network configuration -#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, JsonSchema)] -pub struct RackNetworkConfig { - pub rack_subnet: Ipv6Net, - // TODO: #3591 Consider making infra-ip ranges implicit for uplinks - /// First ip address to be used for configuring network infrastructure - pub infra_ip_first: Ipv4Addr, - /// Last ip address to be used for configuring network infrastructure - pub infra_ip_last: Ipv4Addr, - /// Uplinks for connecting the rack to external networks - pub ports: Vec, - /// BGP configurations for connecting the rack to external networks - pub bgp: Vec, - /// BFD configuration for connecting the rack to external networks - #[serde(default)] - pub bfd: Vec, -} - -#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq, JsonSchema)] -pub struct BgpConfig { - /// The autonomous system number for the BGP configuration. - pub asn: u32, - /// The set of prefixes for the BGP router to originate. - pub originate: Vec, - - /// Shaper to apply to outgoing messages. - #[serde(default)] - pub shaper: Option, - - /// Checker to apply to incoming messages. - #[serde(default)] - pub checker: Option, -} - -#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq, JsonSchema)] -pub struct BgpPeerConfig { - /// The autonomous system number of the router the peer belongs to. - pub asn: u32, - /// Switch port the peer is reachable on. - pub port: String, - /// Address of the peer. Use `Ipv4Addr::UNSPECIFIED` to indicate an - /// unnumbered BGP session established over the interface specified by - /// `port`. - pub addr: Ipv4Addr, - /// How long to keep a session alive without a keepalive in seconds. - /// Defaults to 6. - pub hold_time: Option, - /// How long to keep a peer in idle after a state machine reset in seconds. - pub idle_hold_time: Option, - /// How long to delay sending open messages to a peer. In seconds. - pub delay_open: Option, - /// The interval in seconds between peer connection retry attempts. - pub connect_retry: Option, - /// The interval to send keepalive messages at. - pub keepalive: Option, - /// Require that a peer has a specified ASN. - #[serde(default)] - pub remote_asn: Option, - /// Require messages from a peer have a minimum IP time to live field. - #[serde(default)] - pub min_ttl: Option, - /// Use the given key for TCP-MD5 authentication with the peer. - #[serde(default)] - pub md5_auth_key: Option, - /// Apply the provided multi-exit discriminator (MED) updates sent to the peer. - #[serde(default)] - pub multi_exit_discriminator: Option, - /// Include the provided communities in updates sent to the peer. - #[serde(default)] - pub communities: Vec, - /// Apply a local preference to routes received from this peer. - #[serde(default)] - pub local_pref: Option, - /// Enforce that the first AS in paths received from this peer is the peer's AS. - #[serde(default)] - pub enforce_first_as: bool, - /// Define import policy for a peer. - #[serde(default)] - pub allowed_import: ImportExportPolicy, - /// Define export policy for a peer. - #[serde(default)] - pub allowed_export: ImportExportPolicy, - /// Associate a VLAN ID with a BGP peer session. - #[serde(default)] - pub vlan_id: Option, -} +use std::net::IpAddr; #[derive( Clone, Debug, Deserialize, Serialize, PartialEq, Eq, Hash, JsonSchema, @@ -262,31 +121,6 @@ pub struct TxEqConfig { pub post1: Option, } -#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq, JsonSchema)] -pub struct PortConfig { - /// The set of routes associated with this port. - pub routes: Vec, - /// This port's addresses and optional vlan IDs - pub addresses: Vec, - /// Switch the port belongs to. - pub switch: SwitchSlot, - /// Nmae of the port this config applies to. - pub port: String, - /// Port speed. - pub uplink_port_speed: LinkSpeed, - /// Port forward error correction type. - pub uplink_port_fec: Option, - /// BGP peers on this port - pub bgp_peers: Vec, - /// Whether or not to set autonegotiation - #[serde(default)] - pub autoneg: bool, - /// LLDP configuration for this port - pub lldp: Option, - /// TX-EQ configuration for this port - pub tx_eq: Option, -} - /// Identifies switch physical location #[derive( Clone, diff --git a/sled-agent/types/versions/src/initial/instance.rs b/sled-agent/types/versions/src/initial/instance.rs index 569485070a1..ade8c898f8a 100644 --- a/sled-agent/types/versions/src/initial/instance.rs +++ b/sled-agent/types/versions/src/initial/instance.rs @@ -13,7 +13,7 @@ use omicron_common::api::external::Hostname; use omicron_common::api::internal::nexus::HostIdentifier; use omicron_common::api::internal::shared::DhcpConfig; use omicron_generation_kinds::Generation; -use omicron_uuid_kinds::{InstanceUuid, PropolisUuid}; +use omicron_uuid_kinds::PropolisUuid; use propolis_api_types_versions::v1::instance_spec::InstanceSpec; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; @@ -141,36 +141,6 @@ pub enum MigrationState { Completed, } -/// The body of a request to ensure that a instance and VMM are known to a sled -/// agent. -#[derive(Serialize, Deserialize, JsonSchema)] -pub struct InstanceEnsureBody { - /// The virtual hardware configuration this virtual machine should have when - /// it is started. - pub vmm_spec: VmmSpec, - - /// Information about the sled-local configuration that needs to be - /// established to make the VM's virtual hardware fully functional. - pub local_config: InstanceSledLocalConfig, - - /// The initial VMM runtime state for the VMM being registered. - pub vmm_runtime: VmmRuntimeState, - - /// The ID of the instance for which this VMM is being created. - pub instance_id: InstanceUuid, - - /// The ID of the migration in to this VMM, if this VMM is being - /// ensured is part of a migration in. If this is `None`, the VMM is not - /// being created due to a migration. - pub migration_id: Option, - - /// The address at which this VMM should serve a Propolis server API. - pub propolis_addr: SocketAddr, - - /// Metadata used to track instance statistics. - pub metadata: InstanceMetadata, -} - /// Describes sled-local configuration that a sled-agent must establish to make /// the instance's virtual hardware fully functional. #[derive(Clone, Debug, Serialize, Deserialize, JsonSchema)] diff --git a/sled-agent/types/versions/src/initial/inventory.rs b/sled-agent/types/versions/src/initial/inventory.rs index be69e280d52..a04d29024d0 100644 --- a/sled-agent/types/versions/src/initial/inventory.rs +++ b/sled-agent/types/versions/src/initial/inventory.rs @@ -4,7 +4,6 @@ //! Inventory types for Sled Agent API versions 1-3. -use std::collections::BTreeMap; use std::net::{IpAddr, Ipv6Addr, SocketAddr, SocketAddrV6}; use std::time::Duration; @@ -27,7 +26,7 @@ use omicron_common::zpool_name::ZpoolName; use omicron_generation_kinds::Generation; use omicron_uuid_kinds::{ DatasetUuid, InternalZpoolUuid, MupdateOverrideUuid, OmicronZoneUuid, - PhysicalDiskUuid, SledUuid, ZpoolUuid, + ZpoolUuid, }; use oxnet::IpNet; use schemars::schema::{Schema, SchemaObject}; @@ -645,26 +644,6 @@ fn path_schema(generator: &mut SchemaGenerator) -> Schema { schema.into() } -/// Identity and basic status information about this sled agent -#[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] -pub struct Inventory { - pub sled_id: SledUuid, - pub sled_agent_address: SocketAddrV6, - pub sled_role: SledRole, - pub baseboard: Baseboard, - pub usable_hardware_threads: u32, - pub usable_physical_ram: ByteCount, - pub cpu_family: SledCpuFamily, - pub reservoir_size: ByteCount, - pub disks: Vec, - pub zpools: Vec, - pub datasets: Vec, - pub ledgered_sled_config: Option, - pub reconciler_status: ConfigReconcilerInventoryStatus, - pub last_reconciliation: Option, - pub zone_image_resolver: ZoneImageResolverInventory, -} - /// Describes the set of Reconfigurator-managed configuration elements of a sled #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema, PartialEq, Eq)] pub struct OmicronSledConfig { @@ -811,24 +790,6 @@ pub enum OmicronZoneType { }, } -/// Describes the last attempt made by the sled-agent-config-reconciler to -/// reconcile the current sled config against the actual state of the sled. -#[derive(Clone, Debug, PartialEq, Eq, Deserialize, JsonSchema, Serialize)] -#[serde(rename_all = "snake_case")] -pub struct ConfigReconcilerInventory { - pub last_reconciled_config: OmicronSledConfig, - pub external_disks: - BTreeMap, - pub datasets: BTreeMap, - pub orphaned_datasets: IdOrdMap, - pub zones: BTreeMap, - pub boot_partitions: BootPartitionContents, - /// The result of removing the mupdate override file on disk. - /// - /// `None` if `remove_mupdate_override` was not provided in the sled config. - pub remove_mupdate_override: Option, -} - /// Status of the sled-agent-config-reconciler task. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, JsonSchema, Serialize)] #[serde(tag = "status", rename_all = "snake_case")] @@ -847,29 +808,10 @@ pub enum ConfigReconcilerInventoryStatus { /// /// This variant does not include the `OmicronSledConfig` used in the last /// attempt, because that's always available via - /// [`ConfigReconcilerInventory::last_reconciled_config`]. + /// `ConfigReconcilerInventory::last_reconciled_config`. Idle { completed_at: DateTime, ran_for: Duration }, } -/// Describes the set of Omicron-managed zones running on a sled -#[derive( - Clone, Debug, Deserialize, Serialize, JsonSchema, PartialEq, Eq, Hash, -)] -pub struct OmicronZonesConfig { - /// generation number of this configuration - /// - /// This generation number is owned by the control plane (i.e., RSS or - /// Nexus, depending on whether RSS-to-Nexus handoff has happened). It - /// should not be bumped within Sled Agent. - /// - /// Sled Agent rejects attempts to set the configuration to a generation - /// older than the one it's currently running. - pub generation: Generation, - - /// list of running zones - pub zones: Vec, -} - /// An IP address and port range used for source NAT, i.e., making /// outbound network connections from guests or services. // Note that `Deserialize` is manually implemented; if you make any diff --git a/sled-agent/types/versions/src/initial/mod.rs b/sled-agent/types/versions/src/initial/mod.rs index f1d1d7e007a..675a1cd4e06 100644 --- a/sled-agent/types/versions/src/initial/mod.rs +++ b/sled-agent/types/versions/src/initial/mod.rs @@ -6,7 +6,6 @@ pub mod artifact; pub mod bootstore; -pub mod debug; pub mod diagnostics; pub mod disk; pub mod early_networking; @@ -14,5 +13,4 @@ pub mod instance; pub mod inventory; pub mod sled; pub mod support_bundle; -pub mod uplink; pub mod zone_bundle; diff --git a/sled-agent/types/versions/src/initial/uplink.rs b/sled-agent/types/versions/src/initial/uplink.rs deleted file mode 100644 index fb38e0f8fe7..00000000000 --- a/sled-agent/types/versions/src/initial/uplink.rs +++ /dev/null @@ -1,30 +0,0 @@ -// This Source Code Form is subject to the terms of the Mozilla Public -// License, v. 2.0. If a copy of the MPL was not distributed with this -// file, You can obtain one at https://mozilla.org/MPL/2.0/. - -//! Uplink-related types for the Sled Agent API. - -use super::early_networking::LldpPortConfig; -use super::early_networking::TxEqConfig; -use super::early_networking::UplinkAddressConfig; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -/// A set of switch uplinks. -#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema)] -pub struct SwitchPorts { - pub uplinks: Vec, -} - -#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, JsonSchema)] -pub struct HostPortConfig { - /// Switchport to use for external connectivity - pub port: String, - - /// IP Address and prefix (e.g., `192.168.0.1/16`) to apply to switchport - /// (must be in infra_ip pool). May also include an optional VLAN ID. - pub addrs: Vec, - - pub lldp: Option, - pub tx_eq: Option, -} diff --git a/sled-agent/types/versions/src/latest.rs b/sled-agent/types/versions/src/latest.rs index 7f4936b69b3..c1ae9af754d 100644 --- a/sled-agent/types/versions/src/latest.rs +++ b/sled-agent/types/versions/src/latest.rs @@ -27,14 +27,11 @@ pub mod bootstore { } pub mod dataset { - pub use crate::v9::dataset::LocalStoragePathParam; pub use crate::v17::dataset::LocalStorageDatasetDeleteRequest; pub use crate::v17::dataset::LocalStorageDatasetEnsureRequest; } pub mod debug { - pub use crate::v1::debug::ChickenSwitchDestroyOrphanedDatasets; - pub use crate::v3::debug::OperatorSwitchZonePolicy; } @@ -47,10 +44,7 @@ pub mod diagnostics { pub mod disk { pub use crate::v1::disk::CompressionAlgorithm; pub use crate::v1::disk::DatasetConfig; - pub use crate::v1::disk::DiskEnsureBody; pub use crate::v1::disk::DiskIdentity; - pub use crate::v1::disk::DiskPathParam; - pub use crate::v1::disk::DiskStateRequested; pub use crate::v1::disk::DiskVariant; pub use crate::v1::disk::GzipLevel; pub use crate::v1::disk::M2Slot; diff --git a/sled-agent/types/versions/src/measurement_proper_inventory/inventory.rs b/sled-agent/types/versions/src/measurement_proper_inventory/inventory.rs index 472d692c201..b03064a1ce9 100644 --- a/sled-agent/types/versions/src/measurement_proper_inventory/inventory.rs +++ b/sled-agent/types/versions/src/measurement_proper_inventory/inventory.rs @@ -2,104 +2,22 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at https://mozilla.org/MPL/2.0/. -use crate::v1::inventory::Baseboard; use camino::Utf8PathBuf; use iddqd::id_upcast; use iddqd::{IdOrdItem, IdOrdMap}; -use omicron_common::api::external; -use omicron_common::api::external::ByteCount; use omicron_uuid_kinds::PhysicalDiskUuid; -use omicron_uuid_kinds::SledUuid; use omicron_uuid_kinds::{DatasetUuid, OmicronZoneUuid}; use schemars::{ JsonSchema, SchemaGenerator, schema::Schema, schema::SchemaObject, }; use serde::{Deserialize, Serialize}; -use sled_hardware_types::SledCpuFamily; use std::collections::BTreeMap; -use std::net::SocketAddrV6; use crate::v1::inventory::{ - BootPartitionContents, ConfigReconcilerInventoryResult, InventoryDataset, - InventoryDisk, InventoryZpool, OrphanedDataset, - RemoveMupdateOverrideInventory, SledRole, + BootPartitionContents, ConfigReconcilerInventoryResult, OrphanedDataset, + RemoveMupdateOverrideInventory, }; -use crate::v14; -use crate::v14::inventory::{ - ConfigReconcilerInventoryStatus, HealthMonitorInventory, - OmicronFileSourceResolverInventory, OmicronSledConfig, - ReconciledSingleMeasurement, -}; - -/// Identity and basic status information about this sled agent -#[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] -pub struct Inventory { - pub sled_id: SledUuid, - pub sled_agent_address: SocketAddrV6, - pub sled_role: SledRole, - pub baseboard: Baseboard, - pub usable_hardware_threads: u32, - pub usable_physical_ram: ByteCount, - pub cpu_family: SledCpuFamily, - pub reservoir_size: ByteCount, - pub disks: Vec, - pub zpools: Vec, - pub datasets: Vec, - pub ledgered_sled_config: Option, - pub reconciler_status: ConfigReconcilerInventoryStatus, - pub last_reconciliation: Option, - pub file_source_resolver: OmicronFileSourceResolverInventory, - pub health_monitor: HealthMonitorInventory, - pub reference_measurements: IdOrdMap, -} - -impl TryFrom for v14::inventory::Inventory { - type Error = external::Error; - - fn try_from(value: Inventory) -> Result { - let measurements = value - .reference_measurements - .into_iter() - .map(|m| ReconciledSingleMeasurement { - file_name: m.path.file_name().unwrap_or("").to_string(), - path: m.path, - result: m.result, - }) - .collect(); - - let last_reconciliation = value.last_reconciliation.map(|v| { - v14::inventory::ConfigReconcilerInventory { - last_reconciled_config: v.last_reconciled_config, - external_disks: v.external_disks, - datasets: v.datasets, - orphaned_datasets: v.orphaned_datasets, - zones: v.zones, - boot_partitions: v.boot_partitions, - remove_mupdate_override: v.remove_mupdate_override, - measurements, - } - }); - - Ok(Self { - sled_id: value.sled_id, - sled_agent_address: value.sled_agent_address, - sled_role: value.sled_role, - baseboard: value.baseboard, - usable_hardware_threads: value.usable_hardware_threads, - usable_physical_ram: value.usable_physical_ram, - cpu_family: value.cpu_family, - reservoir_size: value.reservoir_size, - disks: value.disks, - zpools: value.zpools, - datasets: value.datasets, - ledgered_sled_config: value.ledgered_sled_config, - reconciler_status: value.reconciler_status, - last_reconciliation, - file_source_resolver: value.file_source_resolver, - health_monitor: value.health_monitor, - }) - } -} +use crate::v14::inventory::OmicronSledConfig; /// Describes the last attempt made by the sled-agent-config-reconciler to /// reconcile the current sled config against the actual state of the sled. diff --git a/sled-agent/types/versions/src/measurements/inventory.rs b/sled-agent/types/versions/src/measurements/inventory.rs index 4624398a02c..0ffb90f33c2 100644 --- a/sled-agent/types/versions/src/measurements/inventory.rs +++ b/sled-agent/types/versions/src/measurements/inventory.rs @@ -3,23 +3,18 @@ // file, You can obtain one at https://mozilla.org/MPL/2.0/. use std::collections::{BTreeMap, BTreeSet}; -use std::net::SocketAddrV6; -use crate::v1::inventory::Baseboard; use chrono::{DateTime, Utc}; use iddqd::IdOrdItem; use iddqd::IdOrdMap; use iddqd::id_upcast; use omicron_common::api::external; -use omicron_common::api::external::ByteCount; use omicron_generation_kinds::Generation; use omicron_ledger::Ledgerable; -use omicron_uuid_kinds::SledUuid; use omicron_uuid_kinds::{DatasetUuid, OmicronZoneUuid}; use omicron_uuid_kinds::{MupdateOverrideUuid, PhysicalDiskUuid}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use sled_hardware_types::SledCpuFamily; use std::time::Duration; use crate::v1; @@ -27,9 +22,8 @@ use crate::v1::disk::DatasetConfig; use crate::v1::disk::OmicronPhysicalDiskConfig; use crate::v1::inventory::{ BootPartitionContents, ConfigReconcilerInventoryResult, - HostPhase2DesiredSlots, InventoryDataset, InventoryDisk, InventoryZpool, - ManifestInventory, MupdateOverrideInventory, OrphanedDataset, - RemoveMupdateOverrideInventory, SledRole, + HostPhase2DesiredSlots, ManifestInventory, MupdateOverrideInventory, + OrphanedDataset, RemoveMupdateOverrideInventory, }; use crate::v11::inventory::OmicronZoneConfig; use crate::v12; @@ -40,58 +34,6 @@ use schemars::schema::{Schema, SchemaObject}; use std::fmt; use tufaceous_artifact::ArtifactHash; -/// Identity and basic status information about this sled agent -#[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] -pub struct Inventory { - pub sled_id: SledUuid, - pub sled_agent_address: SocketAddrV6, - pub sled_role: SledRole, - pub baseboard: Baseboard, - pub usable_hardware_threads: u32, - pub usable_physical_ram: ByteCount, - pub cpu_family: SledCpuFamily, - pub reservoir_size: ByteCount, - pub disks: Vec, - pub zpools: Vec, - pub datasets: Vec, - pub ledgered_sled_config: Option, - pub reconciler_status: ConfigReconcilerInventoryStatus, - pub last_reconciliation: Option, - pub file_source_resolver: OmicronFileSourceResolverInventory, - pub health_monitor: HealthMonitorInventory, -} - -impl TryFrom for v12::inventory::Inventory { - type Error = external::Error; - - fn try_from(value: Inventory) -> Result { - let ledgered_sled_config = - value.ledgered_sled_config.map(TryInto::try_into).transpose()?; - let last_reconciliation = - value.last_reconciliation.map(TryInto::try_into).transpose()?; - let zone_image_resolver = value.file_source_resolver.try_into()?; - let reconciler_status = value.reconciler_status.try_into()?; - Ok(Self { - sled_id: value.sled_id, - sled_agent_address: value.sled_agent_address, - sled_role: value.sled_role, - baseboard: value.baseboard, - usable_hardware_threads: value.usable_hardware_threads, - usable_physical_ram: value.usable_physical_ram, - cpu_family: value.cpu_family, - reservoir_size: value.reservoir_size, - disks: value.disks, - zpools: value.zpools, - datasets: value.datasets, - ledgered_sled_config, - reconciler_status, - last_reconciliation, - zone_image_resolver, - health_monitor: value.health_monitor, - }) - } -} - /// Inventory representation of zone image resolver and measurement resolver /// status and health. Previously known as `ZoneImageResolverInventory` #[derive(Clone, Debug, PartialEq, Eq, Deserialize, JsonSchema, Serialize)] diff --git a/sled-agent/types/versions/src/multicast_support/instance.rs b/sled-agent/types/versions/src/multicast_support/instance.rs index e2b53839dd1..17e877b5643 100644 --- a/sled-agent/types/versions/src/multicast_support/instance.rs +++ b/sled-agent/types/versions/src/multicast_support/instance.rs @@ -2,53 +2,18 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at https://mozilla.org/MPL/2.0/. -use std::net::{IpAddr, SocketAddr}; +use std::net::IpAddr; use omicron_common::api::external::Hostname; use omicron_common::api::internal::shared::DhcpConfig; -use omicron_uuid_kinds::InstanceUuid; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use uuid::Uuid; use crate::v1; -use crate::v1::instance::InstanceMetadata; use crate::v1::instance::ResolvedVpcFirewallRule; -use crate::v1::instance::VmmRuntimeState; -use crate::v1::instance::VmmSpec; use crate::v1::inventory::NetworkInterface; use crate::v1::inventory::SourceNatConfig; -/// The body of a request to ensure that a instance and VMM are known to a sled -/// agent. -#[derive(Serialize, Deserialize, JsonSchema)] -pub struct InstanceEnsureBody { - /// The virtual hardware configuration this virtual machine should have when - /// it is started. - pub vmm_spec: VmmSpec, - - /// Information about the sled-local configuration that needs to be - /// established to make the VM's virtual hardware fully functional. - pub local_config: InstanceSledLocalConfig, - - /// The initial VMM runtime state for the VMM being registered. - pub vmm_runtime: VmmRuntimeState, - - /// The ID of the instance for which this VMM is being created. - pub instance_id: InstanceUuid, - - /// The ID of the migration in to this VMM, if this VMM is being - /// ensured is part of a migration in. If this is `None`, the VMM is not - /// being created due to a migration. - pub migration_id: Option, - - /// The address at which this VMM should serve a Propolis server API. - pub propolis_addr: SocketAddr, - - /// Metadata used to track instance statistics. - pub metadata: InstanceMetadata, -} - /// Describes sled-local configuration that a sled-agent must establish to make /// the instance's virtual hardware fully functional. /// @@ -79,20 +44,6 @@ pub struct InstanceMulticastMembership { pub sources: Vec, } -impl From for InstanceEnsureBody { - fn from(v1: v1::instance::InstanceEnsureBody) -> Self { - Self { - vmm_spec: v1.vmm_spec, - local_config: v1.local_config.into(), - vmm_runtime: v1.vmm_runtime, - instance_id: v1.instance_id, - migration_id: v1.migration_id, - propolis_addr: v1.propolis_addr, - metadata: v1.metadata, - } - } -} - impl From for InstanceSledLocalConfig { fn from(v1: v1::instance::InstanceSledLocalConfig) -> Self { Self { diff --git a/sled-agent/types/versions/src/remove_health_monitor_keep_checks/inventory.rs b/sled-agent/types/versions/src/remove_health_monitor_keep_checks/inventory.rs index 63febe95421..9179c57e0e6 100644 --- a/sled-agent/types/versions/src/remove_health_monitor_keep_checks/inventory.rs +++ b/sled-agent/types/versions/src/remove_health_monitor_keep_checks/inventory.rs @@ -19,10 +19,8 @@ use crate::v1::inventory::InventoryZpool; use crate::v1::inventory::SledRole; use crate::v12::inventory::SvcsInMaintenanceResult; use crate::v14::inventory::ConfigReconcilerInventoryStatus; -use crate::v14::inventory::HealthMonitorInventory; use crate::v14::inventory::OmicronFileSourceResolverInventory; use crate::v14::inventory::OmicronSledConfig; -use crate::v16; use crate::v16::inventory::ConfigReconcilerInventory; use crate::v16::inventory::SingleMeasurementInventory; @@ -51,48 +49,3 @@ pub struct Inventory { pub smf_services_in_maintenance: Result, pub reference_measurements: IdOrdMap, } - -impl From for v16::inventory::Inventory { - fn from(value: Inventory) -> Self { - let Inventory { - sled_id, - sled_agent_address, - sled_role, - baseboard, - usable_hardware_threads, - usable_physical_ram, - cpu_family, - reservoir_size, - disks, - zpools, - datasets, - ledgered_sled_config, - reconciler_status, - last_reconciliation, - file_source_resolver, - smf_services_in_maintenance, - reference_measurements, - } = value; - Self { - sled_id, - sled_agent_address, - sled_role, - baseboard, - usable_hardware_threads, - usable_physical_ram, - cpu_family, - reservoir_size, - disks, - zpools, - datasets, - ledgered_sled_config, - reconciler_status, - last_reconciliation, - file_source_resolver, - health_monitor: HealthMonitorInventory { - smf_services_in_maintenance, - }, - reference_measurements, - } - } -} diff --git a/sled-agent/types/versions/src/two_types_of_delegated_zvol/dataset.rs b/sled-agent/types/versions/src/two_types_of_delegated_zvol/dataset.rs index b362691c1fa..ad84508471e 100644 --- a/sled-agent/types/versions/src/two_types_of_delegated_zvol/dataset.rs +++ b/sled-agent/types/versions/src/two_types_of_delegated_zvol/dataset.rs @@ -8,8 +8,6 @@ use omicron_uuid_kinds::ExternalZpoolUuid; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use crate::v9; - /// Dataset and Volume details for a Local Storage dataset ensure request. #[derive(Clone, Serialize, Deserialize, JsonSchema)] pub struct LocalStorageDatasetEnsureRequest { @@ -29,24 +27,6 @@ pub struct LocalStorageDatasetEnsureRequest { pub encrypted_at_rest: bool, } -impl LocalStorageDatasetEnsureRequest { - pub fn from( - zpool_id: ExternalZpoolUuid, - dataset_id: DatasetUuid, - v9: v9::dataset::LocalStorageDatasetEnsureRequest, - ) -> LocalStorageDatasetEnsureRequest { - LocalStorageDatasetEnsureRequest { - zpool_id, - dataset_id, - dataset_size: v9.dataset_size, - volume_size: v9.dataset_size, - // This version of the API assumed it would be using the encrypted - // dataset. - encrypted_at_rest: true, - } - } -} - /// Dataset details for a Local Storage dataset delete request. #[derive(Clone, Serialize, Deserialize, JsonSchema)] pub struct LocalStorageDatasetDeleteRequest { diff --git a/sled-agent/types/versions/src/two_types_of_delegated_zvol/instance.rs b/sled-agent/types/versions/src/two_types_of_delegated_zvol/instance.rs index 7624ebd4da6..2692c3e43e4 100644 --- a/sled-agent/types/versions/src/two_types_of_delegated_zvol/instance.rs +++ b/sled-agent/types/versions/src/two_types_of_delegated_zvol/instance.rs @@ -2,20 +2,13 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at https://mozilla.org/MPL/2.0/. -use std::net::SocketAddr; - use omicron_common::api::external::Hostname; use omicron_common::api::internal::shared::DelegatedZvol; use omicron_common::api::internal::shared::DhcpConfig; -use omicron_uuid_kinds::InstanceUuid; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use uuid::Uuid; -use crate::v1::instance::InstanceMetadata; -use crate::v1::instance::VmmRuntimeState; -use crate::v1::instance::VmmSpec; use crate::v7::instance::InstanceMulticastMembership; use crate::v9; use crate::v10::instance::ResolvedVpcFirewallRule; @@ -23,36 +16,6 @@ use crate::v10::inventory::NetworkInterface; use crate::v11; use crate::v11::instance::ExternalIpConfig; -/// The body of a request to ensure that a instance and VMM are known to a sled -/// agent. -#[derive(Serialize, Deserialize, JsonSchema)] -pub struct InstanceEnsureBody { - /// The virtual hardware configuration this virtual machine should have when - /// it is started. - pub vmm_spec: VmmSpec, - - /// Information about the sled-local configuration that needs to be - /// established to make the VM's virtual hardware fully functional. - pub local_config: InstanceSledLocalConfig, - - /// The initial VMM runtime state for the VMM being registered. - pub vmm_runtime: VmmRuntimeState, - - /// The ID of the instance for which this VMM is being created. - pub instance_id: InstanceUuid, - - /// The ID of the migration in to this VMM, if this VMM is being - /// ensured is part of a migration in. If this is `None`, the VMM is not - /// being created due to a migration. - pub migration_id: Option, - - /// The address at which this VMM should serve a Propolis server API. - pub propolis_addr: SocketAddr, - - /// Metadata used to track instance statistics. - pub metadata: InstanceMetadata, -} - /// Describes sled-local configuration that a sled-agent must establish to make /// the instance's virtual hardware fully functional. #[derive(Clone, Debug, Serialize, Deserialize, JsonSchema)] @@ -81,20 +44,6 @@ impl From for DelegatedZvol { } } -impl From for InstanceEnsureBody { - fn from(v11: v11::instance::InstanceEnsureBody) -> InstanceEnsureBody { - InstanceEnsureBody { - vmm_spec: v11.vmm_spec, - local_config: v11.local_config.into(), - vmm_runtime: v11.vmm_runtime, - instance_id: v11.instance_id, - migration_id: v11.migration_id, - propolis_addr: v11.propolis_addr, - metadata: v11.metadata, - } - } -} - impl From for InstanceSledLocalConfig { fn from( v11: v11::instance::InstanceSledLocalConfig, diff --git a/sled-agent/types/versions/src/typed_sled_config_generation/inventory.rs b/sled-agent/types/versions/src/typed_sled_config_generation/inventory.rs index 9e018e9b087..ad9bb01c51c 100644 --- a/sled-agent/types/versions/src/typed_sled_config_generation/inventory.rs +++ b/sled-agent/types/versions/src/typed_sled_config_generation/inventory.rs @@ -21,10 +21,11 @@ use std::net::SocketAddrV6; use std::time::Duration; use crate::v1::disk::{DatasetConfig, OmicronPhysicalDiskConfig}; +use crate::v1::inventory::SledRole; use crate::v1::inventory::{ BootPartitionContents, ConfigReconcilerInventoryResult, HostPhase2DesiredSlots, InventoryDataset, InventoryDisk, OrphanedDataset, - RemoveMupdateOverrideInventory, SledRole, + RemoveMupdateOverrideInventory, }; use crate::v11::inventory::OmicronZoneConfig; use crate::v14::inventory::{