diff --git a/Cargo.lock b/Cargo.lock index db80bfd091..25fb63604e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2629,6 +2629,16 @@ dependencies = [ "zeroize", ] +[[package]] +name = "gethostname" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0176e0459c2e4a1fe232f984bca6890e681076abb9934f6cea7c326f3fc47818" +dependencies = [ + "libc", + "windows-targets 0.48.5", +] + [[package]] name = "getopts" version = "0.2.21" @@ -8071,6 +8081,7 @@ dependencies = [ "camino", "cfg-if", "futures", + "gethostname", "illumos-devinfo", "illumos-utils", "libc", diff --git a/Cargo.toml b/Cargo.toml index 72952ff643..f7c5b11aba 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -208,6 +208,7 @@ gateway-client = { path = "clients/gateway-client" } gateway-messages = { git = "https://github.com/oxidecomputer/management-gateway-service", rev = "2739c18e80697aa6bc235c935176d14b4d757ee9", default-features = false, features = ["std"] } gateway-sp-comms = { git = "https://github.com/oxidecomputer/management-gateway-service", rev = "2739c18e80697aa6bc235c935176d14b4d757ee9" } gateway-test-utils = { path = "gateway-test-utils" } +gethostname = "0.4.3" glob = "0.3.1" guppy = "0.17.4" headers = "0.3.9" diff --git a/sled-hardware/Cargo.toml b/sled-hardware/Cargo.toml index 66ecbf9d64..3d1259f46f 100644 --- a/sled-hardware/Cargo.toml +++ b/sled-hardware/Cargo.toml @@ -10,6 +10,7 @@ anyhow.workspace = true camino.workspace = true cfg-if.workspace = true futures.workspace = true +gethostname.workspace = true illumos-utils.workspace = true libc.workspace = true macaddr.workspace = true diff --git a/sled-hardware/src/illumos/mod.rs b/sled-hardware/src/illumos/mod.rs index 19111c6cda..ebc9a9c2b0 100644 --- a/sled-hardware/src/illumos/mod.rs +++ b/sled-hardware/src/illumos/mod.rs @@ -7,6 +7,7 @@ use crate::{ UnparsedDisk, }; use camino::Utf8PathBuf; +use gethostname::gethostname; use illumos_devinfo::{DevInfo, DevLinkType, DevLinks, Node, Property}; use omicron_common::disk::DiskIdentity; use slog::debug; @@ -525,7 +526,9 @@ fn poll_device_tree( if inner.baseboard.is_none() { let pc_baseboard = Baseboard::new_pc( - Uuid::new_v4().simple().to_string(), + gethostname().into_string().unwrap_or_else( + |_| Uuid::new_v4().simple().to_string(), + ), root_node.clone(), );