@@ -33,6 +33,7 @@ import (
3333 "github.com/netapp/trident/utils/filesystem"
3434 "github.com/netapp/trident/utils/iscsi"
3535 "github.com/netapp/trident/utils/models"
36+ "github.com/netapp/trident/utils/osutils"
3637)
3738
3839const (
@@ -263,7 +264,7 @@ func (p *Plugin) NodeUnpublishVolume(
263264 return nil , status .Error (codes .InvalidArgument , "no target path provided" )
264265 }
265266
266- isDir , err := utils .IsLikelyDir (targetPath )
267+ isDir , err := p . osutils .IsLikelyDir (targetPath )
267268 if err != nil {
268269 if os .IsNotExist (err ) {
269270 Logc (ctx ).WithFields (fields ).Infof ("target path (%s) not found; volume is not mounted." , targetPath )
@@ -305,7 +306,7 @@ func (p *Plugin) NodeUnpublishVolume(
305306 // however today Kubernetes performs this deletion. Here we are making best efforts
306307 // to delete the resource at target path. Sometimes this fails resulting CSI calling
307308 // NodeUnpublishVolume again and usually deletion goes through in the second attempt.
308- if err = utils .DeleteResourceAtPath (ctx , targetPath ); err != nil {
309+ if err = p . osutils .DeleteResourceAtPath (ctx , targetPath ); err != nil {
309310 Logc (ctx ).Debugf ("Unable to delete resource at target path: %s; %s" , targetPath , err )
310311 }
311312
@@ -340,7 +341,7 @@ func (p *Plugin) NodeGetVolumeStats(
340341 }
341342
342343 // Ensure volume is published at path
343- exists , err := utils .PathExists (req .GetVolumePath ())
344+ exists , err := p . osutils .PathExists (req .GetVolumePath ())
344345 if ! exists || err != nil {
345346 return nil , status .Error (codes .NotFound ,
346347 fmt .Sprintf ("could not find volume mount at path: %s; %v" , req .GetVolumePath (), err ))
@@ -655,7 +656,7 @@ func (p *Plugin) NodeGetInfo(
655656func (p * Plugin ) nodeGetInfo (ctx context.Context ) * models.Node {
656657 // Only get the host system info if we don't have the info yet.
657658 if p .hostInfo == nil {
658- host , err := utils .GetHostSystemInfo (ctx )
659+ host , err := p . osutils .GetHostSystemInfo (ctx )
659660 if err != nil {
660661 p .hostInfo = & models.HostSystem {}
661662 Logc (ctx ).WithError (err ).Warn ("Unable to get host system information." )
@@ -680,7 +681,7 @@ func (p *Plugin) nodeGetInfo(ctx context.Context) *models.Node {
680681 Logc (ctx ).WithField ("IQN" , iscsiWWN ).Info ("Discovered iSCSI initiator name." )
681682 }
682683
683- ips , err := utils .GetIPAddresses (ctx )
684+ ips , err := p . osutils .GetIPAddresses (ctx )
684685 if err != nil {
685686 Logc (ctx ).WithField ("error" , err ).Error ("Could not get IP addresses." )
686687 } else if len (ips ) == 0 {
@@ -696,23 +697,23 @@ func (p *Plugin) nodeGetInfo(ctx context.Context) *models.Node {
696697
697698 // Discover active protocol services on the host.
698699 var services []string
699- nfsActive , err := utils .NFSActiveOnHost (ctx )
700+ nfsActive , err := p . osutils .NFSActiveOnHost (ctx )
700701 if err != nil {
701702 Logc (ctx ).WithError (err ).Warn ("Error discovering NFS service on host." )
702703 }
703704 if nfsActive {
704705 services = append (services , "NFS" )
705706 }
706707
707- smbActive , err := utils .SMBActiveOnHost (ctx )
708+ smbActive , err := osutils .SMBActiveOnHost (ctx )
708709 if err != nil {
709710 Logc (ctx ).WithError (err ).Warn ("Error discovering SMB service on host." )
710711 }
711712 if smbActive {
712713 services = append (services , "SMB" )
713714 }
714715
715- iscsiActive , err := utils .ISCSIActiveOnHost (ctx , * p .hostInfo )
716+ iscsiActive , err := p . iscsi .ISCSIActiveOnHost (ctx , * p .hostInfo )
716717 if err != nil {
717718 Logc (ctx ).WithError (err ).Warn ("Error discovering iSCSI service on host." )
718719 }
0 commit comments