Adding volume metrics support for vSphere Cloud Provider

pull/6/head
Divyen Patel 2018-02-04 16:10:15 -08:00
parent 19131583eb
commit 46edaa7269
1 changed files with 18 additions and 12 deletions

View File

@ -52,6 +52,10 @@ const (
vsphereVolumePluginName = "kubernetes.io/vsphere-volume"
)
func getPath(uid types.UID, volName string, host volume.VolumeHost) string {
return host.GetPodVolumeDir(uid, utilstrings.EscapeQualifiedNameForDisk(vsphereVolumePluginName), volName)
}
// vSphere Volume Plugin
func (plugin *vsphereVolumePlugin) Init(host volume.VolumeHost) error {
plugin.host = host
@ -113,6 +117,7 @@ func (plugin *vsphereVolumePlugin) newMounterInternal(spec *volume.Spec, podUID
manager: manager,
mounter: mounter,
plugin: plugin,
MetricsProvider: volume.NewMetricsStatFS(getPath(podUID, spec.Name(), plugin.host)),
},
fsType: fsType,
diskMounter: volumehelper.NewSafeFormatAndMountFromHost(plugin.GetPluginName(), plugin.host)}, nil
@ -126,6 +131,7 @@ func (plugin *vsphereVolumePlugin) newUnmounterInternal(volName string, podUID t
manager: manager,
mounter: mounter,
plugin: plugin,
MetricsProvider: volume.NewMetricsStatFS(getPath(podUID, volName, plugin.host)),
}}, nil
}
@ -174,7 +180,7 @@ type vsphereVolume struct {
// diskMounter provides the interface that is used to mount the actual block device.
diskMounter mount.Interface
plugin *vsphereVolumePlugin
volume.MetricsNil
volume.MetricsProvider
}
var _ volume.Mounter = &vsphereVolumeMounter{}