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
1c21e8ab
Commit
1c21e8ab
authored
Jul 21, 2017
by
Rye Terrell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more robust stat handling from ceph df output
parent
e0c537a4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
create-rbd-pv
cluster/juju/layers/kubernetes-master/actions/create-rbd-pv
+6
-6
No files found.
cluster/juju/layers/kubernetes-master/actions/create-rbd-pv
View file @
1c21e8ab
...
@@ -23,6 +23,7 @@ from subprocess import check_call
...
@@ -23,6 +23,7 @@ from subprocess import check_call
from
subprocess
import
check_output
from
subprocess
import
check_output
from
subprocess
import
CalledProcessError
from
subprocess
import
CalledProcessError
from
tempfile
import
TemporaryDirectory
from
tempfile
import
TemporaryDirectory
import
json
import
re
import
re
import
os
import
os
import
sys
import
sys
...
@@ -179,14 +180,13 @@ def get_monitors():
...
@@ -179,14 +180,13 @@ def get_monitors():
def
get_available_space
():
def
get_available_space
():
''' Determine the space available in the RBD pool. Throw an exception if
''' Determine the space available in the RBD pool. Throw an exception if
the RBD pool ('rbd') isn't found. '''
the RBD pool ('rbd') isn't found. '''
command
=
[
'ceph'
,
'df'
]
command
=
'ceph df -f json'
.
split
()
debug_command
(
command
)
debug_command
(
command
)
out
=
check_output
(
command
)
.
decode
(
'utf-8'
)
out
=
check_output
(
command
)
.
decode
(
'utf-8'
)
for
line
in
out
.
splitlines
():
data
=
json
.
loads
(
out
)
stripped
=
line
.
strip
()
for
pool
in
data
[
'pools'
]:
if
stripped
.
startswith
(
'rbd'
):
if
pool
[
'name'
]
==
'rbd'
:
M
=
stripped
.
split
()[
-
2
]
.
replace
(
'M'
,
''
)
return
int
(
pool
[
'stats'
][
'max_avail'
]
/
(
1024
*
1024
))
return
int
(
M
)
raise
UnknownAvailableSpaceException
(
'Unable to determine available space.'
)
# noqa
raise
UnknownAvailableSpaceException
(
'Unable to determine available space.'
)
# noqa
...
...
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