Commit 1f9af3ae by Guba Sándor

storage: adding delete_dump

parent 13f7ec45
import json
import os
import subprocess
import re
......@@ -32,6 +33,9 @@ class Disk(object):
@classmethod
def deserialize(cls, desc):
logging.info(desc)
if isinstance(desc, basestring):
desc = json.loads(desc)
return cls(**desc)
def get_desc(self):
......
from disk import Disk
from storagecelery import celery
from os import path, unlink
@celery.task()
def list(dir):
......@@ -20,6 +20,12 @@ def delete(json_data):
@celery.task()
def delete_dump():
if path.endswith(".dump") and os.path.isfile(path):
os.unlink(path)
@celery.task()
def snapshot(json_data):
disk = Disk.deserialize(json_data)
disk.snapshot()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment