Skip to content

Commit

Permalink
Use hostname for Baseboard::Pc::identifier field (#4937)
Browse files Browse the repository at this point in the history
Doing this allows easier testbed setup and usage since we identify new
sleds to add via their baseboard. In case we can't get a hostname we
revert to using a UUID, as in the prior version of code.
  • Loading branch information
andrewjstone authored Feb 1, 2024
1 parent 24b1500 commit f4c7a8d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
11 changes: 11 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions sled-hardware/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion sled-hardware/src/illumos/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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(),
);

Expand Down

0 comments on commit f4c7a8d

Please sign in to comment.