diff --git a/Cargo.lock b/Cargo.lock index c3b09ce691c..2d7822a7bd7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -677,7 +677,7 @@ dependencies = [ [[package]] name = "bhyve_api" version = "0.0.0" -source = "git+https://github.com/oxidecomputer/propolis?rev=979b72896bc39a876c98fb32fe706da37a4fc408#979b72896bc39a876c98fb32fe706da37a4fc408" +source = "git+https://github.com/oxidecomputer/propolis?rev=046f74302e2ea09a75b0a6810645d42c7df6644a#046f74302e2ea09a75b0a6810645d42c7df6644a" dependencies = [ "bhyve_api_sys", "libc", @@ -687,7 +687,7 @@ dependencies = [ [[package]] name = "bhyve_api_sys" version = "0.0.0" -source = "git+https://github.com/oxidecomputer/propolis?rev=979b72896bc39a876c98fb32fe706da37a4fc408#979b72896bc39a876c98fb32fe706da37a4fc408" +source = "git+https://github.com/oxidecomputer/propolis?rev=046f74302e2ea09a75b0a6810645d42c7df6644a#046f74302e2ea09a75b0a6810645d42c7df6644a" dependencies = [ "libc", "strum 0.26.3", @@ -2188,7 +2188,7 @@ dependencies = [ [[package]] name = "crucible-agent-client" version = "0.0.1" -source = "git+https://github.com/oxidecomputer/crucible?rev=2bfe090eb5318ec8c467157018db2429d4df535b#2bfe090eb5318ec8c467157018db2429d4df535b" +source = "git+https://github.com/oxidecomputer/crucible?rev=ad8a31742adc45e925e63443a5b43c8e30604022#ad8a31742adc45e925e63443a5b43c8e30604022" dependencies = [ "anyhow", "chrono", @@ -2204,7 +2204,7 @@ dependencies = [ [[package]] name = "crucible-client-types" version = "0.1.0" -source = "git+https://github.com/oxidecomputer/crucible?rev=2bfe090eb5318ec8c467157018db2429d4df535b#2bfe090eb5318ec8c467157018db2429d4df535b" +source = "git+https://github.com/oxidecomputer/crucible?rev=ad8a31742adc45e925e63443a5b43c8e30604022#ad8a31742adc45e925e63443a5b43c8e30604022" dependencies = [ "base64 0.22.1", "crucible-workspace-hack", @@ -2217,7 +2217,7 @@ dependencies = [ [[package]] name = "crucible-common" version = "0.0.1" -source = "git+https://github.com/oxidecomputer/crucible?rev=2bfe090eb5318ec8c467157018db2429d4df535b#2bfe090eb5318ec8c467157018db2429d4df535b" +source = "git+https://github.com/oxidecomputer/crucible?rev=ad8a31742adc45e925e63443a5b43c8e30604022#ad8a31742adc45e925e63443a5b43c8e30604022" dependencies = [ "anyhow", "atty", @@ -2247,7 +2247,7 @@ dependencies = [ [[package]] name = "crucible-pantry-client" version = "0.0.1" -source = "git+https://github.com/oxidecomputer/crucible?rev=2bfe090eb5318ec8c467157018db2429d4df535b#2bfe090eb5318ec8c467157018db2429d4df535b" +source = "git+https://github.com/oxidecomputer/crucible?rev=ad8a31742adc45e925e63443a5b43c8e30604022#ad8a31742adc45e925e63443a5b43c8e30604022" dependencies = [ "anyhow", "chrono", @@ -2264,7 +2264,7 @@ dependencies = [ [[package]] name = "crucible-smf" version = "0.0.0" -source = "git+https://github.com/oxidecomputer/crucible?rev=2bfe090eb5318ec8c467157018db2429d4df535b#2bfe090eb5318ec8c467157018db2429d4df535b" +source = "git+https://github.com/oxidecomputer/crucible?rev=ad8a31742adc45e925e63443a5b43c8e30604022#ad8a31742adc45e925e63443a5b43c8e30604022" dependencies = [ "crucible-workspace-hack", "libc", @@ -11818,7 +11818,7 @@ dependencies = [ [[package]] name = "propolis-api-types-versions" version = "0.0.0" -source = "git+https://github.com/oxidecomputer/propolis?rev=979b72896bc39a876c98fb32fe706da37a4fc408#979b72896bc39a876c98fb32fe706da37a4fc408" +source = "git+https://github.com/oxidecomputer/propolis?rev=046f74302e2ea09a75b0a6810645d42c7df6644a#046f74302e2ea09a75b0a6810645d42c7df6644a" dependencies = [ "crucible-client-types", "propolis_types", @@ -11831,7 +11831,7 @@ dependencies = [ [[package]] name = "propolis-client" version = "0.1.0" -source = "git+https://github.com/oxidecomputer/propolis?rev=979b72896bc39a876c98fb32fe706da37a4fc408#979b72896bc39a876c98fb32fe706da37a4fc408" +source = "git+https://github.com/oxidecomputer/propolis?rev=046f74302e2ea09a75b0a6810645d42c7df6644a#046f74302e2ea09a75b0a6810645d42c7df6644a" dependencies = [ "async-trait", "base64 0.21.7", @@ -11855,10 +11855,9 @@ dependencies = [ [[package]] name = "propolis-mock-server" version = "0.0.0" -source = "git+https://github.com/oxidecomputer/propolis?rev=979b72896bc39a876c98fb32fe706da37a4fc408#979b72896bc39a876c98fb32fe706da37a4fc408" +source = "git+https://github.com/oxidecomputer/propolis?rev=046f74302e2ea09a75b0a6810645d42c7df6644a#046f74302e2ea09a75b0a6810645d42c7df6644a" dependencies = [ "anyhow", - "atty", "base64 0.21.7", "clap", "dropshot", @@ -11888,7 +11887,7 @@ dependencies = [ [[package]] name = "propolis_api_types" version = "0.0.0" -source = "git+https://github.com/oxidecomputer/propolis?rev=979b72896bc39a876c98fb32fe706da37a4fc408#979b72896bc39a876c98fb32fe706da37a4fc408" +source = "git+https://github.com/oxidecomputer/propolis?rev=046f74302e2ea09a75b0a6810645d42c7df6644a#046f74302e2ea09a75b0a6810645d42c7df6644a" dependencies = [ "crucible-client-types", "propolis-api-types-versions", @@ -11897,7 +11896,7 @@ dependencies = [ [[package]] name = "propolis_types" version = "0.0.0" -source = "git+https://github.com/oxidecomputer/propolis?rev=979b72896bc39a876c98fb32fe706da37a4fc408#979b72896bc39a876c98fb32fe706da37a4fc408" +source = "git+https://github.com/oxidecomputer/propolis?rev=046f74302e2ea09a75b0a6810645d42c7df6644a#046f74302e2ea09a75b0a6810645d42c7df6644a" dependencies = [ "schemars 0.8.22", "serde", @@ -11998,9 +11997,9 @@ dependencies = [ [[package]] name = "quinn" -version = "0.11.9" +version = "0.11.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e20a958963c291dc322d98411f541009df2ced7b5a4f2bd52337638cfccf20" +checksum = "0c1a41e437b6bbd489372cd4971de128e85c855f56c57f283d20ff016cf7c0a8" dependencies = [ "bytes", "cfg_aliases 0.2.1", @@ -12009,7 +12008,7 @@ dependencies = [ "quinn-udp", "rustc-hash", "rustls", - "socket2 0.6.3", + "socket2 0.5.10", "thiserror 2.0.18", "tokio", "tracing", diff --git a/Cargo.toml b/Cargo.toml index b05c6670915..9700a529812 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -489,11 +489,11 @@ crossterm = { version = "0.29.0", features = ["event-stream"] } # NOTE: if you change the pinned revision of the `crucible` dependencies, you # must also update the references in package-manifest.toml to match the new # revision. -crucible-agent-client = { git = "https://github.com/oxidecomputer/crucible", rev = "2bfe090eb5318ec8c467157018db2429d4df535b" } -crucible-pantry-client = { git = "https://github.com/oxidecomputer/crucible", rev = "2bfe090eb5318ec8c467157018db2429d4df535b" } -crucible-smf = { git = "https://github.com/oxidecomputer/crucible", rev = "2bfe090eb5318ec8c467157018db2429d4df535b" } -crucible-common = { git = "https://github.com/oxidecomputer/crucible", rev = "2bfe090eb5318ec8c467157018db2429d4df535b" } -crucible-client-types = { git = "https://github.com/oxidecomputer/crucible", rev = "2bfe090eb5318ec8c467157018db2429d4df535b" } +crucible-agent-client = { git = "https://github.com/oxidecomputer/crucible", rev = "ad8a31742adc45e925e63443a5b43c8e30604022" } +crucible-pantry-client = { git = "https://github.com/oxidecomputer/crucible", rev = "ad8a31742adc45e925e63443a5b43c8e30604022" } +crucible-smf = { git = "https://github.com/oxidecomputer/crucible", rev = "ad8a31742adc45e925e63443a5b43c8e30604022" } +crucible-common = { git = "https://github.com/oxidecomputer/crucible", rev = "ad8a31742adc45e925e63443a5b43c8e30604022" } +crucible-client-types = { git = "https://github.com/oxidecomputer/crucible", rev = "ad8a31742adc45e925e63443a5b43c8e30604022" } # NOTE: See above! csv = "1.3.1" curve25519-dalek = "4" @@ -747,11 +747,11 @@ progenitor-extras = "0.2.0" # NOTE: if you change the pinned revision of the `bhyve_api` and propolis # dependencies, you must also update the references in package-manifest.toml to # match the new revision. -bhyve_api = { git = "https://github.com/oxidecomputer/propolis", rev = "979b72896bc39a876c98fb32fe706da37a4fc408" } -propolis-api-types-versions = { git = "https://github.com/oxidecomputer/propolis", rev = "979b72896bc39a876c98fb32fe706da37a4fc408" } -propolis_api_types = { git = "https://github.com/oxidecomputer/propolis", rev = "979b72896bc39a876c98fb32fe706da37a4fc408" } -propolis-client = { git = "https://github.com/oxidecomputer/propolis", rev = "979b72896bc39a876c98fb32fe706da37a4fc408" } -propolis-mock-server = { git = "https://github.com/oxidecomputer/propolis", rev = "979b72896bc39a876c98fb32fe706da37a4fc408" } +bhyve_api = { git = "https://github.com/oxidecomputer/propolis", rev = "046f74302e2ea09a75b0a6810645d42c7df6644a" } +propolis-api-types-versions = { git = "https://github.com/oxidecomputer/propolis", rev = "046f74302e2ea09a75b0a6810645d42c7df6644a" } +propolis_api_types = { git = "https://github.com/oxidecomputer/propolis", rev = "046f74302e2ea09a75b0a6810645d42c7df6644a" } +propolis-client = { git = "https://github.com/oxidecomputer/propolis", rev = "046f74302e2ea09a75b0a6810645d42c7df6644a" } +propolis-mock-server = { git = "https://github.com/oxidecomputer/propolis", rev = "046f74302e2ea09a75b0a6810645d42c7df6644a" } # NOTE: see above! proptest = "1.11.0" qorb = "0.4.1" diff --git a/nexus/src/app/instance_platform/mod.rs b/nexus/src/app/instance_platform/mod.rs index b78664da443..3507f8f922c 100644 --- a/nexus/src/app/instance_platform/mod.rs +++ b/nexus/src/app/instance_platform/mod.rs @@ -225,7 +225,7 @@ impl DisksByIdBuilder { Self { map: BTreeMap::new(), slot_usage: BTreeSet::new() } } - fn add_generic_disk( + fn add_nvme_disk( &mut self, disk: &Disk, backend: Component, @@ -246,12 +246,58 @@ impl DisksByIdBuilder { let pci_path = slot_to_pci_bdf(slot, PciDeviceKind::Disk)?; + // Generally we report that storage devices have volatile write cache + // semantics. This is a conservative default that matches most system + // behaviors. Crucible fast-acks writes and requires flushes to persist + // writes to non-volatile storage, and - theoretically - file-backed + // disks could be *any file* which may include normal POSIX "you must + // fdatasync() for writes to not be lost" semantics. + // + // This being anything other than "true" must be carefully considered; + // incorrectly claiming there is no write cache while the backing + // storage has volatile write cache semantics risks guest data loss in + // the event of power loss or crashes. + // + // On the other hand, when we can avoid claiming volatile write cache + // semantics, guest OSes know to not send spurious flushes. This can + // have important performance consequences from avoided VM exits, + // Propolis syscalls, interrupts, etc. + let volatile_write_cache = match &backend { + // We match on all fields so that if FileStorageBackend changes, + // those changes must consider if volatile-write-cache semantics are + // correctly captured here. + Component::FileStorageBackend(FileStorageBackend { + path, + readonly: _, + block_size: _, + workers: _, + }) => { + // In the product, for the forseeable future, local storage raw + // zvols are on enterprise U.2s which do not report volatile + // write caches. "/rdsk/" here refers to the character device + // for that raw volume with unbuffered semantics (versus + // `/dsk/`, the block device, which can buffer writes when not + // opened O_DIRECT - see spec_write(), vpm_data_copy(), and + // vpm_sync_pages()). + // + // XXX: In development and non-product environments where + // storage may be commodity M.2s or worse, this can claim "no + // VWC semantics" when the underlying storage actually does. + // This could be improved. See Omicron#10933. + let vwc_semantics = !path.starts_with("/dev/zvol/rdsk/"); + + vwc_semantics + } + _ => true, + }; + let device = Component::NvmeDisk(NvmeDisk { backend_id: SpecKey::Uuid(disk.id()), pci_path, serial_number: zero_padded_nvme_serial_from_str( disk.name().as_str(), ), + has_write_cache: volatile_write_cache, }); let device_name = component_names::device_name_from_id(&disk.id()); @@ -279,10 +325,10 @@ impl DisksByIdBuilder { request_json: volume.data().to_owned(), }); - self.add_generic_disk(disk, backend) + self.add_nvme_disk(disk, backend) } - fn add_file_backed_disk( + fn add_local_disk( &mut self, disk: &Disk, path: String, @@ -296,7 +342,7 @@ impl DisksByIdBuilder { workers: Some(LOCAL_STORAGE_WORKERS), }); - self.add_generic_disk(disk, backend) + self.add_nvme_disk(disk, backend) } } @@ -526,7 +572,7 @@ impl super::Nexus { } db::datastore::Disk::LocalStorage(local_storage_disk) => { - builder.add_file_backed_disk( + builder.add_local_disk( disk, // Use the delegated zvol as the target for the file // backed disk diff --git a/openapi/sled-agent/sled-agent-43.0.0-53ef3d.json.gitstub b/openapi/sled-agent/sled-agent-43.0.0-53ef3d.json.gitstub new file mode 100644 index 00000000000..3b2f6105c18 --- /dev/null +++ b/openapi/sled-agent/sled-agent-43.0.0-53ef3d.json.gitstub @@ -0,0 +1 @@ +cc07512e0ea13cbd3fec470e8704399a7ebae19a:openapi/sled-agent/sled-agent-43.0.0-53ef3d.json diff --git a/openapi/sled-agent/sled-agent-43.0.0-53ef3d.json b/openapi/sled-agent/sled-agent-44.0.0-9fbab2.json similarity index 99% rename from openapi/sled-agent/sled-agent-43.0.0-53ef3d.json rename to openapi/sled-agent/sled-agent-44.0.0-9fbab2.json index a9e327d7dc4..966c4da219d 100644 --- a/openapi/sled-agent/sled-agent-43.0.0-53ef3d.json +++ b/openapi/sled-agent/sled-agent-44.0.0-9fbab2.json @@ -7,7 +7,7 @@ "url": "https://oxide.computer", "email": "api@oxide.computer" }, - "version": "43.0.0" + "version": "44.0.0" }, "paths": { "/artifacts": { @@ -7461,6 +7461,10 @@ } ] }, + "has_write_cache": { + "description": "Control if the NVMe disk reports the presence of a volatile write cache.\n\nThis generally should be configured in consideration of the storage backend for the NVMe device. \"true\" is a safe default, and was historically the only configurable value. If the storage backend will not lose data once writes are accepted, even in the face of unplanned crashes or power loss (or, if you really want to lie to guests), setting this to \"false\" can advise guests they may skip issuing flushes to the device.", + "type": "boolean" + }, "pci_path": { "description": "The PCI bus/device/function at which this disk should be attached.", "allOf": [ @@ -7483,6 +7487,7 @@ }, "required": [ "backend_id", + "has_write_cache", "pci_path", "serial_number" ], diff --git a/openapi/sled-agent/sled-agent-latest.json b/openapi/sled-agent/sled-agent-latest.json index 337c9a3b863..514e34ccb3d 120000 --- a/openapi/sled-agent/sled-agent-latest.json +++ b/openapi/sled-agent/sled-agent-latest.json @@ -1 +1 @@ -sled-agent-43.0.0-53ef3d.json \ No newline at end of file +sled-agent-44.0.0-9fbab2.json \ No newline at end of file diff --git a/package-manifest.toml b/package-manifest.toml index 44a60b4fa47..edb753576ce 100644 --- a/package-manifest.toml +++ b/package-manifest.toml @@ -624,10 +624,10 @@ only_for_targets.image = "standard" # 3. Use source.type = "manual" instead of "prebuilt" source.type = "prebuilt" source.repo = "crucible" -source.commit = "2bfe090eb5318ec8c467157018db2429d4df535b" +source.commit = "ad8a31742adc45e925e63443a5b43c8e30604022" # The SHA256 digest is automatically posted to: # https://buildomat.eng.oxide.computer/public/file/oxidecomputer/crucible/image//crucible.sha256.txt -source.sha256 = "86d155da32960b2d64bb0cceaccddfe10ae5bc8b44335e144436eeb0d5999b09" +source.sha256 = "b8e9f74961228dba38d6b2bcb2b5a0082aa5483a2c278fcc062af7c93009a4d3" output.type = "zone" output.intermediate_only = true @@ -636,10 +636,10 @@ service_name = "crucible_pantry_prebuilt" only_for_targets.image = "standard" source.type = "prebuilt" source.repo = "crucible" -source.commit = "2bfe090eb5318ec8c467157018db2429d4df535b" +source.commit = "ad8a31742adc45e925e63443a5b43c8e30604022" # The SHA256 digest is automatically posted to: # https://buildomat.eng.oxide.computer/public/file/oxidecomputer/crucible/image//crucible-pantry.sha256.txt -source.sha256 = "48d1e97bb1129666b5af5ca412eef3a1e99026c10222436bc04ad95dde8aaaf4" +source.sha256 = "c3305dd749870647eb2eceb79f4a8f696ea28602fdda40d7be8a2768a7748757" output.type = "zone" output.intermediate_only = true @@ -653,10 +653,10 @@ service_name = "crucible_utils" only_for_targets.image = "standard" source.type = "prebuilt" source.repo = "crucible" -source.commit = "2bfe090eb5318ec8c467157018db2429d4df535b" +source.commit = "ad8a31742adc45e925e63443a5b43c8e30604022" # The SHA256 digest is automatically posted to: # https://buildomat.eng.oxide.computer/public/file/oxidecomputer/crucible/image//crucible-utils.sha256.txt -source.sha256 = "103aacff3cf1ffd29c0c66edaab1eeab85cf3123d149ebf4c6b1ee309d8d20ba" +source.sha256 = "b2d933a87870d01632d974ff8ea0d46f53f439999adeacb1173dbca983b3d9fe" output.type = "tarball" # Refer to @@ -667,10 +667,10 @@ service_name = "propolis-server" only_for_targets.image = "standard" source.type = "prebuilt" source.repo = "propolis" -source.commit = "979b72896bc39a876c98fb32fe706da37a4fc408" +source.commit = "046f74302e2ea09a75b0a6810645d42c7df6644a" # The SHA256 digest is automatically posted to: # https://buildomat.eng.oxide.computer/public/file/oxidecomputer/propolis/image//propolis-server.sha256.txt -source.sha256 = "b950c8da9e2bb61eeb3b7087c27b2edab6c1b341ae8e7db6e88e7c172af58aff" +source.sha256 = "42a6096035caeccb5f3472a6418180a5c961e4eec870ccf55f55ec7153406268" output.type = "zone" [package.mg-ddm-gz] diff --git a/sled-agent/api/src/lib.rs b/sled-agent/api/src/lib.rs index e89df3b19a0..80992b60eb1 100644 --- a/sled-agent/api/src/lib.rs +++ b/sled-agent/api/src/lib.rs @@ -21,7 +21,7 @@ use omicron_common::api::internal::{ }; 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, v42, + v24, v25, v26, v28, v29, v30, v31, v32, v33, v34, v37, v39, v40, v41, v42, }; use sled_diagnostics::SledDiagnosticsQueryOutput; use slog_error_chain::InlineErrorChain; @@ -38,6 +38,7 @@ api_versions!([ // | example for the next person. // v // (next_int, IDENT), + (44, PROPOLIS_NVME_VWC), (43, INVENTORY_BASEBOARD_ID), (42, NON_EMPTY_UPLINK_PORTS), (41, ADD_INSTANCE_PRIMARY_NIC_MTU), @@ -447,7 +448,7 @@ pub trait SledAgentApi { operation_id = "vmm_register", method = PUT, path = "/vmms/{propolis_id}", - versions = VERSION_ADD_INSTANCE_PRIMARY_NIC_MTU.. + versions = VERSION_PROPOLIS_NVME_VWC.. }] async fn vmm_register( rqctx: RequestContext, @@ -455,6 +456,20 @@ pub trait SledAgentApi { body: TypedBody, ) -> Result, HttpError>; + #[endpoint { + operation_id = "vmm_register", + method = PUT, + path = "/vmms/{propolis_id}", + versions = VERSION_ADD_INSTANCE_PRIMARY_NIC_MTU..VERSION_PROPOLIS_NVME_VWC + }] + async fn vmm_register_v41( + rqctx: RequestContext, + path_params: Path, + body: TypedBody, + ) -> Result, HttpError> { + Self::vmm_register(rqctx, path_params, body.map(Into::into)).await + } + #[endpoint { operation_id = "vmm_register", method = PUT, @@ -466,7 +481,7 @@ pub trait SledAgentApi { path_params: Path, body: TypedBody, ) -> Result, HttpError> { - Self::vmm_register(rqctx, path_params, body.map(Into::into)).await + Self::vmm_register_v41(rqctx, path_params, body.map(Into::into)).await } #[endpoint { diff --git a/sled-agent/types/versions/src/add_vsock_component/instance.rs b/sled-agent/types/versions/src/add_vsock_component/instance.rs index 841d36e0b77..d3b3af2d9fc 100644 --- a/sled-agent/types/versions/src/add_vsock_component/instance.rs +++ b/sled-agent/types/versions/src/add_vsock_component/instance.rs @@ -5,7 +5,7 @@ use std::net::SocketAddr; use omicron_uuid_kinds::InstanceUuid; -use propolis_api_types::instance_spec::InstanceSpec; +use propolis_api_types_versions::v3::instance_spec::InstanceSpec; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use uuid::Uuid; diff --git a/sled-agent/types/versions/src/impls/instance.rs b/sled-agent/types/versions/src/impls/instance.rs index b7acbf4e9d8..f26c0ab14b5 100644 --- a/sled-agent/types/versions/src/impls/instance.rs +++ b/sled-agent/types/versions/src/impls/instance.rs @@ -10,11 +10,12 @@ use crate::latest::instance::VmmSpec; use crate::latest::instance::VmmState; use crate::latest::instance::VmmStateRequested; use crate::latest::inventory::SourceNatConfig; -use propolis_api_types::instance_spec::{ - Component, SpecKey, +use propolis_api_types::instance_spec::SpecKey; +use propolis_api_types_versions::latest::{ components::backends::{ CrucibleStorageBackend, FileStorageBackend, VirtioNetworkBackend, }, + instance_spec::Component, }; use std::collections::BTreeSet; use std::net::Ipv4Addr; diff --git a/sled-agent/types/versions/src/latest.rs b/sled-agent/types/versions/src/latest.rs index e5d40635099..5d6c4db3714 100644 --- a/sled-agent/types/versions/src/latest.rs +++ b/sled-agent/types/versions/src/latest.rs @@ -114,15 +114,15 @@ pub mod instance { pub use crate::v7::instance::InstanceMulticastBody; pub use crate::v7::instance::InstanceMulticastMembership; - pub use crate::v29::instance::VmmSpec; - pub use crate::v31::instance::ResolvedVpcFirewallRule; pub use crate::v32::instance::ExternalIpConfig; pub use crate::v32::instance::ExternalIps; pub use crate::v32::instance::ExternalIpv4Config; pub use crate::v32::instance::ExternalIpv6Config; - pub use crate::v41::instance::InstanceEnsureBody; pub use crate::v41::instance::InstanceSledLocalConfig; + + pub use crate::v44::instance::InstanceEnsureBody; + pub use crate::v44::instance::VmmSpec; } pub mod inventory { diff --git a/sled-agent/types/versions/src/lib.rs b/sled-agent/types/versions/src/lib.rs index 3327979ce4a..f9376806bee 100644 --- a/sled-agent/types/versions/src/lib.rs +++ b/sled-agent/types/versions/src/lib.rs @@ -93,6 +93,8 @@ pub mod v41; pub mod v42; #[path = "inventory_baseboard_id/mod.rs"] pub mod v43; +#[path = "propolis_nvme_vwc/mod.rs"] +pub mod v44; #[path = "add_probe_put_endpoint/mod.rs"] pub mod v6; #[path = "multicast_support/mod.rs"] diff --git a/sled-agent/types/versions/src/propolis_nvme_vwc/instance.rs b/sled-agent/types/versions/src/propolis_nvme_vwc/instance.rs new file mode 100644 index 00000000000..3c38c9b541b --- /dev/null +++ b/sled-agent/types/versions/src/propolis_nvme_vwc/instance.rs @@ -0,0 +1,75 @@ +// 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/. + +//! Instance types for Sled Agent API versions 43. + +use std::net::SocketAddr; + +use omicron_uuid_kinds::InstanceUuid; + +use crate::v1::instance::InstanceMetadata; +use crate::v1::instance::VmmRuntimeState; +use crate::v29; +use crate::v41; +use crate::v41::instance::InstanceSledLocalConfig; +use propolis_api_types_versions::v6::instance_spec::InstanceSpec; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; +use uuid::Uuid; + +/// Specifies the virtual hardware configuration of a new Propolis VMM in the +/// form of a Propolis instance specification. +#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema)] +pub struct VmmSpec(pub InstanceSpec); + +impl From for VmmSpec { + fn from(other: v29::instance::VmmSpec) -> VmmSpec { + let v6_spec: InstanceSpec = other.0.into(); + VmmSpec(v6_spec) + } +} + +/// 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, +} + +impl From for InstanceEnsureBody { + fn from(v41: v41::instance::InstanceEnsureBody) -> InstanceEnsureBody { + InstanceEnsureBody { + vmm_spec: v41.vmm_spec.into(), + local_config: v41.local_config, + vmm_runtime: v41.vmm_runtime, + instance_id: v41.instance_id, + migration_id: v41.migration_id, + propolis_addr: v41.propolis_addr, + metadata: v41.metadata, + } + } +} diff --git a/sled-agent/types/versions/src/propolis_nvme_vwc/mod.rs b/sled-agent/types/versions/src/propolis_nvme_vwc/mod.rs new file mode 100644 index 00000000000..fed465ed41b --- /dev/null +++ b/sled-agent/types/versions/src/propolis_nvme_vwc/mod.rs @@ -0,0 +1,5 @@ +// 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/. + +pub mod instance;