@@ -17,7 +17,8 @@ use gateway_types::{
1717 } ,
1818 component_details:: SpComponentDetails ,
1919 host:: { ComponentFirmwareHashStatus , HostStartupOptions } ,
20- ignition:: { IgnitionCommand , SpIgnitionInfo } ,
20+ ignition,
21+ //ignition::{IgnitionCommand, SpIgnitionInfo},
2122 rot:: { RotCfpa , RotCfpaSlot , RotCmpa , RotState } ,
2223 sensor:: SpSensorReading ,
2324 task_dump:: TaskDump ,
@@ -45,6 +46,7 @@ api_versions!([
4546 // | example for the next person.
4647 // v
4748 // (next_int, IDENT),
49+ ( 2 , COSMO ) ,
4850 ( 1 , INITIAL ) ,
4951] ) ;
5052
@@ -407,10 +409,43 @@ pub trait GatewayApi {
407409 #[ endpoint {
408410 method = GET ,
409411 path = "/ignition" ,
412+ operation_id = "ignition_list" ,
413+ versions = VERSION_INITIAL ..VERSION_COSMO
410414 } ]
411- async fn ignition_list (
415+ async fn ignition_list_v1 (
412416 rqctx : RequestContext < Self :: Context > ,
413- ) -> Result < HttpResponseOk < Vec < SpIgnitionInfo > > , HttpError > ;
417+ ) -> Result < HttpResponseOk < Vec < ignition:: v1:: SpIgnitionInfo > > , HttpError > ;
418+
419+ /// List SPs via Ignition
420+ ///
421+ /// Retreive information for all SPs via the Ignition controller. This is
422+ /// lower latency and has fewer possible failure modes than querying the SP
423+ /// over the management network.
424+ #[ endpoint {
425+ method = GET ,
426+ path = "/ignition" ,
427+ operation_id = "ignition_list" ,
428+ versions = VERSION_COSMO ..
429+ } ]
430+ async fn ignition_list_v2 (
431+ rqctx : RequestContext < Self :: Context > ,
432+ ) -> Result < HttpResponseOk < Vec < ignition:: v2:: SpIgnitionInfo > > , HttpError > ;
433+
434+ /// Get SP info via Ignition
435+ ///
436+ /// Retreive information for an SP via the Ignition controller. This is
437+ /// lower latency and has fewer possible failure modes than querying the SP
438+ /// over the management network.
439+ #[ endpoint {
440+ method = GET ,
441+ path = "/ignition/{type}/{slot}" ,
442+ operation_id = "ignition_get" ,
443+ versions = VERSION_INITIAL ..VERSION_COSMO
444+ } ]
445+ async fn ignition_get_v1 (
446+ rqctx : RequestContext < Self :: Context > ,
447+ path : Path < PathSp > ,
448+ ) -> Result < HttpResponseOk < ignition:: v1:: SpIgnitionInfo > , HttpError > ;
414449
415450 /// Get SP info via Ignition
416451 ///
@@ -420,11 +455,14 @@ pub trait GatewayApi {
420455 #[ endpoint {
421456 method = GET ,
422457 path = "/ignition/{type}/{slot}" ,
458+ operation_id = "ignition_get" ,
459+ versions = VERSION_COSMO ..
423460 } ]
424- async fn ignition_get (
461+ async fn ignition_get_v2 (
425462 rqctx : RequestContext < Self :: Context > ,
426463 path : Path < PathSp > ,
427- ) -> Result < HttpResponseOk < SpIgnitionInfo > , HttpError > ;
464+ ) -> Result < HttpResponseOk < ignition:: v2:: SpIgnitionInfo > , HttpError > ;
465+
428466
429467 /// Send an ignition command targeting a specific SP.
430468 ///
@@ -437,12 +475,35 @@ pub trait GatewayApi {
437475 #[ endpoint {
438476 method = POST ,
439477 path = "/ignition/{type}/{slot}/{command}" ,
478+ operation_id = "ignition_command" ,
479+ versions = VERSION_INITIAL ..VERSION_COSMO
440480 } ]
441- async fn ignition_command (
481+ async fn ignition_command_v1 (
442482 rqctx : RequestContext < Self :: Context > ,
443- path : Path < PathSpIgnitionCommand > ,
483+ path : Path < ignition :: v1 :: PathSpIgnitionCommand > ,
444484 ) -> Result < HttpResponseUpdatedNoContent , HttpError > ;
445485
486+ /// Send an ignition command targeting a specific SP.
487+ ///
488+ /// This endpoint can be used to transition a target between A2 and A3 (via
489+ /// power-on / power-off) or reset it.
490+ ///
491+ /// The management network traffic caused by requests to this endpoint is
492+ /// between this MGS instance and its local ignition controller, _not_ the
493+ /// SP targeted by the command.
494+ #[ endpoint {
495+ method = POST ,
496+ path = "/ignition/{type}/{slot}/{command}" ,
497+ operation_id = "ignition_command" ,
498+ versions = VERSION_COSMO ..
499+ } ]
500+ async fn ignition_command_v2 (
501+ rqctx : RequestContext < Self :: Context > ,
502+ path : Path < ignition:: v2:: PathSpIgnitionCommand > ,
503+ ) -> Result < HttpResponseUpdatedNoContent , HttpError > ;
504+
505+
506+
446507 /// Get the current power state of a sled via its SP.
447508 ///
448509 /// Note that if the sled is in A3, the SP is powered off and will not be able
@@ -684,12 +745,3 @@ pub struct GetRotBootInfoParams {
684745 pub version : u8 ,
685746}
686747
687- #[ derive( Deserialize , JsonSchema ) ]
688- pub struct PathSpIgnitionCommand {
689- /// ID for the SP that the gateway service translates into the appropriate
690- /// port for communicating with the given SP.
691- #[ serde( flatten) ]
692- pub sp : SpIdentifier ,
693- /// Ignition command to perform on the targeted SP.
694- pub command : IgnitionCommand ,
695- }
0 commit comments