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
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
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
6 deletions
+34
-6
circle/storage/models.py
+34
-6
No files found.
circle/storage/models.py
View file @
ae3fd15c
...
@@ -238,14 +238,42 @@ class Disk(AclBase, TimeStampedModel):
...
@@ -238,14 +238,42 @@ class Disk(AclBase, TimeStampedModel):
queue
=
"localhost.man"
)
queue
=
"localhost.man"
)
@classmethod
@classmethod
def
create_empty
(
cls
,
params
=
{},
user
=
None
):
def
create_empyt_async
(
instance
=
None
,
params
=
None
,
user
=
None
):
disk
=
cls
()
"""Create empty Disk object asynchronusly.
disk
.
__dict__
.
update
(
params
)
disk
.
save
()
:param instance: instnace object to connect disk
return
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
@classmethod
def
create_from_url_async
(
cls
,
url
,
params
=
None
,
user
=
None
):
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
return
local_tasks
.
create_from_url
.
apply_async
(
kwargs
=
{
return
local_tasks
.
create_from_url
.
apply_async
(
kwargs
=
{
'cls'
:
cls
,
'url'
:
url
,
'params'
:
params
,
'user'
:
user
},
'cls'
:
cls
,
'url'
:
url
,
'params'
:
params
,
'user'
:
user
},
queue
=
'localhost.man'
)
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