Skip to content

Commit 27cb5cf

Browse files
committed
add systemd mount options interface to support the no-systemd mount
1 parent 53d9bed commit 27cb5cf

File tree

24 files changed

+68
-26
lines changed

24 files changed

+68
-26
lines changed

pkg/volume/awsebs/aws_ebs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ func (b *awsElasticBlockStoreMounter) SetUpAt(dir string, mounterArgs volume.Mou
399399
options = append(options, "ro")
400400
}
401401
mountOptions := util.JoinMountOptions(options, b.mountOptions)
402-
err = b.mounter.Mount(globalPDPath, dir, "", mountOptions)
402+
err = b.mounter.MountSensitiveWithoutSystemd(globalPDPath, dir, "", mountOptions, nil)
403403
if err != nil {
404404
notMnt, mntErr := b.mounter.IsLikelyNotMountPoint(dir)
405405
if mntErr != nil {

pkg/volume/azure_file/azure_file.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ func (b *azureFileMounter) SetUpAt(dir string, mounterArgs volume.MounterArgs) e
305305

306306
mountComplete := false
307307
err = wait.PollImmediate(1*time.Second, 2*time.Minute, func() (bool, error) {
308-
err := b.mounter.MountSensitive(source, dir, "cifs", mountOptions, sensitiveMountOptions)
308+
err := b.mounter.MountSensitiveWithoutSystemd(source, dir, "cifs", mountOptions, sensitiveMountOptions)
309309
mountComplete = true
310310
return true, err
311311
})

pkg/volume/azuredd/azure_mounter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ func (m *azureDiskMounter) SetUpAt(dir string, mounterArgs volume.MounterArgs) e
131131
return err
132132
}
133133

134-
mountErr := mounter.Mount(globalPDPath, dir, *volumeSource.FSType, options)
134+
mountErr := mounter.MountSensitiveWithoutSystemd(globalPDPath, dir, *volumeSource.FSType, options, nil)
135135
// Everything in the following control flow is meant as an
136136
// attempt cleanup a failed setupAt (bind mount)
137137
if mountErr != nil {

pkg/volume/cinder/cinder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ func (b *cinderVolumeMounter) SetUpAt(dir string, mounterArgs volume.MounterArgs
418418
mountOptions := util.JoinMountOptions(options, b.mountOptions)
419419
// Perform a bind mount to the full path to allow duplicate mounts of the same PD.
420420
klog.V(4).Infof("Attempting to mount cinder volume %s to %s with options %v", b.pdName, dir, mountOptions)
421-
err = b.mounter.Mount(globalPDPath, dir, "", options)
421+
err = b.mounter.MountSensitiveWithoutSystemd(globalPDPath, dir, "", options, nil)
422422
if err != nil {
423423
klog.V(4).Infof("Mount failed: %v", err)
424424
notmnt, mntErr := b.mounter.IsLikelyNotMountPoint(dir)

pkg/volume/cinder/cinder_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func (fake *fakePDManager) AttachDisk(b *cinderVolumeMounter, globalPDPath strin
9696
}
9797
}
9898
if notmnt {
99-
err = b.mounter.Mount(fakeDeviceName, globalPath, "", []string{"bind"})
99+
err = b.mounter.MountSensitiveWithoutSystemd(fakeDeviceName, globalPath, "", []string{"bind"}, nil)
100100
if err != nil {
101101
return err
102102
}

pkg/volume/emptydir/empty_dir.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ func (ed *emptyDir) setupTmpfs(dir string) error {
272272
}
273273

274274
klog.V(3).Infof("pod %v: mounting tmpfs for volume %v", ed.pod.UID, ed.volName)
275-
return ed.mounter.Mount("tmpfs", dir, "tmpfs", nil /* options */)
275+
return ed.mounter.MountSensitiveWithoutSystemd("tmpfs", dir, "tmpfs", nil /* options */, nil)
276276
}
277277

278278
// setupHugepages creates a hugepage mount at the specified directory.
@@ -317,7 +317,7 @@ func (ed *emptyDir) setupHugepages(dir string) error {
317317
}
318318

319319
klog.V(3).Infof("pod %v: mounting hugepages for volume %v", ed.pod.UID, ed.volName)
320-
return ed.mounter.Mount("nodev", dir, "hugetlbfs", []string{pageSizeMountOption})
320+
return ed.mounter.MountSensitiveWithoutSystemd("nodev", dir, "hugetlbfs", []string{pageSizeMountOption}, nil)
321321
}
322322

323323
// getPageSizeMountOption retrieves pageSize mount option from Pod's resources

pkg/volume/fc/disk_manager.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func diskSetUp(manager diskManager, b fcDiskMounter, volPath string, mounter mou
6161
options = append(options, "ro")
6262
}
6363
mountOptions := util.JoinMountOptions(options, b.mountOptions)
64-
err = mounter.Mount(globalPDPath, volPath, "", mountOptions)
64+
err = mounter.MountSensitiveWithoutSystemd(globalPDPath, volPath, "", mountOptions, nil)
6565
if err != nil {
6666
klog.Errorf("Failed to bind mount: source:%s, target:%s, err:%v", globalPDPath, volPath, err)
6767
noMnt, mntErr := b.mounter.IsLikelyNotMountPoint(volPath)

pkg/volume/flexvolume/util.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ func prepareForMount(mounter mount.Interface, deviceMountPath string) (bool, err
140140
// Mounts the device at the given path.
141141
// It is expected that prepareForMount has been called before.
142142
func doMount(mounter mount.Interface, devicePath, deviceMountPath, fsType string, options []string) error {
143-
err := mounter.Mount(devicePath, deviceMountPath, fsType, options)
143+
err := mounter.MountSensitiveWithoutSystemd(devicePath, deviceMountPath, fsType, options, nil)
144144
if err != nil {
145145
klog.Errorf("Failed to mount the volume at %s, device: %s, error: %s", deviceMountPath, devicePath, err.Error())
146146
return err

pkg/volume/flocker/flocker.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ func (b *flockerVolumeMounter) SetUpAt(dir string, mounterArgs volume.MounterArg
332332
globalFlockerPath := makeGlobalFlockerPath(datasetUUID)
333333
klog.V(4).Infof("attempting to mount %s", dir)
334334

335-
err = b.mounter.Mount(globalFlockerPath, dir, "", options)
335+
err = b.mounter.MountSensitiveWithoutSystemd(globalFlockerPath, dir, "", options, nil)
336336
if err != nil {
337337
notMnt, mntErr := b.mounter.IsLikelyNotMountPoint(dir)
338338
if mntErr != nil {

pkg/volume/gcepd/gce_pd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ func (b *gcePersistentDiskMounter) SetUpAt(dir string, mounterArgs volume.Mounte
401401

402402
mountOptions := util.JoinMountOptions(b.mountOptions, options)
403403

404-
err = b.mounter.Mount(globalPDPath, dir, "", mountOptions)
404+
err = b.mounter.MountSensitiveWithoutSystemd(globalPDPath, dir, "", mountOptions, nil)
405405
if err != nil {
406406
notMnt, mntErr := b.mounter.IsLikelyNotMountPoint(dir)
407407
if mntErr != nil {

0 commit comments

Comments
 (0)