Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
397cb5c2
authored
Feb 26, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
storage: fix docstrings and style
parent
451cd484
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
9 deletions
+12
-9
circle/storage/models.py
+12
-9
No files found.
circle/storage/models.py
View file @
397cb5c2
...
@@ -205,7 +205,7 @@ class Disk(AclBase, TimeStampedModel):
...
@@ -205,7 +205,7 @@ class Disk(AclBase, TimeStampedModel):
return
None
return
None
def
__unicode__
(
self
):
def
__unicode__
(
self
):
return
u"
%
s (#
%
d)"
%
(
self
.
name
,
self
.
id
)
return
u"
%
s (#
%
d)"
%
(
self
.
name
,
self
.
id
or
0
)
def
clean
(
self
,
*
args
,
**
kwargs
):
def
clean
(
self
,
*
args
,
**
kwargs
):
if
self
.
size
==
""
and
self
.
base
:
if
self
.
size
==
""
and
self
.
base
:
...
@@ -311,11 +311,11 @@ class Disk(AclBase, TimeStampedModel):
...
@@ -311,11 +311,11 @@ class Disk(AclBase, TimeStampedModel):
@classmethod
@classmethod
def
create_from_url_async
(
cls
,
url
,
instance
=
None
,
params
=
None
,
user
=
None
):
def
create_from_url_async
(
cls
,
url
,
instance
=
None
,
params
=
None
,
user
=
None
):
"""Create disk object and download data from url asynchr
on
usly.
"""Create disk object and download data from url asynchr
no
usly.
:param url:
image url
to download.
:param url:
URL of image
to download.
:type url:
url
:type url:
string
:param instance: inst
na
ce object to connect disk
:param instance: inst
an
ce object to connect disk
:type instane: vm.models.Instance
:type instane: vm.models.Instance
:param params: disk custom parameters
:param params: disk custom parameters
:type params: dict
:type params: dict
...
@@ -343,16 +343,18 @@ class Disk(AclBase, TimeStampedModel):
...
@@ -343,16 +343,18 @@ class Disk(AclBase, TimeStampedModel):
:type params: dict
:type params: dict
:param user: owner of the disk
:param user: owner of the disk
:type user: django.contrib.auth.User
:type user: django.contrib.auth.User
:param task_uuid: TODO
:param abortable_task: TODO
:return: T
ask
:return: T
he created Disk object
:rtype:
AsyncResult
:rtype:
Disk
"""
"""
disk
=
cls
()
disk
=
cls
()
disk
.
generate_filename
()
disk
.
generate_filename
()
disk
.
type
=
"iso"
disk
.
type
=
"iso"
disk
.
size
=
1
disk
.
size
=
1
# TODO get proper datastore
# TODO get proper datastore
disk
.
datastore
=
DataStore
.
objects
.
all
()[
0
]
disk
.
datastore
=
DataStore
.
objects
.
get
()
if
params
:
if
params
:
disk
.
__dict__
.
update
(
params
)
disk
.
__dict__
.
update
(
params
)
disk
.
save
()
disk
.
save
()
...
@@ -388,6 +390,7 @@ class Disk(AclBase, TimeStampedModel):
...
@@ -388,6 +390,7 @@ class Disk(AclBase, TimeStampedModel):
disk
.
size
=
size
disk
.
size
=
size
disk
.
ready
=
True
disk
.
ready
=
True
disk
.
save
()
disk
.
save
()
return
disk
def
destroy
(
self
,
user
=
None
,
task_uuid
=
None
):
def
destroy
(
self
,
user
=
None
,
task_uuid
=
None
):
if
self
.
destroyed
:
if
self
.
destroyed
:
...
@@ -407,7 +410,7 @@ class Disk(AclBase, TimeStampedModel):
...
@@ -407,7 +410,7 @@ class Disk(AclBase, TimeStampedModel):
queue
=
'localhost.man'
)
queue
=
'localhost.man'
)
def
restore
(
self
,
user
=
None
,
task_uuid
=
None
):
def
restore
(
self
,
user
=
None
,
task_uuid
=
None
):
"""Re
store destroyed disk
.
"""Re
cover destroyed disk from trash if possible
.
"""
"""
# TODO
# TODO
pass
pass
...
...
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