Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ae3fd15c
authored
Feb 26, 2014
by
Guba Sándor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
storage: create_empty_async disk
parent
fff0b304
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
4 deletions
+32
-4
circle/storage/models.py
+32
-4
No files found.
circle/storage/models.py
View file @
ae3fd15c
...
...
@@ -238,14 +238,42 @@ class Disk(AclBase, TimeStampedModel):
queue
=
"localhost.man"
)
@classmethod
def
create_empty
(
cls
,
params
=
{},
user
=
None
):
def
create_empyt_async
(
instance
=
None
,
params
=
None
,
user
=
None
):
"""Create empty Disk object asynchronusly.
:param instance: instnace object to connect disk
:type instane: vm.models.Instance
:param params: disk custom parameters
:type params: dict
:param user: owner of the disk
:type user: django.contrib.auth.User
"""
return
local_tasks
.
create_empty
.
apply_async
(
args
=
[
instance
,
params
,
user
],
queue
=
"localhost.man"
)
@classmethod
def
create_empty
(
cls
,
instance
=
None
,
params
=
None
,
user
=
None
,
task_uuid
=
None
):
"""Create empty Disk object.
:param instance: instnace object to connect disk
:type instane: vm.models.Instance
:param params: disk custom parameters
:type params: dict
:param user: owner of the disk
:type user: django.contrib.auth.User
"""
with
disk_activity
(
code_suffix
=
"create"
,
task_uuid
=
task_uuid
,
user
=
user
)
as
act
:
disk
=
cls
()
if
params
:
disk
.
__dict__
.
update
(
params
)
disk
.
save
()
act
.
disk
=
disk
act
.
save
()
if
instance
:
instance
.
disks
.
add
(
disk
)
return
disk
@classmethod
def
create_from_url_async
(
cls
,
url
,
params
=
None
,
user
=
None
):
return
local_tasks
.
create_from_url
.
apply_async
(
kwargs
=
{
'cls'
:
cls
,
'url'
:
url
,
'params'
:
params
,
'user'
:
user
},
queue
=
'localhost.man'
)
...
...
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