Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
777595ef
Commit
777595ef
authored
Jul 05, 2017
by
Yecheng Fu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use MetricsStatsFs to expose RBD volume plugin metrics.
parent
744455c6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
18 deletions
+22
-18
rbd.go
pkg/volume/rbd/rbd.go
+22
-18
No files found.
pkg/volume/rbd/rbd.go
View file @
777595ef
...
@@ -66,6 +66,10 @@ const (
...
@@ -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
...
@@ -148,14 +152,15 @@ func (plugin *rbdPlugin) newMounterInternal(spec *volume.Spec, podUID types.UID,
...
@@ -148,14 +152,15 @@ func (plugin *rbdPlugin) newMounterInternal(spec *volume.Spec, podUID types.UID,
return
&
rbdMounter
{
return
&
rbdMounter
{
rbd
:
&
rbd
{
rbd
:
&
rbd
{
podUID
:
podUID
,
podUID
:
podUID
,
volName
:
spec
.
Name
(),
volName
:
spec
.
Name
(),
Image
:
source
.
RBDImage
,
Image
:
source
.
RBDImage
,
Pool
:
pool
,
Pool
:
pool
,
ReadOnly
:
readOnly
,
ReadOnly
:
readOnly
,
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
,
...
@@ -175,11 +180,12 @@ func (plugin *rbdPlugin) newUnmounterInternal(volName string, podUID types.UID,
...
@@ -175,11 +180,12 @@ func (plugin *rbdPlugin) newUnmounterInternal(volName string, podUID types.UID,
return
&
rbdUnmounter
{
return
&
rbdUnmounter
{
rbdMounter
:
&
rbdMounter
{
rbdMounter
:
&
rbdMounter
{
rbd
:
&
rbd
{
rbd
:
&
rbd
{
podUID
:
podUID
,
podUID
:
podUID
,
volName
:
volName
,
volName
:
volName
,
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 {
...
@@ -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 {
...
@@ -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
.
Metrics
Nil
volume
.
Metrics
Provider
}
}
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
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment