Commit 4b185b09 by Kálmán Viktor

occi: delete storage

parent 4d56b18f
......@@ -402,6 +402,7 @@ class Storage(Resource):
self.attrs['occi.storage.size'] /= 1024*1024*1024.0
def trigger_action(self, data):
# TODO, this is copypaste ATM
method = None
action_term = None
for d in data:
......@@ -428,6 +429,15 @@ class Storage(Resource):
user = User.objects.get(username="test")
getattr(self.instance, operation).async(user=user)
def delete(self):
# TODO
user = User.objects.get(username="test")
if self.disk.instance_set.count() > 0:
for i in self.disk.instance_set.all():
i.detach_disk(user=user, disk=self.disk)
self.disk.destroy()
class StorageLink(Link):
def __init__(self, instance=None, disk=None, data=None):
......
......@@ -193,6 +193,10 @@ class DiskInterface(DetailView):
Storage(disk=disk).trigger_action(data)
return HttpResponse()
def delete(self, request, *args, **kwargs):
Storage(disk=self.get_object()).delete()
return HttpResponse("")
@method_decorator(csrf_exempt)
def dispatch(self, *args, **kwargs):
return super(DiskInterface, self).dispatch(*args, **kwargs)
......
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