Skip to content
This repository was archived by the owner on Mar 22, 2018. It is now read-only.

Commit 411f805

Browse files
committed
SafeFormatAndMount should use volume.Exec provided by VolumeHost
We need to execute mkfs / fsck where the utilities are.
1 parent 715a167 commit 411f805

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

pkg/volume/cinder/attacher.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import (
2929
"k8s.io/kubernetes/pkg/util/mount"
3030
"k8s.io/kubernetes/pkg/volume"
3131
volumeutil "k8s.io/kubernetes/pkg/volume/util"
32-
"k8s.io/utils/exec"
32+
"k8s.io/kubernetes/pkg/volume/util/volumehelper"
3333
)
3434

3535
type cinderDiskAttacher struct {
@@ -285,7 +285,7 @@ func (attacher *cinderDiskAttacher) MountDevice(spec *volume.Spec, devicePath st
285285
options = append(options, "ro")
286286
}
287287
if notMnt {
288-
diskMounter := &mount.SafeFormatAndMount{Interface: mounter, Runner: exec.New()}
288+
diskMounter := volumehelper.NewSafeFormatAndMountFromHost(cinderVolumePluginName, attacher.host)
289289
mountOptions := volume.MountOptionFromSpec(spec, options...)
290290
err = diskMounter.FormatAndMount(devicePath, deviceMountPath, volumeSource.FSType, mountOptions)
291291
if err != nil {

pkg/volume/cinder/cinder.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ import (
3636
"k8s.io/kubernetes/pkg/volume"
3737
"k8s.io/kubernetes/pkg/volume/util"
3838
"k8s.io/kubernetes/pkg/volume/util/volumehelper"
39-
"k8s.io/utils/exec"
4039
)
4140

4241
// This is the primary entrypoint for volume plugins.
@@ -139,7 +138,7 @@ func (plugin *cinderPlugin) newMounterInternal(spec *volume.Spec, podUID types.U
139138
},
140139
fsType: fsType,
141140
readOnly: readOnly,
142-
blockDeviceMounter: &mount.SafeFormatAndMount{Interface: mounter, Runner: exec.New()}}, nil
141+
blockDeviceMounter: volumehelper.NewSafeFormatAndMountFromHost(plugin.GetPluginName(), plugin.host)}, nil
143142
}
144143

145144
func (plugin *cinderPlugin) NewUnmounter(volName string, podUID types.UID) (volume.Unmounter, error) {

0 commit comments

Comments
 (0)