Skip to content

Commit ac4ec36

Browse files
jgallagheriliana
andauthored
Update gateway-messages and bundled faux-mgs (#9354)
In particular, this picks up oxidecomputer/management-gateway-service#451 and oxidecomputer/management-gateway-service#452, which we'd like for debugging hung sled issues. To make this easier to backport to the R17 release branch, it makes minimal changes: requesting these new types of component details from MGS proper will return a 400 (albeit one that probably contains all the details we actually want in the error message!), because returning a 200 would require revving the MGS OpenAPI. The control plane has no logic to collect this information yet, so I think this is fine - it'll be available to support via `faux-mgs` as we'd like, and I'll file an issue for adding proper MGS support at our convenience. --------- Co-authored-by: iliana etaoin <iliana@oxide.computer>
1 parent 1f91ca1 commit ac4ec36

File tree

6 files changed

+57
-19
lines changed

6 files changed

+57
-19
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -466,9 +466,9 @@ gateway-client = { path = "clients/gateway-client" }
466466
# compatibility, but will mean that faux-mgs might be missing new
467467
# functionality.)
468468
#
469-
gateway-ereport-messages = { git = "https://github.com/oxidecomputer/management-gateway-service", rev = "6bd2660d651332f38949cdfd3d23d751ca54b120", default-features = false, features = ["debug-impls"] }
470-
gateway-messages = { git = "https://github.com/oxidecomputer/management-gateway-service", rev = "6bd2660d651332f38949cdfd3d23d751ca54b120", default-features = false, features = ["std"] }
471-
gateway-sp-comms = { git = "https://github.com/oxidecomputer/management-gateway-service", rev = "6bd2660d651332f38949cdfd3d23d751ca54b120" }
469+
gateway-ereport-messages = { git = "https://github.com/oxidecomputer/management-gateway-service", rev = "669fe557b66f44aed3c622bd17bc092f08797e0c", default-features = false, features = ["debug-impls"] }
470+
gateway-messages = { git = "https://github.com/oxidecomputer/management-gateway-service", rev = "669fe557b66f44aed3c622bd17bc092f08797e0c", default-features = false, features = ["std"] }
471+
gateway-sp-comms = { git = "https://github.com/oxidecomputer/management-gateway-service", rev = "669fe557b66f44aed3c622bd17bc092f08797e0c" }
472472
gateway-test-utils = { path = "gateway-test-utils" }
473473
gateway-types = { path = "gateway-types" }
474474
gethostname = "0.5.0"

gateway-types/src/component_details.rs

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// License, v. 2.0. If a copy of the MPL was not distributed with this
33
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
44

5+
use dropshot::HttpError;
56
use schemars::JsonSchema;
67
use serde::Deserialize;
78
use serde::Serialize;
@@ -149,17 +150,40 @@ pub enum PhyType {
149150
Vsc8562,
150151
}
151152

152-
impl From<gateway_messages::ComponentDetails> for SpComponentDetails {
153-
fn from(details: gateway_messages::ComponentDetails) -> Self {
153+
/// Error type for `gateway_messages::ComponentDetails` that are not supported
154+
/// by MGS proper and are only available via `faux-mgs`.
155+
#[derive(Debug, thiserror::Error)]
156+
#[error("unsupported component details: {description}")]
157+
pub struct UnsupportedComponentDetails {
158+
pub description: String,
159+
}
160+
161+
impl From<UnsupportedComponentDetails> for HttpError {
162+
fn from(value: UnsupportedComponentDetails) -> Self {
163+
HttpError::for_bad_request(
164+
None,
165+
format!(
166+
"requested component details are not yet supported: {value}"
167+
),
168+
)
169+
}
170+
}
171+
172+
impl TryFrom<gateway_messages::ComponentDetails> for SpComponentDetails {
173+
type Error = UnsupportedComponentDetails;
174+
175+
fn try_from(
176+
details: gateway_messages::ComponentDetails,
177+
) -> Result<Self, Self::Error> {
154178
use gateway_messages::ComponentDetails;
155179
match details {
156180
ComponentDetails::PortStatus(Ok(status)) => {
157-
Self::PortStatus(status.into())
181+
Ok(Self::PortStatus(status.into()))
158182
}
159183
ComponentDetails::PortStatus(Err(err)) => {
160-
Self::PortStatusError(err.into())
184+
Ok(Self::PortStatusError(err.into()))
161185
}
162-
ComponentDetails::Measurement(m) => match m.value {
186+
ComponentDetails::Measurement(m) => Ok(match m.value {
163187
Ok(value) => Self::Measurement(Measurement {
164188
name: m.name,
165189
kind: m.kind.into(),
@@ -170,7 +194,17 @@ impl From<gateway_messages::ComponentDetails> for SpComponentDetails {
170194
kind: m.kind.into(),
171195
error: err.into(),
172196
}),
173-
},
197+
}),
198+
ComponentDetails::LastPostCode(inner) => {
199+
Err(UnsupportedComponentDetails {
200+
description: format!("last post code: {inner:?}"),
201+
})
202+
}
203+
ComponentDetails::GpioToggleCount(inner) => {
204+
Err(UnsupportedComponentDetails {
205+
description: format!("GPIO toggle count: {inner:?}"),
206+
})
207+
}
174208
}
175209
}
176210
}

gateway/src/http_entrypoints.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,11 @@ impl GatewayApi for GatewayImpl {
201201
})?;
202202

203203
Ok(HttpResponseOk(
204-
details.entries.into_iter().map(Into::into).collect(),
204+
details
205+
.entries
206+
.into_iter()
207+
.map(SpComponentDetails::try_from)
208+
.collect::<Result<Vec<_>, _>>()?,
205209
))
206210
};
207211

package-manifest.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -576,8 +576,8 @@ source.type = "prebuilt"
576576
source.repo = "management-gateway-service"
577577
# In general, this commit should match the pinned revision of `gateway-sp-comms`
578578
# in `Cargo.toml`.
579-
source.commit = "6bd2660d651332f38949cdfd3d23d751ca54b120"
580-
source.sha256 = "bf38d83d61ea7b2923fc7bd3aa563627e1f270b4bf18b1fc7bc744ddedc3b8bc"
579+
source.commit = "669fe557b66f44aed3c622bd17bc092f08797e0c"
580+
source.sha256 = "a32b40a0581bab2d90f6f691ef17fcfb1c5925798afb7f8ab86e6ece168e637d"
581581
output.type = "zone"
582582
output.intermediate_only = true
583583

workspace-hack/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ futures-io = { version = "0.3.31" }
6060
futures-sink = { version = "0.3.31" }
6161
futures-task = { version = "0.3.31", default-features = false, features = ["std"] }
6262
futures-util = { version = "0.3.31", features = ["channel", "io", "sink"] }
63-
gateway-ereport-messages = { git = "https://github.com/oxidecomputer/management-gateway-service", rev = "6bd2660d651332f38949cdfd3d23d751ca54b120", default-features = false, features = ["debug-impls", "serde"] }
64-
gateway-messages = { git = "https://github.com/oxidecomputer/management-gateway-service", rev = "6bd2660d651332f38949cdfd3d23d751ca54b120", features = ["std"] }
63+
gateway-ereport-messages = { git = "https://github.com/oxidecomputer/management-gateway-service", rev = "669fe557b66f44aed3c622bd17bc092f08797e0c", default-features = false, features = ["debug-impls", "serde"] }
64+
gateway-messages = { git = "https://github.com/oxidecomputer/management-gateway-service", rev = "669fe557b66f44aed3c622bd17bc092f08797e0c", features = ["std"] }
6565
generic-array = { version = "0.14.7", default-features = false, features = ["more_lengths", "zeroize"] }
6666
getrandom-6f8ce4dd05d13bba = { package = "getrandom", version = "0.2.15", default-features = false, features = ["js", "rdrand", "std"] }
6767
group = { version = "0.13.0", default-features = false, features = ["alloc"] }
@@ -201,8 +201,8 @@ futures-io = { version = "0.3.31" }
201201
futures-sink = { version = "0.3.31" }
202202
futures-task = { version = "0.3.31", default-features = false, features = ["std"] }
203203
futures-util = { version = "0.3.31", features = ["channel", "io", "sink"] }
204-
gateway-ereport-messages = { git = "https://github.com/oxidecomputer/management-gateway-service", rev = "6bd2660d651332f38949cdfd3d23d751ca54b120", default-features = false, features = ["debug-impls", "serde"] }
205-
gateway-messages = { git = "https://github.com/oxidecomputer/management-gateway-service", rev = "6bd2660d651332f38949cdfd3d23d751ca54b120", features = ["std"] }
204+
gateway-ereport-messages = { git = "https://github.com/oxidecomputer/management-gateway-service", rev = "669fe557b66f44aed3c622bd17bc092f08797e0c", default-features = false, features = ["debug-impls", "serde"] }
205+
gateway-messages = { git = "https://github.com/oxidecomputer/management-gateway-service", rev = "669fe557b66f44aed3c622bd17bc092f08797e0c", features = ["std"] }
206206
generic-array = { version = "0.14.7", default-features = false, features = ["more_lengths", "zeroize"] }
207207
getrandom-6f8ce4dd05d13bba = { package = "getrandom", version = "0.2.15", default-features = false, features = ["js", "rdrand", "std"] }
208208
group = { version = "0.13.0", default-features = false, features = ["alloc"] }

0 commit comments

Comments
 (0)