Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The control plane should use libipcc #4536

Merged
merged 19 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .cargo/config
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ rustdocflags = "--document-private-items"
# things critical to correctness probably don't belong here.
[target.x86_64-unknown-illumos]
rustflags = [
"-C", "link-arg=-Wl,-znocompstrtab"
"-C", "link-arg=-Wl,-znocompstrtab,-R/usr/platform/oxide/lib/amd64"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a workaround I was using to get around a missing run path. The solution is likely somewhere in the rpath crate - I am diverting my attention to fixing this now, but if someone has pointers on how this should be done, that would be greatly appreciated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spoke to dap about this and I plan to push a commit to clean up this mess.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: opting to go with passing the oxide platform directory here after some discussion in chat.

]

# Set up `cargo xtask`.
Expand Down
7 changes: 4 additions & 3 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ members = [
"installinator",
"internal-dns-cli",
"internal-dns",
"ipcc-key-value",
"ipcc",
"key-manager",
"nexus",
"nexus/authz-macros",
Expand Down Expand Up @@ -102,7 +102,7 @@ default-members = [
"installinator",
"internal-dns-cli",
"internal-dns",
"ipcc-key-value",
"ipcc",
"key-manager",
"nexus",
"nexus/authz-macros",
Expand Down Expand Up @@ -221,7 +221,7 @@ installinator-artifactd = { path = "installinator-artifactd" }
installinator-artifact-client = { path = "clients/installinator-artifact-client" }
installinator-common = { path = "installinator-common" }
internal-dns = { path = "internal-dns" }
ipcc-key-value = { path = "ipcc-key-value" }
ipcc = { path = "ipcc" }
ipnetwork = { version = "0.20", features = ["schemars"] }
itertools = "0.12.0"
key-manager = { path = "key-manager" }
Expand Down
2 changes: 1 addition & 1 deletion gateway/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ hex.workspace = true
http.workspace = true
hyper.workspace = true
illumos-utils.workspace = true
ipcc-key-value.workspace = true
ipcc.workspace = true
omicron-common.workspace = true
once_cell.workspace = true
schemars.workspace = true
Expand Down
13 changes: 6 additions & 7 deletions gateway/src/http_entrypoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -443,11 +443,11 @@ pub struct ImageVersion {
pub version: u32,
}

// This type is a duplicate of the type in `ipcc-key-value`, and we provide a
// This type is a duplicate of the type in `ipcc`, and we provide a
// `From<_>` impl to convert to it. We keep these types distinct to allow us to
// choose different representations for MGS's HTTP API (this type) and the wire
// format passed through the SP to installinator
// (`ipcc_key_value::InstallinatorImageId`), although _currently_ they happen to
// (`ipcc::InstallinatorImageId`), although _currently_ they happen to
// be defined identically.
#[derive(
Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, JsonSchema,
Expand Down Expand Up @@ -1228,7 +1228,7 @@ async fn sp_power_state_set(

/// Set the installinator image ID the sled should use for recovery.
///
/// This value can be read by the host via IPCC; see the `ipcc-key-value` crate.
/// This value can be read by the host via IPCC; see the `ipcc` crate.
#[endpoint {
method = PUT,
path = "/sp/{type}/{slot}/ipcc/installinator-image-id",
Expand All @@ -1238,13 +1238,12 @@ async fn sp_installinator_image_id_set(
path: Path<PathSp>,
body: TypedBody<InstallinatorImageId>,
) -> Result<HttpResponseUpdatedNoContent, HttpError> {
use ipcc_key_value::Key;
use ipcc::Key;

let apictx = rqctx.context();
let sp = apictx.mgmt_switch.sp(path.into_inner().sp.into())?;

let image_id =
ipcc_key_value::InstallinatorImageId::from(body.into_inner());
let image_id = ipcc::InstallinatorImageId::from(body.into_inner());

sp.set_ipcc_key_lookup_value(
Key::InstallinatorImageId as u8,
Expand All @@ -1265,7 +1264,7 @@ async fn sp_installinator_image_id_delete(
rqctx: RequestContext<Arc<ServerContext>>,
path: Path<PathSp>,
) -> Result<HttpResponseUpdatedNoContent, HttpError> {
use ipcc_key_value::Key;
use ipcc::Key;

let apictx = rqctx.context();
let sp = apictx.mgmt_switch.sp(path.into_inner().sp.into())?;
Expand Down
2 changes: 1 addition & 1 deletion gateway/src/http_entrypoints/conversions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ impl From<StartupOptions> for HostStartupOptions {
}
}

impl From<InstallinatorImageId> for ipcc_key_value::InstallinatorImageId {
impl From<InstallinatorImageId> for ipcc::InstallinatorImageId {
fn from(id: InstallinatorImageId) -> Self {
Self {
update_id: id.update_id,
Expand Down
2 changes: 1 addition & 1 deletion installinator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ http.workspace = true
illumos-utils.workspace = true
installinator-artifact-client.workspace = true
installinator-common.workspace = true
ipcc-key-value.workspace = true
ipcc.workspace = true
itertools.workspace = true
libc.workspace = true
omicron-common.workspace = true
Expand Down
4 changes: 2 additions & 2 deletions installinator/src/artifact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use clap::Args;
use futures::StreamExt;
use installinator_artifact_client::ClientError;
use installinator_common::EventReport;
use ipcc_key_value::{InstallinatorImageId, Ipcc};
use ipcc::{InstallinatorImageId, Ipcc};
use omicron_common::update::{ArtifactHash, ArtifactHashId};
use tokio::sync::mpsc;
use uuid::Uuid;
Expand Down Expand Up @@ -47,7 +47,7 @@ pub(crate) struct ArtifactIdOpts {
impl ArtifactIdOpts {
pub(crate) fn resolve(&self) -> Result<InstallinatorImageId> {
if self.from_ipcc {
let ipcc = Ipcc::open().context("error opening IPCC")?;
let ipcc = Ipcc::new().context("error opening IPCC")?;
ipcc.installinator_image_id()
.context("error retrieving installinator image ID")
} else {
Expand Down
126 changes: 0 additions & 126 deletions ipcc-key-value/src/ioctl.rs

This file was deleted.

57 changes: 0 additions & 57 deletions ipcc-key-value/src/ioctl_common.rs

This file was deleted.

32 changes: 0 additions & 32 deletions ipcc-key-value/src/ioctl_stub.rs

This file was deleted.

3 changes: 2 additions & 1 deletion ipcc-key-value/Cargo.toml → ipcc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "ipcc-key-value"
name = "ipcc"
version = "0.1.0"
edition = "2021"
license = "MPL-2.0"
Expand All @@ -12,6 +12,7 @@ serde.workspace = true
thiserror.workspace = true
uuid.workspace = true
omicron-workspace-hack.workspace = true
cfg-if.workspace = true

[dev-dependencies]
omicron-common = { workspace = true, features = ["testing"] }
Expand Down
Loading
Loading