@@ -33,6 +33,7 @@ import (
33
33
"github.com/netapp/trident/utils/filesystem"
34
34
"github.com/netapp/trident/utils/iscsi"
35
35
"github.com/netapp/trident/utils/models"
36
+ "github.com/netapp/trident/utils/osutils"
36
37
)
37
38
38
39
const (
@@ -263,7 +264,7 @@ func (p *Plugin) NodeUnpublishVolume(
263
264
return nil , status .Error (codes .InvalidArgument , "no target path provided" )
264
265
}
265
266
266
- isDir , err := utils .IsLikelyDir (targetPath )
267
+ isDir , err := p . osutils .IsLikelyDir (targetPath )
267
268
if err != nil {
268
269
if os .IsNotExist (err ) {
269
270
Logc (ctx ).WithFields (fields ).Infof ("target path (%s) not found; volume is not mounted." , targetPath )
@@ -305,7 +306,7 @@ func (p *Plugin) NodeUnpublishVolume(
305
306
// however today Kubernetes performs this deletion. Here we are making best efforts
306
307
// to delete the resource at target path. Sometimes this fails resulting CSI calling
307
308
// 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 {
309
310
Logc (ctx ).Debugf ("Unable to delete resource at target path: %s; %s" , targetPath , err )
310
311
}
311
312
@@ -340,7 +341,7 @@ func (p *Plugin) NodeGetVolumeStats(
340
341
}
341
342
342
343
// Ensure volume is published at path
343
- exists , err := utils .PathExists (req .GetVolumePath ())
344
+ exists , err := p . osutils .PathExists (req .GetVolumePath ())
344
345
if ! exists || err != nil {
345
346
return nil , status .Error (codes .NotFound ,
346
347
fmt .Sprintf ("could not find volume mount at path: %s; %v" , req .GetVolumePath (), err ))
@@ -655,7 +656,7 @@ func (p *Plugin) NodeGetInfo(
655
656
func (p * Plugin ) nodeGetInfo (ctx context.Context ) * models.Node {
656
657
// Only get the host system info if we don't have the info yet.
657
658
if p .hostInfo == nil {
658
- host , err := utils .GetHostSystemInfo (ctx )
659
+ host , err := p . osutils .GetHostSystemInfo (ctx )
659
660
if err != nil {
660
661
p .hostInfo = & models.HostSystem {}
661
662
Logc (ctx ).WithError (err ).Warn ("Unable to get host system information." )
@@ -680,7 +681,7 @@ func (p *Plugin) nodeGetInfo(ctx context.Context) *models.Node {
680
681
Logc (ctx ).WithField ("IQN" , iscsiWWN ).Info ("Discovered iSCSI initiator name." )
681
682
}
682
683
683
- ips , err := utils .GetIPAddresses (ctx )
684
+ ips , err := p . osutils .GetIPAddresses (ctx )
684
685
if err != nil {
685
686
Logc (ctx ).WithField ("error" , err ).Error ("Could not get IP addresses." )
686
687
} else if len (ips ) == 0 {
@@ -696,23 +697,23 @@ func (p *Plugin) nodeGetInfo(ctx context.Context) *models.Node {
696
697
697
698
// Discover active protocol services on the host.
698
699
var services []string
699
- nfsActive , err := utils .NFSActiveOnHost (ctx )
700
+ nfsActive , err := p . osutils .NFSActiveOnHost (ctx )
700
701
if err != nil {
701
702
Logc (ctx ).WithError (err ).Warn ("Error discovering NFS service on host." )
702
703
}
703
704
if nfsActive {
704
705
services = append (services , "NFS" )
705
706
}
706
707
707
- smbActive , err := utils .SMBActiveOnHost (ctx )
708
+ smbActive , err := osutils .SMBActiveOnHost (ctx )
708
709
if err != nil {
709
710
Logc (ctx ).WithError (err ).Warn ("Error discovering SMB service on host." )
710
711
}
711
712
if smbActive {
712
713
services = append (services , "SMB" )
713
714
}
714
715
715
- iscsiActive , err := utils .ISCSIActiveOnHost (ctx , * p .hostInfo )
716
+ iscsiActive , err := p . iscsi .ISCSIActiveOnHost (ctx , * p .hostInfo )
716
717
if err != nil {
717
718
Logc (ctx ).WithError (err ).Warn ("Error discovering iSCSI service on host." )
718
719
}
0 commit comments