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
d8650c62
authored
Sep 25, 2013
by
Dudás Ádám
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm, storage: reorder and add comments to *_async methods
parent
7b28a03d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
20 deletions
+32
-20
circle/storage/models.py
+5
-3
circle/vm/models.py
+27
-17
No files found.
circle/storage/models.py
View file @
d8650c62
...
...
@@ -113,9 +113,6 @@ class Disk(TimeStampedModel):
def
__unicode__
(
self
):
return
u"
%
s (#
%
d)"
%
(
self
.
name
,
self
.
id
)
def
deploy_async
(
self
):
local_tasks
.
deploy
.
apply_async
(
self
)
def
deploy
(
self
):
"""Reify the disk model on the associated data store.
...
...
@@ -143,6 +140,11 @@ class Disk(TimeStampedModel):
self
.
save
()
return
True
def
deploy_async
(
self
):
"""Execute deploy asynchronously.
"""
local_tasks
.
deploy
.
apply_async
(
self
)
def
delete
(
self
):
# TODO
# StorageDriver.delete_disk.delay(instance.to_json()).get()
...
...
circle/vm/models.py
View file @
d8650c62
...
...
@@ -476,12 +476,6 @@ class Instance(BaseResourceConfigModel, TimeStampedModel):
'raw_data'
:
""
if
not
self
.
raw_data
else
self
.
raw_data
}
def
deploy_async
(
self
,
user
=
None
):
""" Launch celery task to handle the job asynchronously.
"""
local_tasks
.
deploy
.
apply_async
(
args
=
[
self
,
user
],
queue
=
"localhost.man"
)
def
deploy
(
self
,
user
=
None
,
task_uuid
=
None
):
""" Deploy new virtual machine with network
1. Schedule
...
...
@@ -521,8 +515,11 @@ class Instance(BaseResourceConfigModel, TimeStampedModel):
act
.
finish
(
result
=
'SUCCESS'
)
def
stop_async
(
self
,
user
=
None
):
local_tasks
.
stop
.
apply_async
(
args
=
[
self
,
user
],
queue
=
"localhost.man"
)
def
deploy_async
(
self
,
user
=
None
):
"""Execute deploy asynchronously.
"""
local_tasks
.
deploy
.
apply_async
(
args
=
[
self
,
user
],
queue
=
"localhost.man"
)
def
stop
(
self
,
user
=
None
,
task_uuid
=
None
):
act
=
InstanceActivity
(
activity_code
=
'vm.Instance.stop'
)
...
...
@@ -535,9 +532,10 @@ class Instance(BaseResourceConfigModel, TimeStampedModel):
remote_tasks
.
stop
.
apply_async
(
args
=
[
self
.
get_vm_desc
()],
queue
=
queue_name
)
.
get
()
def
resume_async
(
self
,
user
=
None
):
local_tasks
.
resume
.
apply_async
(
args
=
[
self
,
user
],
queue
=
"localhost.man"
)
def
stop_async
(
self
,
user
=
None
):
"""Execute stop asynchronously.
"""
local_tasks
.
stop
.
apply_async
(
args
=
[
self
,
user
],
queue
=
"localhost.man"
)
def
resume
(
self
,
user
=
None
,
task_uuid
=
None
):
act
=
InstanceActivity
(
activity_code
=
'vm.Instance.resume'
)
...
...
@@ -550,8 +548,10 @@ class Instance(BaseResourceConfigModel, TimeStampedModel):
remote_tasks
.
resume
.
apply_async
(
args
=
[
self
.
vm_name
],
queue
=
queue_name
)
.
get
()
def
poweroff_async
(
self
,
user
=
None
):
local_tasks
.
power_off
.
apply_async
(
args
=
[
self
,
user
],
def
resume_async
(
self
,
user
=
None
):
"""Execute resume asynchronously.
"""
local_tasks
.
resume
.
apply_async
(
args
=
[
self
,
user
],
queue
=
"localhost.man"
)
def
poweroff
(
self
,
user
=
None
,
task_uuid
=
None
):
...
...
@@ -565,8 +565,10 @@ class Instance(BaseResourceConfigModel, TimeStampedModel):
remote_tasks
.
power_off
.
apply_async
(
args
=
[
self
.
get_vm_desc
()],
queue
=
queue_name
)
.
get
()
def
restart_async
(
self
,
user
=
None
):
local_tasks
.
restart
.
apply_async
(
args
=
[
self
,
user
],
def
poweroff_async
(
self
,
user
=
None
):
"""Execute poweroff asynchronously.
"""
local_tasks
.
power_off
.
apply_async
(
args
=
[
self
,
user
],
queue
=
"localhost.man"
)
def
restart
(
self
,
user
=
None
,
task_uuid
=
None
):
...
...
@@ -580,8 +582,10 @@ class Instance(BaseResourceConfigModel, TimeStampedModel):
remote_tasks
.
restart
.
apply_async
(
args
=
[
self
.
get_vm_desc
()],
queue
=
queue_name
)
.
get
()
def
save_as_async
(
self
,
user
=
None
):
local_tasks
.
save_as
.
apply_async
(
args
=
[
self
,
user
],
def
restart_async
(
self
,
user
=
None
):
"""Execute restart asynchronously.
"""
local_tasks
.
restart
.
apply_async
(
args
=
[
self
,
user
],
queue
=
"localhost.man"
)
def
save_as
(
self
,
user
=
None
,
task_uuid
=
None
):
...
...
@@ -595,6 +599,12 @@ class Instance(BaseResourceConfigModel, TimeStampedModel):
remote_tasks
.
save_as
.
apply_async
(
args
=
[
self
.
get_vm_desc
()],
queue
=
queue_name
)
.
get
()
def
save_as_async
(
self
,
user
=
None
):
"""Execute save_as asynchronously.
"""
local_tasks
.
save_as
.
apply_async
(
args
=
[
self
,
user
],
queue
=
"localhost.man"
)
def
renew
(
self
,
which
=
'both'
):
"""Renew virtual machine instance leases.
"""
...
...
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