Skip to content

Commit

Permalink
Use hostname for Baseboard::Pc::identifier field
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 committed Jan 30, 2024
1 parent 5ba928f commit f367e23
Show file tree
Hide file tree
Showing 3 changed files with 16 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 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 = "0.4.3"
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 f367e23

Please sign in to comment.