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
a02e1932
authored
Feb 17, 2014
by
Guba Sándor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
storage: added create_from_url method to Disk
parent
46c32973
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
0 deletions
+36
-0
circle/storage/models.py
+36
-0
No files found.
circle/storage/models.py
View file @
a02e1932
...
...
@@ -223,6 +223,42 @@ class Disk(AclBase, TimeStampedModel):
return
local_tasks
.
deploy
.
apply_async
(
args
=
[
self
,
user
],
queue
=
"localhost.man"
)
@classmethod
def
create_empty
(
cls
,
params
=
{},
user
=
None
):
disk
=
cls
()
disk
.
__dict__
.
update
(
params
)
disk
.
save
()
return
disk
@classmethod
def
create_from_url_async
(
cls
,
url
,
params
,
user
=
None
):
return
local_tasks
.
create_from_url
.
apply_async
(
args
=
[
cls
,
url
,
params
,
user
],
queue
=
'localhost.man'
)
@classmethod
def
create_from_url
(
cls
,
url
,
params
=
{},
user
=
None
,
task_uuid
=
None
):
disk
=
cls
()
disk
.
filename
=
str
(
uuid
.
uuid4
())
disk
.
type
=
"iso"
disk
.
size
=
1
disk
.
datastore
=
DataStore
.
objects
.
all
()[
0
]
disk
.
__dict__
.
update
(
params
)
disk
.
save
()
queue_name
=
disk
.
get_remote_queue_name
(
'storage'
)
def
__onabort
(
activity
,
error
):
activity
.
disk
.
delete
()
raise
error
with
disk_activity
(
code_suffix
=
'download'
,
disk
=
disk
,
task_uuid
=
task_uuid
,
user
=
user
):
size
=
remote_tasks
.
download
.
apply_async
(
kwargs
=
{
'url'
:
url
,
'disk'
:
disk
.
get_disk_desc
()},
queue
=
queue_name
)
.
get
()
disk
.
size
=
size
disk
.
save
()
def
destroy
(
self
,
user
=
None
,
task_uuid
=
None
):
if
self
.
destroyed
:
return
False
...
...
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