Skip to content

Conversation

@labbott
Copy link
Contributor

@labbott labbott commented Sep 24, 2025

No description provided.

@labbott labbott changed the title Add cosmo to ignition Add cosmo ignition support Sep 24, 2025
Copy link
Contributor

@karencfv karencfv left a comment

Choose a reason for hiding this comment

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

Looks good! Just a few nits from my part. I'm not 100% sure on the API versioning format though since this is all new. Could be good to get a review from @iliana here :)

pub details: SpIgnition,
}

/// Ignition command.
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe a little more information for this one? 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hah you are finding all the places that were not as well documented


/// State of an ignition target.
///
/// TODO: Ignition returns much more information than we're reporting here: do
Copy link
Contributor

Choose a reason for hiding this comment

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

What could this additional information be used for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Mostly debugging purposes I think? This is also a pretty old comment at this point.

Comment on lines 86 to 64
ctrl_detect_0: bool,
ctrl_detect_1: bool,
flt_a3: bool,
flt_a2: bool,
flt_rot: bool,
flt_sp: bool,
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if this makes sense or not, please ignore this comment if it doesn't. It could be nice to have the fields be more descriptive. For those of us without a background in firmware eng they aren't super obvious. How about something like faults_power_a3, controller_detect_0 etc?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changing field names is pretty intrusive, I'll see about adding some more comments

Comment on lines 855 to 858
let handler = async {
let out = mgmt_switch
.bulk_ignition_state()
.await?
.map(|(id, state)| ignition::v2::SpIgnitionInfo {
id: id.into(),
details: state.into(),
})
.collect();

Ok(HttpResponseOk(out))
};
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm assuming that we'll never have enough items to warrant pagination here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Interesting question! At least in MGS it does look to possibly allow it https://github.com/oxidecomputer/management-gateway-service/blob/91c9d622027c39f5acdd17ae3dab046330bf6717/gateway-messages/src/sp_impl.rs#L765-L776 but I'm guessing the amount of data returned right now is small enough we just haven't bothered

Copy link
Contributor

@karencfv karencfv left a comment

Choose a reason for hiding this comment

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

Thanks for addressing my comments! Looks like it's just missing a cargo xtask openapi generate.

If possible, it'd be good to get a review from someone more acquainted with the new API versioning system

}]
async fn ignition_command_v2(
rqctx: RequestContext<Self::Context>,
path: Path<ignition::v2::PathSpIgnitionCommand>,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need a v2::PathSpIgnitionCommand? I tried comparing v1 and v2, but I couldn't tell what the difference was.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Double checked this, PathSpIgnitionCommand uses IgnitionCommand which is part of the versioned ignition types. Versioning PathSpIgnitionCommand seemed like the least ugly path forward

Copy link
Contributor Author

Choose a reason for hiding this comment

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

John explained this to me a little bit more, I'm going to make this not be versioned

Comment on lines 423 to 431
#[endpoint {
method = GET,
path = "/ignition",
operation_id = "ignition_list",
versions = VERSION_COSMO..
}]
async fn ignition_list_v2(
rqctx: RequestContext<Self::Context>,
) -> Result<HttpResponseOk<Vec<ignition::v2::SpIgnitionInfo>>, HttpError>;
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a pretty different stylistic choice than @iliana made when revving an API for sled agent on #8983. I think I prefer that style, but maybe it's worth discussing? In that change, the new endpoint and its associated types don't have any versioning in the name or types, which makes it clear (IMO) that they're "the current version". So this would be

Suggested change
#[endpoint {
method = GET,
path = "/ignition",
operation_id = "ignition_list",
versions = VERSION_COSMO..
}]
async fn ignition_list_v2(
rqctx: RequestContext<Self::Context>,
) -> Result<HttpResponseOk<Vec<ignition::v2::SpIgnitionInfo>>, HttpError>;
#[endpoint {
method = GET,
path = "/ignition",
versions = VERSION_COSMO..
}]
async fn ignition_list(
rqctx: RequestContext<Self::Context>,
) -> Result<HttpResponseOk<Vec<SpIgnitionInfo>>, HttpError>;

and only the old version would have v1 in its name and return type.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm fine making the style change, I was initially matching http://github.com/oxidecomputer/omicron/pull/8047 which was my initial reference for doing API versioning

err,
})?;

let info = ignition::v1::SpIgnitionInfo {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this impl (and the ignition_list_v1) are fine as-is, but I'm wondering if they could be written in terms of the v2 API? Something like

async fn ignition_get_v1(
    rqctx: RequestContext<Self::Context>,
    path: Path<PathSp>,
) -> Result<HttpResponseOk<ignition::v1::SpIgnitionInfo>, HttpError> {
    let HttpResponseOk(v2_info) = Self::ignition_get(rqctx, path)?;
    Ok(HttpResponseOk(ignition::v1::SpIgnitionInfo::from(v2_info))) 
}

to avoid having to duplicate the guts of talking to the ignition controller, mapping errors, etc.

#
gateway-ereport-messages = { git = "https://github.com/oxidecomputer/management-gateway-service", rev = "77e316c812aa057b9714d0d99c4a7bdd36d45be2", default-features = false, features = ["debug-impls"] }
gateway-messages = { git = "https://github.com/oxidecomputer/management-gateway-service", rev = "77e316c812aa057b9714d0d99c4a7bdd36d45be2", default-features = false, features = ["std"] }
gateway-sp-comms = { git = "https://github.com/oxidecomputer/management-gateway-service", rev = "77e316c812aa057b9714d0d99c4a7bdd36d45be2" }
Copy link
Contributor

Choose a reason for hiding this comment

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

We should also bump this hash in package-manifest.toml where pull in package.omicron-faux-mgs. (Always shipping an up-to-date faux-mgs is not critical, but it's nice to have.)

@labbott labbott merged commit c6628ce into main Sep 30, 2025
19 checks passed
@labbott labbott deleted the cosmo_ignition branch September 30, 2025 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants