From bc0e170d9c8c7b6209db6af4905214c3b2c4f060 Mon Sep 17 00:00:00 2001 From: Jan Safranek Date: Mon, 14 Aug 2017 12:16:26 +0200 Subject: [PATCH] Add pluginName to VolumeHost.GetMouter Different plugins can get different mounter, depending where the mount utilities are. --- .../volume/attachdetach/attach_detach_controller.go | 2 +- pkg/controller/volume/persistentvolume/volume_host.go | 2 +- pkg/kubelet/volume_host.go | 2 +- pkg/volume/aws_ebs/attacher.go | 6 +++--- pkg/volume/aws_ebs/aws_ebs.go | 8 ++++---- pkg/volume/azure_dd/attacher.go | 4 ++-- pkg/volume/azure_dd/azure_dd.go | 4 ++-- pkg/volume/azure_dd/azure_mounter.go | 4 ++-- pkg/volume/azure_file/azure_file.go | 4 ++-- pkg/volume/cephfs/cephfs.go | 4 ++-- pkg/volume/cinder/attacher.go | 6 +++--- pkg/volume/cinder/cinder.go | 6 +++--- pkg/volume/configmap/configmap.go | 4 ++-- pkg/volume/empty_dir/empty_dir.go | 4 ++-- pkg/volume/fc/attacher.go | 8 ++++---- pkg/volume/fc/fc.go | 4 ++-- pkg/volume/flexvolume/attacher.go | 4 ++-- pkg/volume/flexvolume/detacher-defaults.go | 2 +- pkg/volume/flexvolume/detacher.go | 2 +- pkg/volume/flexvolume/plugin.go | 6 +++--- pkg/volume/flocker/flocker.go | 4 ++-- pkg/volume/gce_pd/attacher.go | 6 +++--- pkg/volume/gce_pd/gce_pd.go | 6 +++--- pkg/volume/glusterfs/glusterfs.go | 4 ++-- pkg/volume/iscsi/iscsi.go | 4 ++-- pkg/volume/local/local.go | 4 ++-- pkg/volume/nfs/nfs.go | 4 ++-- pkg/volume/photon_pd/attacher.go | 6 +++--- pkg/volume/photon_pd/photon_pd.go | 6 +++--- pkg/volume/plugins.go | 2 +- pkg/volume/portworx/portworx.go | 6 +++--- pkg/volume/quobyte/quobyte.go | 6 +++--- pkg/volume/rbd/rbd.go | 4 ++-- pkg/volume/scaleio/sio_plugin.go | 2 +- pkg/volume/secret/secret.go | 4 ++-- pkg/volume/storageos/storageos.go | 4 ++-- pkg/volume/testing/testing.go | 2 +- pkg/volume/vsphere_volume/attacher.go | 6 +++--- pkg/volume/vsphere_volume/vsphere_volume.go | 6 +++--- 39 files changed, 86 insertions(+), 86 deletions(-) diff --git a/pkg/controller/volume/attachdetach/attach_detach_controller.go b/pkg/controller/volume/attachdetach/attach_detach_controller.go index 29231260c6..151c900fd6 100644 --- a/pkg/controller/volume/attachdetach/attach_detach_controller.go +++ b/pkg/controller/volume/attachdetach/attach_detach_controller.go @@ -539,7 +539,7 @@ func (adc *attachDetachController) GetCloudProvider() cloudprovider.Interface { return adc.cloud } -func (adc *attachDetachController) GetMounter() mount.Interface { +func (adc *attachDetachController) GetMounter(pluginName string) mount.Interface { return nil } diff --git a/pkg/controller/volume/persistentvolume/volume_host.go b/pkg/controller/volume/persistentvolume/volume_host.go index 6c91a8817d..8f182edc6b 100644 --- a/pkg/controller/volume/persistentvolume/volume_host.go +++ b/pkg/controller/volume/persistentvolume/volume_host.go @@ -61,7 +61,7 @@ func (ctrl *PersistentVolumeController) GetCloudProvider() cloudprovider.Interfa return ctrl.cloud } -func (ctrl *PersistentVolumeController) GetMounter() mount.Interface { +func (ctrl *PersistentVolumeController) GetMounter(pluginName string) mount.Interface { return nil } diff --git a/pkg/kubelet/volume_host.go b/pkg/kubelet/volume_host.go index 2ab22d5773..3cedc81da8 100644 --- a/pkg/kubelet/volume_host.go +++ b/pkg/kubelet/volume_host.go @@ -117,7 +117,7 @@ func (kvh *kubeletVolumeHost) GetCloudProvider() cloudprovider.Interface { return kvh.kubelet.cloud } -func (kvh *kubeletVolumeHost) GetMounter() mount.Interface { +func (kvh *kubeletVolumeHost) GetMounter(pluginName string) mount.Interface { return kvh.kubelet.mounter } diff --git a/pkg/volume/aws_ebs/attacher.go b/pkg/volume/aws_ebs/attacher.go index 2ccf0aa885..1419864127 100644 --- a/pkg/volume/aws_ebs/attacher.go +++ b/pkg/volume/aws_ebs/attacher.go @@ -54,7 +54,7 @@ func (plugin *awsElasticBlockStorePlugin) NewAttacher() (volume.Attacher, error) } func (plugin *awsElasticBlockStorePlugin) GetDeviceMountRefs(deviceMountPath string) ([]string, error) { - mounter := plugin.host.GetMounter() + mounter := plugin.host.GetMounter(plugin.GetPluginName()) return mount.GetMountRefs(mounter, deviceMountPath) } @@ -199,7 +199,7 @@ func (attacher *awsElasticBlockStoreAttacher) GetDeviceMountPath( // FIXME: this method can be further pruned. func (attacher *awsElasticBlockStoreAttacher) MountDevice(spec *volume.Spec, devicePath string, deviceMountPath string) error { - mounter := attacher.host.GetMounter() + mounter := attacher.host.GetMounter(awsElasticBlockStorePluginName) notMnt, err := mounter.IsLikelyNotMountPoint(deviceMountPath) if err != nil { if os.IsNotExist(err) { @@ -247,7 +247,7 @@ func (plugin *awsElasticBlockStorePlugin) NewDetacher() (volume.Detacher, error) } return &awsElasticBlockStoreDetacher{ - mounter: plugin.host.GetMounter(), + mounter: plugin.host.GetMounter(plugin.GetPluginName()), awsVolumes: awsCloud, }, nil } diff --git a/pkg/volume/aws_ebs/aws_ebs.go b/pkg/volume/aws_ebs/aws_ebs.go index 84498e4b9b..433d9325be 100644 --- a/pkg/volume/aws_ebs/aws_ebs.go +++ b/pkg/volume/aws_ebs/aws_ebs.go @@ -104,7 +104,7 @@ func (plugin *awsElasticBlockStorePlugin) GetAccessModes() []v1.PersistentVolume func (plugin *awsElasticBlockStorePlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volume.VolumeOptions) (volume.Mounter, error) { // Inject real implementations here, test through the internal function. - return plugin.newMounterInternal(spec, pod.UID, &AWSDiskUtil{}, plugin.host.GetMounter()) + return plugin.newMounterInternal(spec, pod.UID, &AWSDiskUtil{}, plugin.host.GetMounter(plugin.GetPluginName())) } func (plugin *awsElasticBlockStorePlugin) newMounterInternal(spec *volume.Spec, podUID types.UID, manager ebsManager, mounter mount.Interface) (volume.Mounter, error) { @@ -135,12 +135,12 @@ func (plugin *awsElasticBlockStorePlugin) newMounterInternal(spec *volume.Spec, }, fsType: fsType, readOnly: readOnly, - diskMounter: &mount.SafeFormatAndMount{Interface: plugin.host.GetMounter(), Runner: exec.New()}}, nil + diskMounter: &mount.SafeFormatAndMount{Interface: plugin.host.GetMounter(plugin.GetPluginName()), Runner: exec.New()}}, nil } func (plugin *awsElasticBlockStorePlugin) NewUnmounter(volName string, podUID types.UID) (volume.Unmounter, error) { // Inject real implementations here, test through the internal function. - return plugin.newUnmounterInternal(volName, podUID, &AWSDiskUtil{}, plugin.host.GetMounter()) + return plugin.newUnmounterInternal(volName, podUID, &AWSDiskUtil{}, plugin.host.GetMounter(plugin.GetPluginName())) } func (plugin *awsElasticBlockStorePlugin) newUnmounterInternal(volName string, podUID types.UID, manager ebsManager, mounter mount.Interface) (volume.Unmounter, error) { @@ -199,7 +199,7 @@ func getVolumeSource( } func (plugin *awsElasticBlockStorePlugin) ConstructVolumeSpec(volName, mountPath string) (*volume.Spec, error) { - mounter := plugin.host.GetMounter() + mounter := plugin.host.GetMounter(plugin.GetPluginName()) pluginDir := plugin.host.GetPluginDir(plugin.GetPluginName()) volumeID, err := mounter.GetDeviceNameFromMount(mountPath, pluginDir) if err != nil { diff --git a/pkg/volume/azure_dd/attacher.go b/pkg/volume/azure_dd/attacher.go index cf71f65b1a..43e300fd16 100644 --- a/pkg/volume/azure_dd/attacher.go +++ b/pkg/volume/azure_dd/attacher.go @@ -211,7 +211,7 @@ func (a *azureDiskAttacher) GetDeviceMountPath(spec *volume.Spec) (string, error } func (attacher *azureDiskAttacher) MountDevice(spec *volume.Spec, devicePath string, deviceMountPath string) error { - mounter := attacher.plugin.host.GetMounter() + mounter := attacher.plugin.host.GetMounter(azureDataDiskPluginName) notMnt, err := mounter.IsLikelyNotMountPoint(deviceMountPath) if err != nil { @@ -277,7 +277,7 @@ func (d *azureDiskDetacher) Detach(diskURI string, nodeName types.NodeName) erro // UnmountDevice unmounts the volume on the node func (detacher *azureDiskDetacher) UnmountDevice(deviceMountPath string) error { - err := volumeutil.UnmountPath(deviceMountPath, detacher.plugin.host.GetMounter()) + err := volumeutil.UnmountPath(deviceMountPath, detacher.plugin.host.GetMounter(detacher.plugin.GetPluginName())) if err == nil { glog.V(4).Infof("azureDisk - Device %s was unmounted", deviceMountPath) } else { diff --git a/pkg/volume/azure_dd/azure_dd.go b/pkg/volume/azure_dd/azure_dd.go index 49b68cdd43..80d9b98b17 100644 --- a/pkg/volume/azure_dd/azure_dd.go +++ b/pkg/volume/azure_dd/azure_dd.go @@ -190,7 +190,7 @@ func (plugin *azureDataDiskPlugin) NewUnmounter(volName string, podUID types.UID } func (plugin *azureDataDiskPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.Spec, error) { - mounter := plugin.host.GetMounter() + mounter := plugin.host.GetMounter(plugin.GetPluginName()) pluginDir := plugin.host.GetPluginDir(plugin.GetPluginName()) sourceName, err := mounter.GetDeviceNameFromMount(mountPath, pluginDir) @@ -210,6 +210,6 @@ func (plugin *azureDataDiskPlugin) ConstructVolumeSpec(volumeName, mountPath str } func (plugin *azureDataDiskPlugin) GetDeviceMountRefs(deviceMountPath string) ([]string, error) { - m := plugin.host.GetMounter() + m := plugin.host.GetMounter(plugin.GetPluginName()) return mount.GetMountRefs(m, deviceMountPath) } diff --git a/pkg/volume/azure_dd/azure_mounter.go b/pkg/volume/azure_dd/azure_mounter.go index eedb5535f7..2af044c369 100644 --- a/pkg/volume/azure_dd/azure_mounter.go +++ b/pkg/volume/azure_dd/azure_mounter.go @@ -63,7 +63,7 @@ func (m *azureDiskMounter) GetPath() string { } func (m *azureDiskMounter) SetUpAt(dir string, fsGroup *int64) error { - mounter := m.plugin.host.GetMounter() + mounter := m.plugin.host.GetMounter(m.plugin.GetPluginName()) volumeSource, err := getVolumeSource(m.spec) if err != nil { @@ -154,7 +154,7 @@ func (u *azureDiskUnmounter) TearDownAt(dir string) error { } glog.V(4).Infof("azureDisk - TearDownAt: %s", dir) - mounter := u.plugin.host.GetMounter() + mounter := u.plugin.host.GetMounter(u.plugin.GetPluginName()) mountPoint, err := mounter.IsLikelyNotMountPoint(dir) if err != nil { return fmt.Errorf("azureDisk - TearDownAt: %s failed to do IsLikelyNotMountPoint %s", dir, err) diff --git a/pkg/volume/azure_file/azure_file.go b/pkg/volume/azure_file/azure_file.go index 426900a1f2..2607716238 100644 --- a/pkg/volume/azure_file/azure_file.go +++ b/pkg/volume/azure_file/azure_file.go @@ -98,7 +98,7 @@ func (plugin *azureFilePlugin) GetAccessModes() []v1.PersistentVolumeAccessMode } func (plugin *azureFilePlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volume.VolumeOptions) (volume.Mounter, error) { - return plugin.newMounterInternal(spec, pod, &azureSvc{}, plugin.host.GetMounter()) + return plugin.newMounterInternal(spec, pod, &azureSvc{}, plugin.host.GetMounter(plugin.GetPluginName())) } func (plugin *azureFilePlugin) newMounterInternal(spec *volume.Spec, pod *v1.Pod, util azureUtil, mounter mount.Interface) (volume.Mounter, error) { @@ -124,7 +124,7 @@ func (plugin *azureFilePlugin) newMounterInternal(spec *volume.Spec, pod *v1.Pod } func (plugin *azureFilePlugin) NewUnmounter(volName string, podUID types.UID) (volume.Unmounter, error) { - return plugin.newUnmounterInternal(volName, podUID, plugin.host.GetMounter()) + return plugin.newUnmounterInternal(volName, podUID, plugin.host.GetMounter(plugin.GetPluginName())) } func (plugin *azureFilePlugin) newUnmounterInternal(volName string, podUID types.UID, mounter mount.Interface) (volume.Unmounter, error) { diff --git a/pkg/volume/cephfs/cephfs.go b/pkg/volume/cephfs/cephfs.go index 5ea4e6137e..450c5501bb 100644 --- a/pkg/volume/cephfs/cephfs.go +++ b/pkg/volume/cephfs/cephfs.go @@ -110,7 +110,7 @@ func (plugin *cephfsPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volume. glog.V(4).Infof("found ceph secret info: %s", name) } } - return plugin.newMounterInternal(spec, pod.UID, plugin.host.GetMounter(), secret) + return plugin.newMounterInternal(spec, pod.UID, plugin.host.GetMounter(plugin.GetPluginName()), secret) } func (plugin *cephfsPlugin) newMounterInternal(spec *volume.Spec, podUID types.UID, mounter mount.Interface, secret string) (volume.Mounter, error) { @@ -153,7 +153,7 @@ func (plugin *cephfsPlugin) newMounterInternal(spec *volume.Spec, podUID types.U } func (plugin *cephfsPlugin) NewUnmounter(volName string, podUID types.UID) (volume.Unmounter, error) { - return plugin.newUnmounterInternal(volName, podUID, plugin.host.GetMounter()) + return plugin.newUnmounterInternal(volName, podUID, plugin.host.GetMounter(plugin.GetPluginName())) } func (plugin *cephfsPlugin) newUnmounterInternal(volName string, podUID types.UID, mounter mount.Interface) (volume.Unmounter, error) { diff --git a/pkg/volume/cinder/attacher.go b/pkg/volume/cinder/attacher.go index 901876d16b..024af41c73 100644 --- a/pkg/volume/cinder/attacher.go +++ b/pkg/volume/cinder/attacher.go @@ -66,7 +66,7 @@ func (plugin *cinderPlugin) NewAttacher() (volume.Attacher, error) { } func (plugin *cinderPlugin) GetDeviceMountRefs(deviceMountPath string) ([]string, error) { - mounter := plugin.host.GetMounter() + mounter := plugin.host.GetMounter(plugin.GetPluginName()) return mount.GetMountRefs(mounter, deviceMountPath) } @@ -262,7 +262,7 @@ func (attacher *cinderDiskAttacher) GetDeviceMountPath( // FIXME: this method can be further pruned. func (attacher *cinderDiskAttacher) MountDevice(spec *volume.Spec, devicePath string, deviceMountPath string) error { - mounter := attacher.host.GetMounter() + mounter := attacher.host.GetMounter(cinderVolumePluginName) notMnt, err := mounter.IsLikelyNotMountPoint(deviceMountPath) if err != nil { if os.IsNotExist(err) { @@ -309,7 +309,7 @@ func (plugin *cinderPlugin) NewDetacher() (volume.Detacher, error) { return nil, err } return &cinderDiskDetacher{ - mounter: plugin.host.GetMounter(), + mounter: plugin.host.GetMounter(plugin.GetPluginName()), cinderProvider: cinder, }, nil } diff --git a/pkg/volume/cinder/cinder.go b/pkg/volume/cinder/cinder.go index 034a5f8e8c..d045a7128b 100644 --- a/pkg/volume/cinder/cinder.go +++ b/pkg/volume/cinder/cinder.go @@ -116,7 +116,7 @@ func (plugin *cinderPlugin) GetAccessModes() []v1.PersistentVolumeAccessMode { } func (plugin *cinderPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volume.VolumeOptions) (volume.Mounter, error) { - return plugin.newMounterInternal(spec, pod.UID, &CinderDiskUtil{}, plugin.host.GetMounter()) + return plugin.newMounterInternal(spec, pod.UID, &CinderDiskUtil{}, plugin.host.GetMounter(plugin.GetPluginName())) } func (plugin *cinderPlugin) newMounterInternal(spec *volume.Spec, podUID types.UID, manager cdManager, mounter mount.Interface) (volume.Mounter, error) { @@ -143,7 +143,7 @@ func (plugin *cinderPlugin) newMounterInternal(spec *volume.Spec, podUID types.U } func (plugin *cinderPlugin) NewUnmounter(volName string, podUID types.UID) (volume.Unmounter, error) { - return plugin.newUnmounterInternal(volName, podUID, &CinderDiskUtil{}, plugin.host.GetMounter()) + return plugin.newUnmounterInternal(volName, podUID, &CinderDiskUtil{}, plugin.host.GetMounter(plugin.GetPluginName())) } func (plugin *cinderPlugin) newUnmounterInternal(volName string, podUID types.UID, manager cdManager, mounter mount.Interface) (volume.Unmounter, error) { @@ -216,7 +216,7 @@ func (plugin *cinderPlugin) getCloudProvider() (CinderProvider, error) { } func (plugin *cinderPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.Spec, error) { - mounter := plugin.host.GetMounter() + mounter := plugin.host.GetMounter(plugin.GetPluginName()) pluginDir := plugin.host.GetPluginDir(plugin.GetPluginName()) sourceName, err := mounter.GetDeviceNameFromMount(mountPath, pluginDir) if err != nil { diff --git a/pkg/volume/configmap/configmap.go b/pkg/volume/configmap/configmap.go index af05aef114..94b83b7ed7 100644 --- a/pkg/volume/configmap/configmap.go +++ b/pkg/volume/configmap/configmap.go @@ -92,7 +92,7 @@ func (plugin *configMapPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, opts v spec.Name(), pod.UID, plugin, - plugin.host.GetMounter(), + plugin.host.GetMounter(plugin.GetPluginName()), plugin.host.GetWriter(), volume.MetricsNil{}, }, @@ -109,7 +109,7 @@ func (plugin *configMapPlugin) NewUnmounter(volName string, podUID types.UID) (v volName, podUID, plugin, - plugin.host.GetMounter(), + plugin.host.GetMounter(plugin.GetPluginName()), plugin.host.GetWriter(), volume.MetricsNil{}, }, diff --git a/pkg/volume/empty_dir/empty_dir.go b/pkg/volume/empty_dir/empty_dir.go index 2cb1aba212..76da7c3cff 100644 --- a/pkg/volume/empty_dir/empty_dir.go +++ b/pkg/volume/empty_dir/empty_dir.go @@ -99,7 +99,7 @@ func (plugin *emptyDirPlugin) SupportsBulkVolumeVerification() bool { } func (plugin *emptyDirPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, opts volume.VolumeOptions) (volume.Mounter, error) { - return plugin.newMounterInternal(spec, pod, plugin.host.GetMounter(), &realMountDetector{plugin.host.GetMounter()}, opts) + return plugin.newMounterInternal(spec, pod, plugin.host.GetMounter(plugin.GetPluginName()), &realMountDetector{plugin.host.GetMounter(plugin.GetPluginName())}, opts) } func (plugin *emptyDirPlugin) newMounterInternal(spec *volume.Spec, pod *v1.Pod, mounter mount.Interface, mountDetector mountDetector, opts volume.VolumeOptions) (volume.Mounter, error) { @@ -120,7 +120,7 @@ func (plugin *emptyDirPlugin) newMounterInternal(spec *volume.Spec, pod *v1.Pod, func (plugin *emptyDirPlugin) NewUnmounter(volName string, podUID types.UID) (volume.Unmounter, error) { // Inject real implementations here, test through the internal function. - return plugin.newUnmounterInternal(volName, podUID, plugin.host.GetMounter(), &realMountDetector{plugin.host.GetMounter()}) + return plugin.newUnmounterInternal(volName, podUID, plugin.host.GetMounter(plugin.GetPluginName()), &realMountDetector{plugin.host.GetMounter(plugin.GetPluginName())}) } func (plugin *emptyDirPlugin) newUnmounterInternal(volName string, podUID types.UID, mounter mount.Interface, mountDetector mountDetector) (volume.Unmounter, error) { diff --git a/pkg/volume/fc/attacher.go b/pkg/volume/fc/attacher.go index c0e469c35b..52f4a26d28 100644 --- a/pkg/volume/fc/attacher.go +++ b/pkg/volume/fc/attacher.go @@ -50,7 +50,7 @@ func (plugin *fcPlugin) NewAttacher() (volume.Attacher, error) { } func (plugin *fcPlugin) GetDeviceMountRefs(deviceMountPath string) ([]string, error) { - mounter := plugin.host.GetMounter() + mounter := plugin.host.GetMounter(plugin.GetPluginName()) return mount.GetMountRefs(mounter, deviceMountPath) } @@ -88,7 +88,7 @@ func (attacher *fcAttacher) GetDeviceMountPath( } func (attacher *fcAttacher) MountDevice(spec *volume.Spec, devicePath string, deviceMountPath string) error { - mounter := attacher.host.GetMounter() + mounter := attacher.host.GetMounter(fcPluginName) notMnt, err := mounter.IsLikelyNotMountPoint(deviceMountPath) if err != nil { if os.IsNotExist(err) { @@ -132,7 +132,7 @@ var _ volume.Detacher = &fcDetacher{} func (plugin *fcPlugin) NewDetacher() (volume.Detacher, error) { return &fcDetacher{ - mounter: plugin.host.GetMounter(), + mounter: plugin.host.GetMounter(plugin.GetPluginName()), manager: &FCUtil{}, exe: exec.New(), }, nil @@ -192,7 +192,7 @@ func volumeSpecToMounter(spec *volume.Spec, host volume.VolumeHost) (*fcDiskMoun }, fsType: fc.FSType, readOnly: readOnly, - mounter: &mount.SafeFormatAndMount{Interface: host.GetMounter(), Runner: exec.New()}, + mounter: &mount.SafeFormatAndMount{Interface: host.GetMounter(fcPluginName), Runner: exec.New()}, }, nil } diff --git a/pkg/volume/fc/fc.go b/pkg/volume/fc/fc.go index 26e69bd709..079187320e 100644 --- a/pkg/volume/fc/fc.go +++ b/pkg/volume/fc/fc.go @@ -103,7 +103,7 @@ func (plugin *fcPlugin) GetAccessModes() []v1.PersistentVolumeAccessMode { func (plugin *fcPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volume.VolumeOptions) (volume.Mounter, error) { // Inject real implementations here, test through the internal function. - return plugin.newMounterInternal(spec, pod.UID, &FCUtil{}, plugin.host.GetMounter()) + return plugin.newMounterInternal(spec, pod.UID, &FCUtil{}, plugin.host.GetMounter(plugin.GetPluginName())) } func (plugin *fcPlugin) newMounterInternal(spec *volume.Spec, podUID types.UID, manager diskManager, mounter mount.Interface) (volume.Mounter, error) { @@ -144,7 +144,7 @@ func (plugin *fcPlugin) newMounterInternal(spec *volume.Spec, podUID types.UID, func (plugin *fcPlugin) NewUnmounter(volName string, podUID types.UID) (volume.Unmounter, error) { // Inject real implementations here, test through the internal function. - return plugin.newUnmounterInternal(volName, podUID, &FCUtil{}, plugin.host.GetMounter()) + return plugin.newUnmounterInternal(volName, podUID, &FCUtil{}, plugin.host.GetMounter(plugin.GetPluginName())) } func (plugin *fcPlugin) newUnmounterInternal(volName string, podUID types.UID, manager diskManager, mounter mount.Interface) (volume.Unmounter, error) { diff --git a/pkg/volume/flexvolume/attacher.go b/pkg/volume/flexvolume/attacher.go index 73575be4c4..00f1d5d487 100644 --- a/pkg/volume/flexvolume/attacher.go +++ b/pkg/volume/flexvolume/attacher.go @@ -69,7 +69,7 @@ func (a *flexVolumeAttacher) GetDeviceMountPath(spec *volume.Spec) (string, erro // MountDevice is part of the volume.Attacher interface func (a *flexVolumeAttacher) MountDevice(spec *volume.Spec, devicePath string, deviceMountPath string) error { // Mount only once. - alreadyMounted, err := prepareForMount(a.plugin.host.GetMounter(), deviceMountPath) + alreadyMounted, err := prepareForMount(a.plugin.host.GetMounter(a.plugin.GetPluginName()), deviceMountPath) if err != nil { return err } @@ -87,7 +87,7 @@ func (a *flexVolumeAttacher) MountDevice(spec *volume.Spec, devicePath string, d // Devicepath is empty if the plugin does not support attach calls. Ignore mountDevice calls if the // plugin does not implement attach interface. if devicePath != "" { - return (*attacherDefaults)(a).MountDevice(spec, devicePath, deviceMountPath, a.plugin.host.GetMounter()) + return (*attacherDefaults)(a).MountDevice(spec, devicePath, deviceMountPath, a.plugin.host.GetMounter(a.plugin.GetPluginName())) } else { return nil } diff --git a/pkg/volume/flexvolume/detacher-defaults.go b/pkg/volume/flexvolume/detacher-defaults.go index 3226836f90..17c85a3653 100644 --- a/pkg/volume/flexvolume/detacher-defaults.go +++ b/pkg/volume/flexvolume/detacher-defaults.go @@ -41,5 +41,5 @@ func (d *detacherDefaults) WaitForDetach(devicePath string, timeout time.Duratio // UnmountDevice is part of the volume.Detacher interface. func (d *detacherDefaults) UnmountDevice(deviceMountPath string) error { glog.Warning(logPrefix(d.plugin.flexVolumePlugin), "using default UnmountDevice for device mount path ", deviceMountPath) - return util.UnmountPath(deviceMountPath, d.plugin.host.GetMounter()) + return util.UnmountPath(deviceMountPath, d.plugin.host.GetMounter(d.plugin.GetPluginName())) } diff --git a/pkg/volume/flexvolume/detacher.go b/pkg/volume/flexvolume/detacher.go index dcca403619..4acbd03eae 100644 --- a/pkg/volume/flexvolume/detacher.go +++ b/pkg/volume/flexvolume/detacher.go @@ -69,7 +69,7 @@ func (d *flexVolumeDetacher) UnmountDevice(deviceMountPath string) error { return nil } - notmnt, err := isNotMounted(d.plugin.host.GetMounter(), deviceMountPath) + notmnt, err := isNotMounted(d.plugin.host.GetMounter(d.plugin.GetPluginName()), deviceMountPath) if err != nil { return err } diff --git a/pkg/volume/flexvolume/plugin.go b/pkg/volume/flexvolume/plugin.go index 7b37514009..cd1de0a6be 100644 --- a/pkg/volume/flexvolume/plugin.go +++ b/pkg/volume/flexvolume/plugin.go @@ -158,7 +158,7 @@ func (plugin *flexVolumePlugin) GetAccessModes() []api.PersistentVolumeAccessMod // NewMounter is part of the volume.VolumePlugin interface. func (plugin *flexVolumePlugin) NewMounter(spec *volume.Spec, pod *api.Pod, _ volume.VolumeOptions) (volume.Mounter, error) { - return plugin.newMounterInternal(spec, pod, plugin.host.GetMounter(), plugin.runner) + return plugin.newMounterInternal(spec, pod, plugin.host.GetMounter(plugin.GetPluginName()), plugin.runner) } // newMounterInternal is the internal mounter routine to build the volume. @@ -185,7 +185,7 @@ func (plugin *flexVolumePlugin) newMounterInternal(spec *volume.Spec, pod *api.P // NewUnmounter is part of the volume.VolumePlugin interface. func (plugin *flexVolumePlugin) NewUnmounter(volName string, podUID types.UID) (volume.Unmounter, error) { - return plugin.newUnmounterInternal(volName, podUID, plugin.host.GetMounter(), plugin.runner) + return plugin.newUnmounterInternal(volName, podUID, plugin.host.GetMounter(plugin.GetPluginName()), plugin.runner) } // newUnmounterInternal is the internal unmounter routine to clean the volume. @@ -254,7 +254,7 @@ func (plugin *flexVolumePlugin) isUnsupported(command string) bool { } func (plugin *flexVolumePlugin) GetDeviceMountRefs(deviceMountPath string) ([]string, error) { - mounter := plugin.host.GetMounter() + mounter := plugin.host.GetMounter(plugin.GetPluginName()) return mount.GetMountRefs(mounter, deviceMountPath) } diff --git a/pkg/volume/flocker/flocker.go b/pkg/volume/flocker/flocker.go index 33acb0a81f..18a59b7422 100644 --- a/pkg/volume/flocker/flocker.go +++ b/pkg/volume/flocker/flocker.go @@ -138,7 +138,7 @@ func (p *flockerPlugin) getFlockerVolumeSource(spec *volume.Spec) (*v1.FlockerVo func (plugin *flockerPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volume.VolumeOptions) (volume.Mounter, error) { // Inject real implementations here, test through the internal function. - return plugin.newMounterInternal(spec, pod.UID, &FlockerUtil{}, plugin.host.GetMounter()) + return plugin.newMounterInternal(spec, pod.UID, &FlockerUtil{}, plugin.host.GetMounter(plugin.GetPluginName())) } func (plugin *flockerPlugin) newMounterInternal(spec *volume.Spec, podUID types.UID, manager volumeManager, mounter mount.Interface) (volume.Mounter, error) { @@ -166,7 +166,7 @@ func (plugin *flockerPlugin) newMounterInternal(spec *volume.Spec, podUID types. func (p *flockerPlugin) NewUnmounter(volName string, podUID types.UID) (volume.Unmounter, error) { // Inject real implementations here, test through the internal function. - return p.newUnmounterInternal(volName, podUID, &FlockerUtil{}, p.host.GetMounter()) + return p.newUnmounterInternal(volName, podUID, &FlockerUtil{}, p.host.GetMounter(p.GetPluginName())) } func (p *flockerPlugin) newUnmounterInternal(volName string, podUID types.UID, manager volumeManager, mounter mount.Interface) (volume.Unmounter, error) { diff --git a/pkg/volume/gce_pd/attacher.go b/pkg/volume/gce_pd/attacher.go index 0cf8b3d672..4801b80101 100644 --- a/pkg/volume/gce_pd/attacher.go +++ b/pkg/volume/gce_pd/attacher.go @@ -56,7 +56,7 @@ func (plugin *gcePersistentDiskPlugin) NewAttacher() (volume.Attacher, error) { } func (plugin *gcePersistentDiskPlugin) GetDeviceMountRefs(deviceMountPath string) ([]string, error) { - mounter := plugin.host.GetMounter() + mounter := plugin.host.GetMounter(plugin.GetPluginName()) return mount.GetMountRefs(mounter, deviceMountPath) } @@ -185,7 +185,7 @@ func (attacher *gcePersistentDiskAttacher) GetDeviceMountPath( func (attacher *gcePersistentDiskAttacher) MountDevice(spec *volume.Spec, devicePath string, deviceMountPath string) error { // Only mount the PD globally once. - mounter := attacher.host.GetMounter() + mounter := attacher.host.GetMounter(gcePersistentDiskPluginName) notMnt, err := mounter.IsLikelyNotMountPoint(deviceMountPath) if err != nil { if os.IsNotExist(err) { @@ -272,5 +272,5 @@ func (detacher *gcePersistentDiskDetacher) Detach(deviceMountPath string, nodeNa } func (detacher *gcePersistentDiskDetacher) UnmountDevice(deviceMountPath string) error { - return volumeutil.UnmountPath(deviceMountPath, detacher.host.GetMounter()) + return volumeutil.UnmountPath(deviceMountPath, detacher.host.GetMounter(gcePersistentDiskPluginName)) } diff --git a/pkg/volume/gce_pd/gce_pd.go b/pkg/volume/gce_pd/gce_pd.go index b59835b387..25f7127fe8 100644 --- a/pkg/volume/gce_pd/gce_pd.go +++ b/pkg/volume/gce_pd/gce_pd.go @@ -100,7 +100,7 @@ func (plugin *gcePersistentDiskPlugin) GetAccessModes() []v1.PersistentVolumeAcc func (plugin *gcePersistentDiskPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volume.VolumeOptions) (volume.Mounter, error) { // Inject real implementations here, test through the internal function. - return plugin.newMounterInternal(spec, pod.UID, &GCEDiskUtil{}, plugin.host.GetMounter()) + return plugin.newMounterInternal(spec, pod.UID, &GCEDiskUtil{}, plugin.host.GetMounter(plugin.GetPluginName())) } func getVolumeSource( @@ -145,7 +145,7 @@ func (plugin *gcePersistentDiskPlugin) newMounterInternal(spec *volume.Spec, pod func (plugin *gcePersistentDiskPlugin) NewUnmounter(volName string, podUID types.UID) (volume.Unmounter, error) { // Inject real implementations here, test through the internal function. - return plugin.newUnmounterInternal(volName, podUID, &GCEDiskUtil{}, plugin.host.GetMounter()) + return plugin.newUnmounterInternal(volName, podUID, &GCEDiskUtil{}, plugin.host.GetMounter(plugin.GetPluginName())) } func (plugin *gcePersistentDiskPlugin) newUnmounterInternal(volName string, podUID types.UID, manager pdManager, mounter mount.Interface) (volume.Unmounter, error) { @@ -191,7 +191,7 @@ func (plugin *gcePersistentDiskPlugin) newProvisionerInternal(options volume.Vol } func (plugin *gcePersistentDiskPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.Spec, error) { - mounter := plugin.host.GetMounter() + mounter := plugin.host.GetMounter(plugin.GetPluginName()) pluginDir := plugin.host.GetPluginDir(plugin.GetPluginName()) sourceName, err := mounter.GetDeviceNameFromMount(mountPath, pluginDir) if err != nil { diff --git a/pkg/volume/glusterfs/glusterfs.go b/pkg/volume/glusterfs/glusterfs.go index 9088688f3b..1499428f32 100644 --- a/pkg/volume/glusterfs/glusterfs.go +++ b/pkg/volume/glusterfs/glusterfs.go @@ -152,7 +152,7 @@ func (plugin *glusterfsPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volu return nil, err } glog.V(1).Infof("glusterfs: endpoints %v", ep) - return plugin.newMounterInternal(spec, ep, pod, plugin.host.GetMounter(), exec.New()) + return plugin.newMounterInternal(spec, ep, pod, plugin.host.GetMounter(plugin.GetPluginName()), exec.New()) } func (plugin *glusterfsPlugin) getGlusterVolumeSource(spec *volume.Spec) (*v1.GlusterfsVolumeSource, bool) { @@ -182,7 +182,7 @@ func (plugin *glusterfsPlugin) newMounterInternal(spec *volume.Spec, ep *v1.Endp } func (plugin *glusterfsPlugin) NewUnmounter(volName string, podUID types.UID) (volume.Unmounter, error) { - return plugin.newUnmounterInternal(volName, podUID, plugin.host.GetMounter()) + return plugin.newUnmounterInternal(volName, podUID, plugin.host.GetMounter(plugin.GetPluginName())) } func (plugin *glusterfsPlugin) newUnmounterInternal(volName string, podUID types.UID, mounter mount.Interface) (volume.Unmounter, error) { diff --git a/pkg/volume/iscsi/iscsi.go b/pkg/volume/iscsi/iscsi.go index 3e47cc02a9..d21295ede6 100644 --- a/pkg/volume/iscsi/iscsi.go +++ b/pkg/volume/iscsi/iscsi.go @@ -112,7 +112,7 @@ func (plugin *iscsiPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volume.V } } - return plugin.newMounterInternal(spec, pod.UID, &ISCSIUtil{}, plugin.host.GetMounter(), secret) + return plugin.newMounterInternal(spec, pod.UID, &ISCSIUtil{}, plugin.host.GetMounter(plugin.GetPluginName()), secret) } func (plugin *iscsiPlugin) newMounterInternal(spec *volume.Spec, podUID types.UID, manager diskManager, mounter mount.Interface, secret map[string]string) (volume.Mounter, error) { @@ -155,7 +155,7 @@ func (plugin *iscsiPlugin) newMounterInternal(spec *volume.Spec, podUID types.UI func (plugin *iscsiPlugin) NewUnmounter(volName string, podUID types.UID) (volume.Unmounter, error) { // Inject real implementations here, test through the internal function. - return plugin.newUnmounterInternal(volName, podUID, &ISCSIUtil{}, plugin.host.GetMounter()) + return plugin.newUnmounterInternal(volName, podUID, &ISCSIUtil{}, plugin.host.GetMounter(plugin.GetPluginName())) } func (plugin *iscsiPlugin) newUnmounterInternal(volName string, podUID types.UID, manager diskManager, mounter mount.Interface) (volume.Unmounter, error) { diff --git a/pkg/volume/local/local.go b/pkg/volume/local/local.go index 33c1acbb68..e7316e248d 100644 --- a/pkg/volume/local/local.go +++ b/pkg/volume/local/local.go @@ -104,7 +104,7 @@ func (plugin *localVolumePlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ vo localVolume: &localVolume{ podUID: pod.UID, volName: spec.Name(), - mounter: plugin.host.GetMounter(), + mounter: plugin.host.GetMounter(plugin.GetPluginName()), plugin: plugin, globalPath: volumeSource.Path, MetricsProvider: volume.NewMetricsStatFS(volumeSource.Path), @@ -119,7 +119,7 @@ func (plugin *localVolumePlugin) NewUnmounter(volName string, podUID types.UID) localVolume: &localVolume{ podUID: podUID, volName: volName, - mounter: plugin.host.GetMounter(), + mounter: plugin.host.GetMounter(plugin.GetPluginName()), plugin: plugin, }, }, nil diff --git a/pkg/volume/nfs/nfs.go b/pkg/volume/nfs/nfs.go index 52169caf34..8d519f76bc 100644 --- a/pkg/volume/nfs/nfs.go +++ b/pkg/volume/nfs/nfs.go @@ -105,7 +105,7 @@ func (plugin *nfsPlugin) GetAccessModes() []v1.PersistentVolumeAccessMode { } func (plugin *nfsPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volume.VolumeOptions) (volume.Mounter, error) { - return plugin.newMounterInternal(spec, pod, plugin.host.GetMounter()) + return plugin.newMounterInternal(spec, pod, plugin.host.GetMounter(plugin.GetPluginName())) } func (plugin *nfsPlugin) newMounterInternal(spec *volume.Spec, pod *v1.Pod, mounter mount.Interface) (volume.Mounter, error) { @@ -129,7 +129,7 @@ func (plugin *nfsPlugin) newMounterInternal(spec *volume.Spec, pod *v1.Pod, moun } func (plugin *nfsPlugin) NewUnmounter(volName string, podUID types.UID) (volume.Unmounter, error) { - return plugin.newUnmounterInternal(volName, podUID, plugin.host.GetMounter()) + return plugin.newUnmounterInternal(volName, podUID, plugin.host.GetMounter(plugin.GetPluginName())) } func (plugin *nfsPlugin) newUnmounterInternal(volName string, podUID types.UID, mounter mount.Interface) (volume.Unmounter, error) { diff --git a/pkg/volume/photon_pd/attacher.go b/pkg/volume/photon_pd/attacher.go index b68fcc2653..0c3e59297a 100644 --- a/pkg/volume/photon_pd/attacher.go +++ b/pkg/volume/photon_pd/attacher.go @@ -180,13 +180,13 @@ func (attacher *photonPersistentDiskAttacher) GetDeviceMountPath(spec *volume.Sp // GetMountDeviceRefs finds all other references to the device referenced // by deviceMountPath; returns a list of paths. func (plugin *photonPersistentDiskPlugin) GetDeviceMountRefs(deviceMountPath string) ([]string, error) { - mounter := plugin.host.GetMounter() + mounter := plugin.host.GetMounter(plugin.GetPluginName()) return mount.GetMountRefs(mounter, deviceMountPath) } // MountDevice mounts device to global mount point. func (attacher *photonPersistentDiskAttacher) MountDevice(spec *volume.Spec, devicePath string, deviceMountPath string) error { - mounter := attacher.host.GetMounter() + mounter := attacher.host.GetMounter(photonPersistentDiskPluginName) notMnt, err := mounter.IsLikelyNotMountPoint(deviceMountPath) if err != nil { if os.IsNotExist(err) { @@ -236,7 +236,7 @@ func (plugin *photonPersistentDiskPlugin) NewDetacher() (volume.Detacher, error) } return &photonPersistentDiskDetacher{ - mounter: plugin.host.GetMounter(), + mounter: plugin.host.GetMounter(plugin.GetPluginName()), photonDisks: photonCloud, }, nil } diff --git a/pkg/volume/photon_pd/photon_pd.go b/pkg/volume/photon_pd/photon_pd.go index 446cd9aa06..2a6bac269f 100644 --- a/pkg/volume/photon_pd/photon_pd.go +++ b/pkg/volume/photon_pd/photon_pd.go @@ -89,11 +89,11 @@ func (plugin *photonPersistentDiskPlugin) SupportsBulkVolumeVerification() bool } func (plugin *photonPersistentDiskPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volume.VolumeOptions) (volume.Mounter, error) { - return plugin.newMounterInternal(spec, pod.UID, &PhotonDiskUtil{}, plugin.host.GetMounter()) + return plugin.newMounterInternal(spec, pod.UID, &PhotonDiskUtil{}, plugin.host.GetMounter(plugin.GetPluginName())) } func (plugin *photonPersistentDiskPlugin) NewUnmounter(volName string, podUID types.UID) (volume.Unmounter, error) { - return plugin.newUnmounterInternal(volName, podUID, &PhotonDiskUtil{}, plugin.host.GetMounter()) + return plugin.newUnmounterInternal(volName, podUID, &PhotonDiskUtil{}, plugin.host.GetMounter(plugin.GetPluginName())) } func (plugin *photonPersistentDiskPlugin) newMounterInternal(spec *volume.Spec, podUID types.UID, manager pdManager, mounter mount.Interface) (volume.Mounter, error) { @@ -131,7 +131,7 @@ func (plugin *photonPersistentDiskPlugin) newUnmounterInternal(volName string, p } func (plugin *photonPersistentDiskPlugin) ConstructVolumeSpec(volumeSpecName, mountPath string) (*volume.Spec, error) { - mounter := plugin.host.GetMounter() + mounter := plugin.host.GetMounter(plugin.GetPluginName()) pluginDir := plugin.host.GetPluginDir(plugin.GetPluginName()) pdID, err := mounter.GetDeviceNameFromMount(mountPath, pluginDir) if err != nil { diff --git a/pkg/volume/plugins.go b/pkg/volume/plugins.go index 1521a0afc7..60d6358d41 100644 --- a/pkg/volume/plugins.go +++ b/pkg/volume/plugins.go @@ -224,7 +224,7 @@ type VolumeHost interface { GetCloudProvider() cloudprovider.Interface // Get mounter interface. - GetMounter() mount.Interface + GetMounter(pluginName string) mount.Interface // Get writer interface for writing data to disk. GetWriter() io.Writer diff --git a/pkg/volume/portworx/portworx.go b/pkg/volume/portworx/portworx.go index e65d4687f4..bcac7ddcb6 100644 --- a/pkg/volume/portworx/portworx.go +++ b/pkg/volume/portworx/portworx.go @@ -91,7 +91,7 @@ func (plugin *portworxVolumePlugin) GetAccessModes() []v1.PersistentVolumeAccess } func (plugin *portworxVolumePlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volume.VolumeOptions) (volume.Mounter, error) { - return plugin.newMounterInternal(spec, pod.UID, plugin.util, plugin.host.GetMounter()) + return plugin.newMounterInternal(spec, pod.UID, plugin.util, plugin.host.GetMounter(plugin.GetPluginName())) } func (plugin *portworxVolumePlugin) newMounterInternal(spec *volume.Spec, podUID types.UID, manager portworxManager, mounter mount.Interface) (volume.Mounter, error) { @@ -115,11 +115,11 @@ func (plugin *portworxVolumePlugin) newMounterInternal(spec *volume.Spec, podUID }, fsType: fsType, readOnly: readOnly, - diskMounter: &mount.SafeFormatAndMount{Interface: plugin.host.GetMounter(), Runner: exec.New()}}, nil + diskMounter: &mount.SafeFormatAndMount{Interface: plugin.host.GetMounter(plugin.GetPluginName()), Runner: exec.New()}}, nil } func (plugin *portworxVolumePlugin) NewUnmounter(volName string, podUID types.UID) (volume.Unmounter, error) { - return plugin.newUnmounterInternal(volName, podUID, plugin.util, plugin.host.GetMounter()) + return plugin.newUnmounterInternal(volName, podUID, plugin.util, plugin.host.GetMounter(plugin.GetPluginName())) } func (plugin *portworxVolumePlugin) newUnmounterInternal(volName string, podUID types.UID, manager portworxManager, diff --git a/pkg/volume/quobyte/quobyte.go b/pkg/volume/quobyte/quobyte.go index a63d952aa2..e11376b96e 100644 --- a/pkg/volume/quobyte/quobyte.go +++ b/pkg/volume/quobyte/quobyte.go @@ -92,7 +92,7 @@ func (plugin *quobytePlugin) CanSupport(spec *volume.Spec) bool { } // If Quobyte is already mounted we don't need to check if the binary is installed - if mounter, err := plugin.newMounterInternal(spec, nil, plugin.host.GetMounter()); err == nil { + if mounter, err := plugin.newMounterInternal(spec, nil, plugin.host.GetMounter(plugin.GetPluginName())); err == nil { qm, _ := mounter.(*quobyteMounter) pluginDir := plugin.host.GetPluginDir(strings.EscapeQualifiedNameForDisk(quobytePluginName)) if mounted, err := qm.pluginDirIsMounted(pluginDir); mounted && err == nil { @@ -155,7 +155,7 @@ func (plugin *quobytePlugin) ConstructVolumeSpec(volumeName, mountPath string) ( } func (plugin *quobytePlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volume.VolumeOptions) (volume.Mounter, error) { - return plugin.newMounterInternal(spec, pod, plugin.host.GetMounter()) + return plugin.newMounterInternal(spec, pod, plugin.host.GetMounter(plugin.GetPluginName())) } func (plugin *quobytePlugin) newMounterInternal(spec *volume.Spec, pod *v1.Pod, mounter mount.Interface) (volume.Mounter, error) { @@ -181,7 +181,7 @@ func (plugin *quobytePlugin) newMounterInternal(spec *volume.Spec, pod *v1.Pod, } func (plugin *quobytePlugin) NewUnmounter(volName string, podUID types.UID) (volume.Unmounter, error) { - return plugin.newUnmounterInternal(volName, podUID, plugin.host.GetMounter()) + return plugin.newUnmounterInternal(volName, podUID, plugin.host.GetMounter(plugin.GetPluginName())) } func (plugin *quobytePlugin) newUnmounterInternal(volName string, podUID types.UID, mounter mount.Interface) (volume.Unmounter, error) { diff --git a/pkg/volume/rbd/rbd.go b/pkg/volume/rbd/rbd.go index ba06953e26..41cc28f819 100644 --- a/pkg/volume/rbd/rbd.go +++ b/pkg/volume/rbd/rbd.go @@ -131,7 +131,7 @@ func (plugin *rbdPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volume.Vol } // Inject real implementations here, test through the internal function. - return plugin.newMounterInternal(spec, pod.UID, &RBDUtil{}, plugin.host.GetMounter(), secret) + return plugin.newMounterInternal(spec, pod.UID, &RBDUtil{}, plugin.host.GetMounter(plugin.GetPluginName()), secret) } func (plugin *rbdPlugin) getRBDVolumeSource(spec *volume.Spec) (*v1.RBDVolumeSource, bool) { @@ -173,7 +173,7 @@ func (plugin *rbdPlugin) newMounterInternal(spec *volume.Spec, podUID types.UID, func (plugin *rbdPlugin) NewUnmounter(volName string, podUID types.UID) (volume.Unmounter, error) { // Inject real implementations here, test through the internal function. - return plugin.newUnmounterInternal(volName, podUID, &RBDUtil{}, plugin.host.GetMounter()) + return plugin.newUnmounterInternal(volName, podUID, &RBDUtil{}, plugin.host.GetMounter(plugin.GetPluginName())) } func (plugin *rbdPlugin) newUnmounterInternal(volName string, podUID types.UID, manager diskManager, mounter mount.Interface) (volume.Unmounter, error) { diff --git a/pkg/volume/scaleio/sio_plugin.go b/pkg/volume/scaleio/sio_plugin.go index 3b3a620aaf..69035dd3ba 100644 --- a/pkg/volume/scaleio/sio_plugin.go +++ b/pkg/volume/scaleio/sio_plugin.go @@ -53,7 +53,7 @@ var _ volume.VolumePlugin = &sioPlugin{} func (p *sioPlugin) Init(host volume.VolumeHost) error { p.host = host - p.mounter = host.GetMounter() + p.mounter = host.GetMounter(p.GetPluginName()) p.volumeMtx = keymutex.NewKeyMutex() return nil } diff --git a/pkg/volume/secret/secret.go b/pkg/volume/secret/secret.go index ae551e822d..67f4556e3f 100644 --- a/pkg/volume/secret/secret.go +++ b/pkg/volume/secret/secret.go @@ -99,7 +99,7 @@ func (plugin *secretPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, opts volu spec.Name(), pod.UID, plugin, - plugin.host.GetMounter(), + plugin.host.GetMounter(plugin.GetPluginName()), plugin.host.GetWriter(), volume.NewCachedMetrics(volume.NewMetricsDu(getPath(pod.UID, spec.Name(), plugin.host))), }, @@ -116,7 +116,7 @@ func (plugin *secretPlugin) NewUnmounter(volName string, podUID types.UID) (volu volName, podUID, plugin, - plugin.host.GetMounter(), + plugin.host.GetMounter(plugin.GetPluginName()), plugin.host.GetWriter(), volume.NewCachedMetrics(volume.NewMetricsDu(getPath(podUID, volName, plugin.host))), }, diff --git a/pkg/volume/storageos/storageos.go b/pkg/volume/storageos/storageos.go index 6541f2eeb3..cc575f5a1f 100644 --- a/pkg/volume/storageos/storageos.go +++ b/pkg/volume/storageos/storageos.go @@ -111,7 +111,7 @@ func (plugin *storageosPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volu return nil, err } - return plugin.newMounterInternal(spec, pod, apiCfg, &storageosUtil{}, plugin.host.GetMounter()) + return plugin.newMounterInternal(spec, pod, apiCfg, &storageosUtil{}, plugin.host.GetMounter(plugin.GetPluginName())) } func (plugin *storageosPlugin) newMounterInternal(spec *volume.Spec, pod *v1.Pod, apiCfg *storageosAPIConfig, manager storageosManager, mounter mount.Interface) (volume.Mounter, error) { @@ -142,7 +142,7 @@ func (plugin *storageosPlugin) newMounterInternal(spec *volume.Spec, pod *v1.Pod } func (plugin *storageosPlugin) NewUnmounter(pvName string, podUID types.UID) (volume.Unmounter, error) { - return plugin.newUnmounterInternal(pvName, podUID, &storageosUtil{}, plugin.host.GetMounter()) + return plugin.newUnmounterInternal(pvName, podUID, &storageosUtil{}, plugin.host.GetMounter(plugin.GetPluginName())) } func (plugin *storageosPlugin) newUnmounterInternal(pvName string, podUID types.UID, manager storageosManager, mounter mount.Interface) (volume.Unmounter, error) { diff --git a/pkg/volume/testing/testing.go b/pkg/volume/testing/testing.go index bc96bd6ecd..f632ce5d42 100644 --- a/pkg/volume/testing/testing.go +++ b/pkg/volume/testing/testing.go @@ -90,7 +90,7 @@ func (f *fakeVolumeHost) GetCloudProvider() cloudprovider.Interface { return f.cloud } -func (f *fakeVolumeHost) GetMounter() mount.Interface { +func (f *fakeVolumeHost) GetMounter(pluginName string) mount.Interface { return f.mounter } diff --git a/pkg/volume/vsphere_volume/attacher.go b/pkg/volume/vsphere_volume/attacher.go index f7a58c80d4..2cf90ab883 100644 --- a/pkg/volume/vsphere_volume/attacher.go +++ b/pkg/volume/vsphere_volume/attacher.go @@ -167,13 +167,13 @@ func (attacher *vsphereVMDKAttacher) GetDeviceMountPath(spec *volume.Spec) (stri // GetMountDeviceRefs finds all other references to the device referenced // by deviceMountPath; returns a list of paths. func (plugin *vsphereVolumePlugin) GetDeviceMountRefs(deviceMountPath string) ([]string, error) { - mounter := plugin.host.GetMounter() + mounter := plugin.host.GetMounter(plugin.GetPluginName()) return mount.GetMountRefs(mounter, deviceMountPath) } // MountDevice mounts device to global mount point. func (attacher *vsphereVMDKAttacher) MountDevice(spec *volume.Spec, devicePath string, deviceMountPath string) error { - mounter := attacher.host.GetMounter() + mounter := attacher.host.GetMounter(vsphereVolumePluginName) notMnt, err := mounter.IsLikelyNotMountPoint(deviceMountPath) if err != nil { if os.IsNotExist(err) { @@ -221,7 +221,7 @@ func (plugin *vsphereVolumePlugin) NewDetacher() (volume.Detacher, error) { } return &vsphereVMDKDetacher{ - mounter: plugin.host.GetMounter(), + mounter: plugin.host.GetMounter(plugin.GetPluginName()), vsphereVolumes: vsphereCloud, }, nil } diff --git a/pkg/volume/vsphere_volume/vsphere_volume.go b/pkg/volume/vsphere_volume/vsphere_volume.go index 0871055d33..36043df28f 100644 --- a/pkg/volume/vsphere_volume/vsphere_volume.go +++ b/pkg/volume/vsphere_volume/vsphere_volume.go @@ -90,11 +90,11 @@ func (plugin *vsphereVolumePlugin) SupportsBulkVolumeVerification() bool { } func (plugin *vsphereVolumePlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volume.VolumeOptions) (volume.Mounter, error) { - return plugin.newMounterInternal(spec, pod.UID, &VsphereDiskUtil{}, plugin.host.GetMounter()) + return plugin.newMounterInternal(spec, pod.UID, &VsphereDiskUtil{}, plugin.host.GetMounter(plugin.GetPluginName())) } func (plugin *vsphereVolumePlugin) NewUnmounter(volName string, podUID types.UID) (volume.Unmounter, error) { - return plugin.newUnmounterInternal(volName, podUID, &VsphereDiskUtil{}, plugin.host.GetMounter()) + return plugin.newUnmounterInternal(volName, podUID, &VsphereDiskUtil{}, plugin.host.GetMounter(plugin.GetPluginName())) } func (plugin *vsphereVolumePlugin) newMounterInternal(spec *volume.Spec, podUID types.UID, manager vdManager, mounter mount.Interface) (volume.Mounter, error) { @@ -131,7 +131,7 @@ func (plugin *vsphereVolumePlugin) newUnmounterInternal(volName string, podUID t } func (plugin *vsphereVolumePlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.Spec, error) { - mounter := plugin.host.GetMounter() + mounter := plugin.host.GetMounter(plugin.GetPluginName()) pluginDir := plugin.host.GetPluginDir(plugin.GetPluginName()) volumePath, err := mounter.GetDeviceNameFromMount(mountPath, pluginDir) if err != nil {