Skip to content

Commit 55a0524

Browse files
authored
Merge pull request kubernetes#76944 from SataQiu/fix-golint-volume-20190423
Fix golint failures of pkg/volume/nfs
2 parents 4f08ea9 + d6d329b commit 55a0524

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

hack/.golint_failures

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,6 @@ pkg/volume/csi/fake
336336
pkg/volume/git_repo
337337
pkg/volume/host_path
338338
pkg/volume/iscsi
339-
pkg/volume/nfs
340339
pkg/volume/photon_pd
341340
pkg/volume/rbd
342341
pkg/volume/scaleio

pkg/volume/nfs/nfs.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import (
3232
utilstrings "k8s.io/utils/strings"
3333
)
3434

35-
// This is the primary entrypoint for volume plugins.
35+
// ProbeVolumePlugins is the primary entrypoint for volume plugins.
3636
// The volumeConfig arg provides the ability to configure recycler behavior. It is implemented as a pointer to allow nils.
3737
// The nfsPlugin is used to store the volumeConfig and give it, when needed, to the func that creates NFS Recyclers.
3838
// Tests that exercise recycling should not use this func but instead use ProbeRecyclablePlugins() to override default behavior.
@@ -224,21 +224,21 @@ type nfsMounter struct {
224224

225225
var _ volume.Mounter = &nfsMounter{}
226226

227-
func (b *nfsMounter) GetAttributes() volume.Attributes {
227+
func (nfsMounter *nfsMounter) GetAttributes() volume.Attributes {
228228
return volume.Attributes{
229-
ReadOnly: b.readOnly,
229+
ReadOnly: nfsMounter.readOnly,
230230
Managed: false,
231231
SupportsSELinux: false,
232232
}
233233
}
234234

235235
// SetUp attaches the disk and bind mounts to the volume path.
236-
func (b *nfsMounter) SetUp(fsGroup *int64) error {
237-
return b.SetUpAt(b.GetPath(), fsGroup)
236+
func (nfsMounter *nfsMounter) SetUp(fsGroup *int64) error {
237+
return nfsMounter.SetUpAt(nfsMounter.GetPath(), fsGroup)
238238
}
239239

240-
func (b *nfsMounter) SetUpAt(dir string, fsGroup *int64) error {
241-
notMnt, err := mount.IsNotMountPoint(b.mounter, dir)
240+
func (nfsMounter *nfsMounter) SetUpAt(dir string, fsGroup *int64) error {
241+
notMnt, err := mount.IsNotMountPoint(nfsMounter.mounter, dir)
242242
klog.V(4).Infof("NFS mount set up: %s %v %v", dir, !notMnt, err)
243243
if err != nil && !os.IsNotExist(err) {
244244
return err
@@ -249,25 +249,25 @@ func (b *nfsMounter) SetUpAt(dir string, fsGroup *int64) error {
249249
if err := os.MkdirAll(dir, 0750); err != nil {
250250
return err
251251
}
252-
source := fmt.Sprintf("%s:%s", b.server, b.exportPath)
252+
source := fmt.Sprintf("%s:%s", nfsMounter.server, nfsMounter.exportPath)
253253
options := []string{}
254-
if b.readOnly {
254+
if nfsMounter.readOnly {
255255
options = append(options, "ro")
256256
}
257-
mountOptions := util.JoinMountOptions(b.mountOptions, options)
258-
err = b.mounter.Mount(source, dir, "nfs", mountOptions)
257+
mountOptions := util.JoinMountOptions(nfsMounter.mountOptions, options)
258+
err = nfsMounter.mounter.Mount(source, dir, "nfs", mountOptions)
259259
if err != nil {
260-
notMnt, mntErr := mount.IsNotMountPoint(b.mounter, dir)
260+
notMnt, mntErr := mount.IsNotMountPoint(nfsMounter.mounter, dir)
261261
if mntErr != nil {
262262
klog.Errorf("IsNotMountPoint check failed: %v", mntErr)
263263
return err
264264
}
265265
if !notMnt {
266-
if mntErr = b.mounter.Unmount(dir); mntErr != nil {
266+
if mntErr = nfsMounter.mounter.Unmount(dir); mntErr != nil {
267267
klog.Errorf("Failed to unmount: %v", mntErr)
268268
return err
269269
}
270-
notMnt, mntErr := mount.IsNotMountPoint(b.mounter, dir)
270+
notMnt, mntErr := mount.IsNotMountPoint(nfsMounter.mounter, dir)
271271
if mntErr != nil {
272272
klog.Errorf("IsNotMountPoint check failed: %v", mntErr)
273273
return err

0 commit comments

Comments
 (0)