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
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
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
Hide 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):
return
None
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
):
if
self
.
size
==
""
and
self
.
base
:
...
...
@@ -311,11 +311,11 @@ class Disk(AclBase, TimeStampedModel):
@classmethod
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.
:type url:
url
:param instance: inst
na
ce object to connect disk
:param url:
URL of image
to download.
:type url:
string
:param instance: inst
an
ce 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: T
ask
:rtype:
AsyncResult
:return: T
he created Disk object
:rtype:
Disk
"""
disk
=
cls
()
disk
.
generate_filename
()
disk
.
type
=
"iso"
disk
.
size
=
1
# TODO get proper datastore
disk
.
datastore
=
DataStore
.
objects
.
all
()[
0
]
disk
.
datastore
=
DataStore
.
objects
.
get
()
if
params
:
disk
.
__dict__
.
update
(
params
)
disk
.
save
()
...
...
@@ -388,6 +390,7 @@ class Disk(AclBase, TimeStampedModel):
disk
.
size
=
size
disk
.
ready
=
True
disk
.
save
()
return
disk
def
destroy
(
self
,
user
=
None
,
task_uuid
=
None
):
if
self
.
destroyed
:
...
...
@@ -407,7 +410,7 @@ class Disk(AclBase, TimeStampedModel):
queue
=
'localhost.man'
)
def
restore
(
self
,
user
=
None
,
task_uuid
=
None
):
"""Re
store destroyed disk
.
"""Re
cover destroyed disk from trash if possible
.
"""
# TODO
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