@@ -55,8 +55,8 @@ func main() {
5555 c := cli.Command {}
5656 c .Name = "NVIDIA MPS Control Daemon"
5757 c .Version = info .GetVersionString ()
58- c .Action = func (_ context.Context , cmd * cli.Command ) error {
59- return start (cmd , config )
58+ c .Action = func (ctx context.Context , cmd * cli.Command ) error {
59+ return start (ctx , cmd , config )
6060 }
6161 c .Commands = []* cli.Command {
6262 mount .NewCommand (),
@@ -106,7 +106,7 @@ func (cfg *Config) loadConfig(c *cli.Command) (*spec.Config, error) {
106106 return config , nil
107107}
108108
109- func start (c * cli.Command , cfg * Config ) error {
109+ func start (ctx context. Context , c * cli.Command , cfg * Config ) error {
110110 klog .Info ("Starting OS watcher." )
111111 sigs := watch .Signals (syscall .SIGHUP , syscall .SIGINT , syscall .SIGTERM , syscall .SIGQUIT )
112112 var started bool
@@ -122,7 +122,7 @@ restart:
122122 }
123123
124124 klog .Info ("Starting Daemons." )
125- daemons , restartDaemons , err := startDaemons (c , cfg )
125+ daemons , restartDaemons , err := startDaemons (ctx , c , cfg )
126126 if err != nil {
127127 return fmt .Errorf ("error starting plugins: %v" , err )
128128 }
@@ -162,7 +162,7 @@ exit:
162162 return nil
163163}
164164
165- func startDaemons (c * cli.Command , cfg * Config ) ([]* mps.Daemon , bool , error ) {
165+ func startDaemons (ctx context. Context , c * cli.Command , cfg * Config ) ([]* mps.Daemon , bool , error ) {
166166 // Load the configuration file
167167 klog .Info ("Loading configuration." )
168168 config , err := cfg .loadConfig (c )
@@ -209,7 +209,7 @@ func startDaemons(c *cli.Command, cfg *Config) ([]*mps.Daemon, bool, error) {
209209 // Loop through all MPS daemons and start them.
210210 // If any daemon fails to start, all daemons are started again.
211211 for _ , mpsDaemon := range mpsDaemons {
212- if err := mpsDaemon .Start (); err != nil {
212+ if err := mpsDaemon .Start (ctx ); err != nil {
213213 klog .Errorf ("Failed to start MPS daemon: %v" , err )
214214 return mpsDaemons , true , nil
215215 }
0 commit comments