Skip to content

Commit ce138f5

Browse files
authored
remove dependency from gateway-types/wicket-common to libipcc (#8839)
Fixes #8837.
1 parent ba17a4f commit ce138f5

File tree

5 files changed

+31
-20
lines changed

5 files changed

+31
-20
lines changed

.cargo/xtask.toml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
[libraries."libdoor.so.1"]
1212
[libraries."libefi.so.1"]
1313
[libraries."libgcc_s.so.1"]
14-
[libraries."libipcc.so.1"]
1514
[libraries."libkstat.so.1"]
1615
[libraries."liblzma.so.5"]
1716
[libraries."libm.so.2"]
@@ -28,6 +27,17 @@
2827
[libraries."libxml2.so.2"]
2928
[libraries."libxmlsec1.so.1"]
3029

30+
# libipcc should only be depended on by binaries that communicate with ipcc.
31+
[libraries."libipcc.so.1"]
32+
binary_allow_list = [
33+
"installinator",
34+
"mgs",
35+
"mgs-dev",
36+
"omicron-dev",
37+
"sled-agent",
38+
"sled-agent-sim",
39+
]
40+
3141
# libnvme is a global zone only library and therefore we must be sure that only
3242
# programs running in the gz require it. Additionally only sled-agent should be
3343
# managing a sled's hardware.

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gateway-types/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ gateway-messages.workspace = true
1414
# would only be used for From impls anyway. We put those impls in
1515
# omicron-gateway instead, and don't use `From`.
1616
hex.workspace = true
17-
ipcc.workspace = true
1817
omicron-common.workspace = true
1918
omicron-uuid-kinds.workspace = true
2019
omicron-workspace-hack.workspace = true

gateway-types/src/update.rs

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,15 @@ impl From<gateway_messages::UpdatePreparationProgress>
8585
}
8686
}
8787

88-
// This type is a duplicate of the type in `ipcc`, and we provide a
89-
// `From<_>` impl to convert to it. We keep these types distinct to allow us to
90-
// choose different representations for MGS's HTTP API (this type) and the wire
91-
// format passed through the SP to installinator
92-
// (`ipcc::InstallinatorImageId`), although _currently_ they happen to
93-
// be defined identically.
88+
// This type is a duplicate of the type in `ipcc`. We keep these types distinct
89+
// to allow us to choose different representations for MGS's HTTP API (this
90+
// type) and the wire format passed through the SP to installinator
91+
// (`ipcc::InstallinatorImageId`), although _currently_ they happen to be
92+
// defined identically.
93+
//
94+
// We don't define a conversion from `Self` to `ipcc::InstallinatorImageId` here
95+
// to avoid a dependency on `libipcc`. Instead, callers can easily perform
96+
// conversions themselves.
9497
#[derive(
9598
Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, JsonSchema,
9699
)]
@@ -101,16 +104,6 @@ pub struct InstallinatorImageId {
101104
pub control_plane: ArtifactHash,
102105
}
103106

104-
impl From<InstallinatorImageId> for ipcc::InstallinatorImageId {
105-
fn from(id: InstallinatorImageId) -> Self {
106-
Self {
107-
update_id: id.update_id,
108-
host_phase_2: id.host_phase_2,
109-
control_plane: id.control_plane,
110-
}
111-
}
112-
}
113-
114107
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
115108
#[serde(tag = "progress", rename_all = "snake_case")]
116109
pub enum HostPhase2Progress {

gateway/src/http_entrypoints.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -942,7 +942,7 @@ impl GatewayApi for GatewayImpl {
942942
let handler = async {
943943
let sp = apictx.mgmt_switch.sp(sp_id)?;
944944

945-
let image_id = ipcc::InstallinatorImageId::from(body.into_inner());
945+
let image_id = to_ipcc_installinator_image_id(body.into_inner());
946946

947947
sp.set_ipcc_key_lookup_value(
948948
Key::InstallinatorImageId as u8,
@@ -1173,6 +1173,16 @@ fn component_from_str(s: &str) -> Result<SpComponent, HttpError> {
11731173
})
11741174
}
11751175

1176+
fn to_ipcc_installinator_image_id(
1177+
image_id: InstallinatorImageId,
1178+
) -> ipcc::InstallinatorImageId {
1179+
ipcc::InstallinatorImageId {
1180+
update_id: image_id.update_id,
1181+
host_phase_2: image_id.host_phase_2,
1182+
control_plane: image_id.control_plane,
1183+
}
1184+
}
1185+
11761186
// The _from_comms functions are here rather than `From` impls in gateway-types
11771187
// so that gateway-types avoids a dependency on gateway-sp-comms.
11781188

0 commit comments

Comments
 (0)