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
49049952
authored
Dec 11, 2017
by
Fukász Rómeó Ervin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
storagedriver: fix import errors
parent
36b8796e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
6 deletions
+5
-6
storagedriver.py
+5
-6
No files found.
storagedriver.py
View file @
49049952
from
disk
import
Disk
,
CephDisk
from
disk
import
Disk
,
CephDisk
from
ceph
import
CephConnection
from
ceph
import
CephConnection
from
storagecelery
import
celery
from
storagecelery
import
celery
import
os
from
os
import
path
,
unlink
,
statvfs
,
listdir
from
os
import
unlink
,
statvfs
,
listdir
from
celery.contrib.abortable
import
AbortableTask
from
celery.contrib.abortable
import
AbortableTask
import
logging
import
logging
...
@@ -28,7 +27,7 @@ def list_files(data_store_type, dir):
...
@@ -28,7 +27,7 @@ def list_files(data_store_type, dir):
return
rbd_inst
.
list
(
conn
.
ioctx
)
return
rbd_inst
.
list
(
conn
.
ioctx
)
else
:
else
:
return
[
l
for
l
in
listdir
(
dir
)
if
return
[
l
for
l
in
listdir
(
dir
)
if
os
.
path
.
isfile
(
os
.
path
.
join
(
dir
,
l
))]
path
.
isfile
(
path
.
join
(
dir
,
l
))]
@celery.task
()
@celery.task
()
...
@@ -68,7 +67,7 @@ def delete_dump(data_store_type, dir, filename):
...
@@ -68,7 +67,7 @@ def delete_dump(data_store_type, dir, filename):
rbd_inst
.
remove
(
conn
.
ioctx
,
str
(
filename
))
rbd_inst
.
remove
(
conn
.
ioctx
,
str
(
filename
))
else
:
else
:
disk_path
=
dir
+
"/"
+
filename
disk_path
=
dir
+
"/"
+
filename
if
disk_path
.
endswith
(
".dump"
)
and
os
.
path
.
isfile
(
disk_path
):
if
disk_path
.
endswith
(
".dump"
)
and
path
.
isfile
(
disk_path
):
unlink
(
disk_path
)
unlink
(
disk_path
)
...
@@ -160,7 +159,7 @@ def exists(data_store_type, path, disk_name):
...
@@ -160,7 +159,7 @@ def exists(data_store_type, path, disk_name):
return
False
return
False
else
:
else
:
return
True
return
True
elif
os
.
path
.
exists
(
os
.
path
.
join
(
path
,
disk_name
)):
elif
path
.
exists
(
path
.
join
(
path
,
disk_name
)):
return
True
return
True
return
False
return
False
...
@@ -189,7 +188,7 @@ def make_free_space(data_store_type, path, deletable_disks, percent=10):
...
@@ -189,7 +188,7 @@ def make_free_space(data_store_type, path, deletable_disks, percent=10):
image
.
remove_snap
(
name
)
image
.
remove_snap
(
name
)
rbd_inst
.
remove
(
conn
.
ioctx
,
str
(
f
))
rbd_inst
.
remove
(
conn
.
ioctx
,
str
(
f
))
else
:
else
:
unlink
(
os
.
path
.
join
(
path
,
f
))
unlink
(
path
.
join
(
path
,
f
))
logger
.
info
(
'Image:
%
s removed.'
%
f
)
logger
.
info
(
'Image:
%
s removed.'
%
f
)
except
IndexError
:
except
IndexError
:
logger
.
warning
(
"Has no deletable disk."
)
logger
.
warning
(
"Has no deletable disk."
)
...
...
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