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
fad6cdd0
authored
Dec 12, 2017
by
Fukász Rómeó Ervin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ceph: fix storage stat sizes, add dummy ceph file stats implementation
parent
49049952
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
14 deletions
+20
-14
storagedriver.py
+20
-14
No files found.
storagedriver.py
View file @
fad6cdd0
...
@@ -114,8 +114,8 @@ def get_storage_stat(data_store_type, path):
...
@@ -114,8 +114,8 @@ def get_storage_stat(data_store_type, path):
if
data_store_type
==
"ceph_block"
:
if
data_store_type
==
"ceph_block"
:
with
CephConnection
(
str
(
path
))
as
conn
:
with
CephConnection
(
str
(
path
))
as
conn
:
stat
=
conn
.
cluster
.
get_cluster_stats
()
stat
=
conn
.
cluster
.
get_cluster_stats
()
all_space
=
stat
[
"kb"
]
all_space
=
stat
[
"kb"
]
*
1024.0
free_space
=
stat
[
"kb_avail"
]
free_space
=
stat
[
"kb_avail"
]
*
1024.0
else
:
else
:
s
=
statvfs
(
path
)
s
=
statvfs
(
path
)
all_space
=
s
.
f_bsize
*
s
.
f_blocks
all_space
=
s
.
f_bsize
*
s
.
f_blocks
...
@@ -127,18 +127,24 @@ def get_storage_stat(data_store_type, path):
...
@@ -127,18 +127,24 @@ def get_storage_stat(data_store_type, path):
@celery.task
()
@celery.task
()
def
get_file_statistics
(
datastore
):
def
get_file_statistics
(
data_store_type
,
datastore
):
disks
=
[
Disk
.
get
(
datastore
,
name
)
.
get_desc
()
if
data_store_type
==
'ceph_block'
:
for
name
in
listdir
(
datastore
)
# TODO get proper data
if
not
name
.
endswith
(
".dump"
)
and
disks
=
[]
not
path
.
isdir
(
path
.
join
(
datastore
,
name
))]
dumps
=
[]
dumps
=
[{
'name'
:
name
,
trash
=
[]
'size'
:
path
.
getsize
(
path
.
join
(
datastore
,
name
))}
else
:
for
name
in
listdir
(
datastore
)
if
name
.
endswith
(
".dump"
)]
disks
=
[
Disk
.
get
(
datastore
,
name
)
.
get_desc
()
trash
=
[{
'name'
:
name
,
for
name
in
listdir
(
datastore
)
'size'
:
path
.
getsize
(
path
.
join
(
datastore
,
trash_directory
,
if
not
name
.
endswith
(
".dump"
)
and
name
))}
not
path
.
isdir
(
path
.
join
(
datastore
,
name
))]
for
name
in
listdir
(
path
.
join
(
datastore
,
trash_directory
))]
dumps
=
[{
'name'
:
name
,
'size'
:
path
.
getsize
(
path
.
join
(
datastore
,
name
))}
for
name
in
listdir
(
datastore
)
if
name
.
endswith
(
".dump"
)]
trash
=
[{
'name'
:
name
,
'size'
:
path
.
getsize
(
path
.
join
(
datastore
,
trash_directory
,
name
))}
for
name
in
listdir
(
path
.
join
(
datastore
,
trash_directory
))]
return
{
return
{
'dumps'
:
dumps
,
'dumps'
:
dumps
,
'trash'
:
trash
,
'trash'
:
trash
,
...
...
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