Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pve-manager
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
pve-manager
Commits
92e4d5fc
Commit
92e4d5fc
authored
Jan 23, 2014
by
Dietmar Maurer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ceph: display osd usage
parent
0c7ba3e3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
17 deletions
+71
-17
Ceph.pm
PVE/API2/Ceph.pm
+22
-0
Ceph.js
www/manager/node/Ceph.js
+49
-17
No files found.
PVE/API2/Ceph.pm
View file @
92e4d5fc
...
...
@@ -40,6 +40,20 @@ my $get_osd_status = sub {
return
$osdstat
;
};
my
$get_osd_usage
=
sub
{
my
(
$rados
)
=
@_
;
my
$osdlist
=
$rados
->
mon_command
({
prefix
=>
'
pg dump
',
dumpcontents
=>
[
'
osds
'
]})
||
[]
;
my
$osdstat
;
foreach
my
$d
(
@$osdlist
)
{
$osdstat
->
{
$d
->
{
osd
}}
=
$d
if
defined
(
$d
->
{
osd
});
}
return
$osdstat
;
};
__PACKAGE__
->
register_method
({
name
=>
'
index
',
path
=>
'',
...
...
@@ -69,6 +83,8 @@ __PACKAGE__->register_method ({
my
$osdhash
=
&
$get_osd_status
(
$rados
);
my
$usagehash
=
&
$get_osd_usage
(
$rados
);
my
$nodes
=
{};
my
$newnodes
=
{};
foreach
my
$e
(
@
{
$res
->
{
nodes
}})
{
...
...
@@ -88,6 +104,12 @@ __PACKAGE__->register_method ({
$new
->
{
in
}
=
$stat
->
{
in
}
if
defined
(
$stat
->
{
in
});
}
if
(
my
$stat
=
$usagehash
->
{
$e
->
{
id
}})
{
$new
->
{
total_space
}
=
(
$stat
->
{
kb
}
||
1
)
*
1024
;
$new
->
{
bytes_used
}
=
(
$stat
->
{
kb_used
}
||
0
)
*
1024
;
$new
->
{
percent_used
}
=
(
$new
->
{
bytes_used
}
*
100
)
/
$new
->
{
total_space
};
}
$newnodes
->
{
$e
->
{
id
}}
=
$new
;
}
...
...
www/manager/node/Ceph.js
View file @
92e4d5fc
...
...
@@ -170,12 +170,11 @@ Ext.define('PVE.node.CephPoolList', {
header
:
gettext
(
'
Used
'
),
columns
:
[
{
xtype
:
'
numbercolumn
'
,
header
:
'
%
'
,
width
:
80
,
sortable
:
true
,
align
:
'
right
'
,
format
:
'
0.00
'
,
renderer
:
Ext
.
util
.
Format
.
numberRenderer
(
'
0.00
'
)
,
dataIndex
:
'
percent_used
'
},
{
...
...
@@ -446,6 +445,9 @@ Ext.define('PVE.node.CephOsdTree', {
fields
:
[
'
name
'
,
'
type
'
,
'
status
'
,
'
host
'
,
'
in
'
,
{
type
:
'
integer
'
,
name
:
'
id
'
},
{
type
:
'
number
'
,
name
:
'
reweight
'
},
{
type
:
'
number
'
,
name
:
'
percent_used
'
},
{
type
:
'
integer
'
,
name
:
'
bytes_used
'
},
{
type
:
'
integer
'
,
name
:
'
total_space
'
},
{
type
:
'
number
'
,
name
:
'
crush_weight
'
}],
stateful
:
false
,
selModel
:
sm
,
...
...
@@ -454,25 +456,13 @@ Ext.define('PVE.node.CephOsdTree', {
xtype
:
'
treecolumn
'
,
text
:
'
Name
'
,
dataIndex
:
'
name
'
,
width
:
200
},
{
text
:
'
ID
'
,
dataIndex
:
'
id
'
,
align
:
'
right
'
,
width
:
60
},
{
text
:
'
weight
'
,
dataIndex
:
'
crush_weight
'
,
align
:
'
right
'
,
width
:
60
width
:
150
},
{
text
:
'
Type
'
,
dataIndex
:
'
type
'
,
align
:
'
right
'
,
width
:
10
0
width
:
6
0
},
{
text
:
'
Status
'
,
...
...
@@ -485,13 +475,55 @@ Ext.define('PVE.node.CephOsdTree', {
var
data
=
rec
.
data
;
return
value
+
'
/
'
+
(
data
[
'
in
'
]
?
'
in
'
:
'
out
'
);
},
width
:
100
width
:
60
},
{
text
:
'
weight
'
,
dataIndex
:
'
crush_weight
'
,
align
:
'
right
'
,
renderer
:
function
(
value
,
metaData
,
rec
)
{
if
(
rec
.
data
.
type
!==
'
osd
'
)
{
return
''
;
}
return
value
;
},
width
:
60
},
{
text
:
'
reweight
'
,
dataIndex
:
'
reweight
'
,
align
:
'
right
'
,
renderer
:
function
(
value
,
metaData
,
rec
)
{
if
(
rec
.
data
.
type
!==
'
osd
'
)
{
return
''
;
}
return
value
;
},
width
:
60
},
{
text
:
gettext
(
'
Size
'
),
dataIndex
:
'
total_space
'
,
align
:
'
right
'
,
renderer
:
function
(
value
,
metaData
,
rec
)
{
if
(
rec
.
data
.
type
!==
'
osd
'
)
{
return
''
;
}
return
PVE
.
Utils
.
render_size
(
value
);
},
width
:
100
},
{
text
:
gettext
(
'
Used
'
)
+
'
%
'
,
dataIndex
:
'
percent_used
'
,
align
:
'
right
'
,
renderer
:
function
(
value
,
metaData
,
rec
)
{
if
(
rec
.
data
.
type
!==
'
osd
'
)
{
return
''
;
}
return
Ext
.
util
.
Format
.
number
(
value
,
'
0.00
'
);
},
width
:
80
}
],
listeners
:
{
...
...
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