@@ -535,12 +535,12 @@ func unmountVolumes(ctx context.Context, taskConfig TaskConfig) error {
535535	var  failed  []string 
536536	for  _ , volume  :=  range  taskConfig .Volumes  {
537537		mountPoint  :=  getVolumeMountPoint (volume .Name )
538- 		cmd  :=  exec .Command ( "mountpoint" , mountPoint )
538+ 		cmd  :=  exec .CommandContext ( ctx ,  "mountpoint" , mountPoint )
539539		if  output , err  :=  cmd .CombinedOutput (); err  !=  nil  {
540540			log .Info (ctx , "skipping" , "mountpoint" , mountPoint , "output" , output )
541541			continue 
542542		}
543- 		cmd  =  exec .Command ( "umount" , "-qf" , mountPoint )
543+ 		cmd  =  exec .CommandContext ( ctx ,  "umount" , "-qf" , mountPoint )
544544		if  output , err  :=  cmd .CombinedOutput (); err  !=  nil  {
545545			log .Error (ctx , "failed to unmount" , "mountpoint" , mountPoint , "output" , output )
546546			failed  =  append (failed , mountPoint )
@@ -559,7 +559,7 @@ func formatAndMountVolume(ctx context.Context, volume VolumeInfo) error {
559559	if  err  !=  nil  {
560560		return  tracerr .Wrap (err )
561561	}
562- 	deviceName , err  :=  backend .GetRealDeviceName (volume .VolumeId , volume .DeviceName )
562+ 	deviceName , err  :=  backend .GetRealDeviceName (ctx ,  volume .VolumeId , volume .DeviceName )
563563	if  err  !=  nil  {
564564		return  tracerr .Wrap (err )
565565	}
@@ -618,7 +618,7 @@ func prepareInstanceMountPoints(taskConfig TaskConfig) error {
618618// Returns true if the file system is created. 
619619func  initFileSystem (ctx  context.Context , deviceName  string , errorIfNotExists  bool ) (bool , error ) {
620620	// Run the lsblk command to get filesystem type 
621- 	cmd  :=  exec .Command ( "lsblk" , "-no" , "FSTYPE" , deviceName )
621+ 	cmd  :=  exec .CommandContext ( ctx ,  "lsblk" , "-no" , "FSTYPE" , deviceName )
622622	var  out  bytes.Buffer 
623623	cmd .Stdout  =  & out 
624624	if  err  :=  cmd .Run (); err  !=  nil  {
@@ -636,7 +636,7 @@ func initFileSystem(ctx context.Context, deviceName string, errorIfNotExists boo
636636	}
637637
638638	log .Debug (ctx , "formatting disk with ext4 filesystem..." , "device" , deviceName )
639- 	cmd  =  exec .Command ( "mkfs.ext4" , "-F" , deviceName )
639+ 	cmd  =  exec .CommandContext ( ctx ,  "mkfs.ext4" , "-F" , deviceName )
640640	if  output , err  :=  cmd .CombinedOutput (); err  !=  nil  {
641641		return  false , fmt .Errorf ("failed to format disk: %w, output: %s" , err , string (output ))
642642	}
@@ -655,7 +655,7 @@ func mountDisk(ctx context.Context, deviceName, mountPoint string, fsRootPerms o
655655
656656	// Mount the disk to the mount point 
657657	log .Debug (ctx , "mounting disk..." , "device" , deviceName , "mountpoint" , mountPoint )
658- 	cmd  :=  exec .Command ( "mount" , deviceName , mountPoint )
658+ 	cmd  :=  exec .CommandContext ( ctx ,  "mount" , deviceName , mountPoint )
659659	if  output , err  :=  cmd .CombinedOutput (); err  !=  nil  {
660660		return  fmt .Errorf ("failed to mount disk: %w, output: %s" , err , string (output ))
661661	}
0 commit comments