@@ -49,7 +49,7 @@ use crate::dpu::interface::Interface;
4949use crate :: dpu:: route:: { DpuRoutePlan , IpRoute , Route } ;
5050use crate :: duppet:: { SummaryFormat , SyncOptions } ;
5151use crate :: ethernet_virtualization:: {
52- InterfaceTranslationMode , NvueUpdateFlavor , ServiceAddresses ,
52+ InterfaceTranslationMode , NvueClientContext , NvueUpdateFlavor , ServiceAddresses ,
5353} ;
5454use crate :: fmds_client:: FmdsUpdater ;
5555use crate :: health:: HealthCheckParams ;
@@ -221,11 +221,12 @@ pub async fn setup_and_run(
221221 // We have eight cores. Letting ovs_vswitchd have one is OK.
222222 } ;
223223
224- let nvue_client = match options. hbn_config_mode {
224+ let nvue_context = match options. hbn_config_mode {
225225 HbnConfigMode :: ContainerExec => None ,
226226 HbnConfigMode :: NvueRest => {
227227 let nvue_client = nvue_client:: NvueClient :: new_https_from_env ( ) ?;
228- Some ( nvue_client)
228+ let nvue_context = NvueClientContext :: new ( nvue_client) ;
229+ Some ( nvue_context)
229230 }
230231 } ;
231232
@@ -376,7 +377,7 @@ pub async fn setup_and_run(
376377 close_sender,
377378 network_monitor_handle,
378379 extension_service_manager,
379- nvue_client ,
380+ nvue_context ,
380381 dhcp_interface_translation_mode,
381382 } ;
382383
@@ -409,7 +410,7 @@ struct MainLoop {
409410 network_monitor_handle : Option < JoinHandle < ( ) > > ,
410411 close_sender : watch:: Sender < bool > ,
411412 extension_service_manager : extension_services:: ExtensionServiceManager ,
412- nvue_client : Option < nvue_client :: NvueClient > ,
413+ nvue_context : Option < NvueClientContext > ,
413414 dhcp_interface_translation_mode : Option < InterfaceTranslationMode > ,
414415}
415416
@@ -558,10 +559,11 @@ impl MainLoop {
558559 if self . is_hbn_up {
559560 // First thing is to read the existing HBN version and properly set the hbn device names
560561 // associated with that version.
561- let hbn_version = match self . nvue_client . as_mut ( ) {
562+ let hbn_version = match self . nvue_context . as_mut ( ) {
562563 None => hbn:: read_version ( ) . await ?,
563- Some ( nvue_client) => {
564- let nvue_system_build = nvue_client. system_build_info ( ) . await ?;
564+ Some ( nvue_context) => {
565+ let nvue_system_build =
566+ nvue_context. nvue_client . system_build_info ( ) . await ?;
565567 match nvue_system_build. strip_prefix ( "HBN " ) {
566568 Some ( hbn_version) => Ok ( hbn_version. into ( ) ) ,
567569 None => Err ( eyre:: format_err!(
@@ -680,8 +682,8 @@ impl MainLoop {
680682 } ;
681683
682684 if bridging_result. is_ok ( ) {
683- let update_flavor = match self . nvue_client . as_ref ( ) {
684- Some ( nvue_client ) => NvueUpdateFlavor :: RestApi { nvue_client } ,
685+ let update_flavor = match self . nvue_context . as_mut ( ) {
686+ Some ( nvue_context ) => NvueUpdateFlavor :: RestApi { nvue_context } ,
685687 None => NvueUpdateFlavor :: StartupFile {
686688 hbn_root : & self . agent_config . hbn . root_dir ,
687689 skip_post : self . agent_config . hbn . skip_reload ,
@@ -783,7 +785,7 @@ impl MainLoop {
783785 match ethernet_virtualization:: interfaces (
784786 & conf,
785787 self . factory_mac_address ,
786- self . nvue_client . as_ref ( ) ,
788+ self . nvue_context . as_ref ( ) . map ( |c| & c . nvue_client ) ,
787789 )
788790 . await
789791 {
@@ -826,7 +828,7 @@ impl MainLoop {
826828 current_instance_config_version = status_out. instance_config_version . clone ( ) ;
827829 current_instance_id = status_out. instance_id . as_ref ( ) . map ( |id| id. to_string ( ) ) ;
828830
829- let health_report = match self . nvue_client . as_ref ( ) {
831+ let health_report = match self . nvue_context . as_ref ( ) {
830832 None => {
831833 health:: health_check ( HealthCheckParams {
832834 hbn_root : & self . agent_config . hbn . root_dir ,
@@ -840,7 +842,7 @@ impl MainLoop {
840842 } )
841843 . await
842844 }
843- Some ( nvue_client ) => health:: nvue_api_health ( nvue_client) . await ,
845+ Some ( nvue_context ) => health:: nvue_api_health ( & nvue_context . nvue_client ) . await ,
844846 } ;
845847 is_healthy = !health_report. successes . is_empty ( ) && health_report. alerts . is_empty ( ) ;
846848 self . is_hbn_up = health:: is_up ( & health_report) ;
0 commit comments