Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
storagedriver
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
2
Merge Requests
4
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
24e73171
authored
Feb 24, 2014
by
Guba Sándor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
driver: added get_storage_stat function
parent
d9210dd5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
storagedriver.py
+7
-3
No files found.
storagedriver.py
View file @
24e73171
...
@@ -71,7 +71,11 @@ def get(json_data):
...
@@ -71,7 +71,11 @@ def get(json_data):
@celery.task
()
@celery.task
()
def
get_
free_space
(
path
):
def
get_
storage_stat
(
path
):
''' Return free disk space avaliable at path in bytes.'''
''' Return free disk space avaliable at path in bytes
and percent
.'''
s
=
statvfs
(
path
)
s
=
statvfs
(
path
)
return
s
.
f_bavail
*
s
.
f_frsize
all_space
=
s
.
f_bsize
*
s
.
f_blocks
free_space
=
s
.
f_bavail
*
s
.
f_frsize
free_space_percent
=
100.0
*
free_space
/
all_space
return
{
'free_space'
:
free_space
,
'free_percent'
:
free_space_percent
}
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