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
0729f22f
authored
Feb 09, 2016
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'getctime-fix' into 'master'
fix ctime error in make_free_space See merge request
!9
parents
7de1a3f5
e68b63ce
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
storagedriver.py
+8
-2
No files found.
storagedriver.py
View file @
0729f22f
...
@@ -119,8 +119,14 @@ def make_free_space(datastore, percent=10):
...
@@ -119,8 +119,14 @@ def make_free_space(datastore, percent=10):
removes oldest files to satisfy the given requirement.
removes oldest files to satisfy the given requirement.
'''
'''
trash_path
=
path
.
join
(
datastore
,
trash_directory
)
trash_path
=
path
.
join
(
datastore
,
trash_directory
)
files
=
sorted
(
listdir
(
trash_path
),
key
=
lambda
x
:
path
.
getctime
(
path
.
join
(
trash_path
,
x
)))
def
comp
(
filename
):
try
:
return
path
.
getctime
(
path
.
join
(
trash_path
,
filename
))
except
OSError
:
return
0
files
=
sorted
(
listdir
(
trash_path
),
key
=
comp
)
logger
.
info
(
"Free space on datastore:
%
s"
%
logger
.
info
(
"Free space on datastore:
%
s"
%
get_storage_stat
(
trash_path
)
.
get
(
'free_percent'
))
get_storage_stat
(
trash_path
)
.
get
(
'free_percent'
))
while
get_storage_stat
(
trash_path
)
.
get
(
'free_percent'
)
<
percent
:
while
get_storage_stat
(
trash_path
)
.
get
(
'free_percent'
)
<
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