@@ -51,6 +51,9 @@ use nexus_types::internal_api::background::RegionSnapshotReplacementFinishStatus
5151use nexus_types:: internal_api:: background:: RegionSnapshotReplacementGarbageCollectStatus ;
5252use nexus_types:: internal_api:: background:: RegionSnapshotReplacementStartStatus ;
5353use nexus_types:: internal_api:: background:: RegionSnapshotReplacementStepStatus ;
54+ use nexus_types:: internal_api:: background:: TufArtifactReplicationCounters ;
55+ use nexus_types:: internal_api:: background:: TufArtifactReplicationRequest ;
56+ use nexus_types:: internal_api:: background:: TufArtifactReplicationStatus ;
5457use nexus_types:: inventory:: BaseboardId ;
5558use omicron_uuid_kinds:: BlueprintUuid ;
5659use omicron_uuid_kinds:: CollectionUuid ;
@@ -943,6 +946,9 @@ fn print_task_details(bgtask: &BackgroundTask, details: &serde_json::Value) {
943946 "service_firewall_rule_propagation" => {
944947 print_task_service_firewall_rule_propagation ( details) ;
945948 }
949+ "tuf_artifact_replication" => {
950+ print_task_tuf_artifact_replication ( details) ;
951+ }
946952 _ => {
947953 println ! (
948954 "warning: unknown background task: {:?} \
@@ -2024,6 +2030,69 @@ fn print_task_service_firewall_rule_propagation(details: &serde_json::Value) {
20242030 } ;
20252031}
20262032
2033+ fn print_task_tuf_artifact_replication ( details : & serde_json:: Value ) {
2034+ fn print_counters ( counters : TufArtifactReplicationCounters ) {
2035+ const ROWS : & [ & str ] = & [
2036+ "list ok:" ,
2037+ "list err:" ,
2038+ "put ok:" ,
2039+ "put err:" ,
2040+ "copy ok:" ,
2041+ "copy err:" ,
2042+ "delete ok:" ,
2043+ "delete err:" ,
2044+ ] ;
2045+ const WIDTH : usize = const_max_len ( ROWS ) ;
2046+
2047+ for ( label, value) in ROWS . iter ( ) . zip ( [
2048+ counters. list_ok ,
2049+ counters. list_err ,
2050+ counters. put_ok ,
2051+ counters. put_err ,
2052+ counters. copy_ok ,
2053+ counters. copy_err ,
2054+ counters. delete_ok ,
2055+ counters. delete_err ,
2056+ ] ) {
2057+ println ! ( " {label:<WIDTH$} {value:>3}" ) ;
2058+ }
2059+ }
2060+
2061+ match serde_json:: from_value :: < TufArtifactReplicationStatus > (
2062+ details. clone ( ) ,
2063+ ) {
2064+ Err ( error) => eprintln ! (
2065+ "warning: failed to interpret task details: {:?}: {:?}" ,
2066+ error, details
2067+ ) ,
2068+ Ok ( status) => {
2069+ println ! ( " request ringbuf:" ) ;
2070+ for TufArtifactReplicationRequest {
2071+ time,
2072+ target_sled,
2073+ operation,
2074+ error,
2075+ } in status. request_debug_ringbuf . iter ( )
2076+ {
2077+ println ! ( " - target sled: {target_sled}" ) ;
2078+ println ! ( " operation: {operation:?}" ) ;
2079+ println ! (
2080+ " at: {}" ,
2081+ time. to_rfc3339_opts( SecondsFormat :: Secs , true )
2082+ ) ;
2083+ if let Some ( error) = error {
2084+ println ! ( " error: {error}" )
2085+ }
2086+ }
2087+ println ! ( " last run:" ) ;
2088+ print_counters ( status. last_run_counters ) ;
2089+ println ! ( " lifetime:" ) ;
2090+ print_counters ( status. lifetime_counters ) ;
2091+ println ! ( " local repos: {}" , status. local_repos) ;
2092+ }
2093+ }
2094+ }
2095+
20272096/// Summarizes an `ActivationReason`
20282097fn reason_str ( reason : & ActivationReason ) -> & ' static str {
20292098 match reason {
0 commit comments