Commit 397cb5c2 by Őry Máté

storage: fix docstrings and style

parent 451cd484
......@@ -205,7 +205,7 @@ class Disk(AclBase, TimeStampedModel):
return None
def __unicode__(self):
return u"%s (#%d)" % (,
return u"%s (#%d)" % (, or 0)
def clean(self, *args, **kwargs):
if self.size == "" and self.base:
......@@ -311,11 +311,11 @@ class Disk(AclBase, TimeStampedModel):
def create_from_url_async(cls, url, instance=None, params=None, user=None):
"""Create disk object and download data from url asynchronusly.
"""Create disk object and download data from url asynchrnously.
:param url: image url to download.
:type url: url
:param instance: instnace object to connect disk
:param url: URL of image to download.
:type url: string
:param instance: instance object to connect disk
:type instane: vm.models.Instance
:param params: disk custom parameters
:type params: dict
......@@ -343,16 +343,18 @@ class Disk(AclBase, TimeStampedModel):
:type params: dict
:param user: owner of the disk
:type user: django.contrib.auth.User
:param task_uuid: TODO
:param abortable_task: TODO
:return: Task
:rtype: AsyncResult
:return: The created Disk object
:rtype: Disk
disk = cls()
disk.type = "iso"
disk.size = 1
# TODO get proper datastore
disk.datastore = DataStore.objects.all()[0]
disk.datastore = DataStore.objects.get()
if params:
......@@ -388,6 +390,7 @@ class Disk(AclBase, TimeStampedModel):
disk.size = size
disk.ready = True
return disk
def destroy(self, user=None, task_uuid=None):
if self.destroyed:
......@@ -407,7 +410,7 @@ class Disk(AclBase, TimeStampedModel):
def restore(self, user=None, task_uuid=None):
"""Restore destroyed disk.
"""Recover destroyed disk from trash if possible.
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