mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-06 10:43:56 +00:00
Use MetricsStatsFs to expose RBD volume plugin metrics.
This commit is contained in:
parent
744455c69d
commit
777595ef6e
@ -66,6 +66,10 @@ const (
|
|||||||
rbdDefaultUserId = rbdDefaultAdminId
|
rbdDefaultUserId = rbdDefaultAdminId
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func getPath(uid types.UID, volName string, host volume.VolumeHost) string {
|
||||||
|
return host.GetPodVolumeDir(uid, strings.EscapeQualifiedNameForDisk(rbdPluginName), volName)
|
||||||
|
}
|
||||||
|
|
||||||
func (plugin *rbdPlugin) Init(host volume.VolumeHost) error {
|
func (plugin *rbdPlugin) Init(host volume.VolumeHost) error {
|
||||||
plugin.host = host
|
plugin.host = host
|
||||||
return nil
|
return nil
|
||||||
@ -156,6 +160,7 @@ func (plugin *rbdPlugin) newMounterInternal(spec *volume.Spec, podUID types.UID,
|
|||||||
manager: manager,
|
manager: manager,
|
||||||
mounter: &mount.SafeFormatAndMount{Interface: mounter, Runner: exec.New()},
|
mounter: &mount.SafeFormatAndMount{Interface: mounter, Runner: exec.New()},
|
||||||
plugin: plugin,
|
plugin: plugin,
|
||||||
|
MetricsProvider: volume.NewMetricsStatFS(getPath(podUID, spec.Name(), plugin.host)),
|
||||||
},
|
},
|
||||||
Mon: source.CephMonitors,
|
Mon: source.CephMonitors,
|
||||||
Id: id,
|
Id: id,
|
||||||
@ -180,6 +185,7 @@ func (plugin *rbdPlugin) newUnmounterInternal(volName string, podUID types.UID,
|
|||||||
manager: manager,
|
manager: manager,
|
||||||
mounter: &mount.SafeFormatAndMount{Interface: mounter, Runner: exec.New()},
|
mounter: &mount.SafeFormatAndMount{Interface: mounter, Runner: exec.New()},
|
||||||
plugin: plugin,
|
plugin: plugin,
|
||||||
|
MetricsProvider: volume.NewMetricsStatFS(getPath(podUID, volName, plugin.host)),
|
||||||
},
|
},
|
||||||
Mon: make([]string, 0),
|
Mon: make([]string, 0),
|
||||||
},
|
},
|
||||||
@ -378,8 +384,7 @@ type rbdVolumeDeleter struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *rbdVolumeDeleter) GetPath() string {
|
func (r *rbdVolumeDeleter) GetPath() string {
|
||||||
name := rbdPluginName
|
return getPath(r.podUID, r.volName, r.plugin.host)
|
||||||
return r.plugin.host.GetPodVolumeDir(r.podUID, strings.EscapeQualifiedNameForDisk(name), r.volName)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *rbdVolumeDeleter) Delete() error {
|
func (r *rbdVolumeDeleter) Delete() error {
|
||||||
@ -396,13 +401,12 @@ type rbd struct {
|
|||||||
mounter *mount.SafeFormatAndMount
|
mounter *mount.SafeFormatAndMount
|
||||||
// Utility interface that provides API calls to the provider to attach/detach disks.
|
// Utility interface that provides API calls to the provider to attach/detach disks.
|
||||||
manager diskManager
|
manager diskManager
|
||||||
volume.MetricsNil
|
volume.MetricsProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
func (rbd *rbd) GetPath() string {
|
func (rbd *rbd) GetPath() string {
|
||||||
name := rbdPluginName
|
|
||||||
// safe to use PodVolumeDir now: volume teardown occurs before pod is cleaned up
|
// safe to use PodVolumeDir now: volume teardown occurs before pod is cleaned up
|
||||||
return rbd.plugin.host.GetPodVolumeDir(rbd.podUID, strings.EscapeQualifiedNameForDisk(name), rbd.volName)
|
return getPath(rbd.podUID, rbd.volName, rbd.plugin.host)
|
||||||
}
|
}
|
||||||
|
|
||||||
type rbdMounter struct {
|
type rbdMounter struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user