@@ -78,6 +78,7 @@ type Options struct {
7878 DriverLibraryPath string
7979 NvidiaSMIPath string
8080 NvidiaCDIHookPath string
81+ SystemdTimeout float64
8182}
8283
8384// Reconfigure handles the MIG reconfiguration process
@@ -107,9 +108,14 @@ func New(ctx context.Context, clientset *kubernetes.Clientset, migPartedBinary [
107108 _ = os .Setenv ("DBUS_SYSTEM_BUS_ADDRESS" , hostSystemBusAddress )
108109 }
109110
110- systemdManager , err := systemd .NewManager (ctx )
111+ systemdManager , err := systemd .NewManager (ctx , time . Duration ( opts . SystemdTimeout ) * time . Second )
111112 if err != nil {
112- return nil , fmt .Errorf ("failed to initialize systemd manager: %w" , err )
113+ if errors .Is (err , context .DeadlineExceeded ) {
114+ log .Warn ("connection to systemd timed out; skipping systemd-related tasks for this reconfiguration" )
115+ systemdManager = nil
116+ } else {
117+ return nil , fmt .Errorf ("failed to initialize systemd manager: %w" , err )
118+ }
113119 }
114120
115121 return & Reconfigure {
@@ -331,6 +337,10 @@ Environment="MIG_PARTED_SELECTED_CONFIG=%s"
331337 return fmt .Errorf ("failed to write config to state file: %w" , err )
332338 }
333339
340+ if r .systemdManager == nil {
341+ return nil
342+ }
343+
334344 return r .systemdManager .ReloadDaemon ()
335345}
336346
@@ -420,6 +430,11 @@ func (r *Reconfigure) waitForPodsToBeDeleted() error {
420430
421431// shutdownHostGPUClients shuts down host GPU clients
422432func (r * Reconfigure ) shutdownHostGPUClients () error {
433+ if r .systemdManager == nil {
434+ log .Info ("No systemd manager available, not shutting down GPU clients on the host" )
435+ return nil
436+ }
437+
423438 log .Info ("Shutting down all GPU clients on the host by stopping their systemd services" )
424439
425440 services := strings .Split (r .opts .HostGPUClientServices , "," )
@@ -705,6 +720,11 @@ func (r *Reconfigure) createCDISpec() error {
705720}
706721
707722func (r * Reconfigure ) hostStartSystemdServices () error {
723+ if r .systemdManager == nil {
724+ log .Info ("No systemd manager available, not starting anything via systemd" )
725+ return nil
726+ }
727+
708728 services := r .stoppedServices
709729 var restartServices []string
710730 if len (services ) == 0 {
0 commit comments