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
1f9af3ae
authored
Jan 30, 2014
by
Guba Sándor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
storage: adding delete_dump
parent
13f7ec45
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletions
+11
-1
disk.py
+4
-0
storagedriver.py
+7
-1
No files found.
disk.py
View file @
1f9af3ae
import
json
import
os
import
os
import
subprocess
import
subprocess
import
re
import
re
...
@@ -32,6 +33,9 @@ class Disk(object):
...
@@ -32,6 +33,9 @@ class Disk(object):
@classmethod
@classmethod
def
deserialize
(
cls
,
desc
):
def
deserialize
(
cls
,
desc
):
logging
.
info
(
desc
)
if
isinstance
(
desc
,
basestring
):
desc
=
json
.
loads
(
desc
)
return
cls
(
**
desc
)
return
cls
(
**
desc
)
def
get_desc
(
self
):
def
get_desc
(
self
):
...
...
storagedriver.py
View file @
1f9af3ae
from
disk
import
Disk
from
disk
import
Disk
from
storagecelery
import
celery
from
storagecelery
import
celery
from
os
import
path
,
unlink
@celery.task
()
@celery.task
()
def
list
(
dir
):
def
list
(
dir
):
...
@@ -20,6 +20,12 @@ def delete(json_data):
...
@@ -20,6 +20,12 @@ def delete(json_data):
@celery.task
()
@celery.task
()
def
delete_dump
():
if
path
.
endswith
(
".dump"
)
and
os
.
path
.
isfile
(
path
):
os
.
unlink
(
path
)
@celery.task
()
def
snapshot
(
json_data
):
def
snapshot
(
json_data
):
disk
=
Disk
.
deserialize
(
json_data
)
disk
=
Disk
.
deserialize
(
json_data
)
disk
.
snapshot
()
disk
.
snapshot
()
...
...
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