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
95663de7
authored
Feb 20, 2014
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: fix Instance.sleep(), wake_up()
destroy networking on sleep, deploy networking on wake up
parent
c7bbf883
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
2 deletions
+22
-2
circle/vm/models/instance.py
+22
-2
No files found.
circle/vm/models/instance.py
View file @
95663de7
...
@@ -805,12 +805,22 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
...
@@ -805,12 +805,22 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
with
instance_activity
(
code_suffix
=
'sleep'
,
instance
=
self
,
with
instance_activity
(
code_suffix
=
'sleep'
,
instance
=
self
,
on_abort
=
__on_abort
,
on_commit
=
__on_commit
,
on_abort
=
__on_abort
,
on_commit
=
__on_commit
,
task_uuid
=
task_uuid
,
user
=
user
):
task_uuid
=
task_uuid
,
user
=
user
)
as
act
:
# Destroy networks
with
act
.
sub_activity
(
'destroying_net'
):
for
net
in
self
.
interface_set
.
all
():
net
.
destroy
(
delete_host
=
False
)
# Suspend vm
with
act
.
sub_activity
(
'suspending'
):
queue_name
=
self
.
get_remote_queue_name
(
'vm'
)
queue_name
=
self
.
get_remote_queue_name
(
'vm'
)
vm_tasks
.
sleep
.
apply_async
(
args
=
[
self
.
vm_name
,
vm_tasks
.
sleep
.
apply_async
(
args
=
[
self
.
vm_name
,
self
.
mem_dump
[
'path'
]],
self
.
mem_dump
[
'path'
]],
queue
=
queue_name
)
.
get
()
queue
=
queue_name
)
.
get
()
self
.
node
=
None
self
.
vnc_port
=
None
self
.
save
()
def
sleep_async
(
self
,
user
=
None
):
def
sleep_async
(
self
,
user
=
None
):
"""Execute sleep asynchronously.
"""Execute sleep asynchronously.
...
@@ -830,13 +840,23 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
...
@@ -830,13 +840,23 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
with
instance_activity
(
code_suffix
=
'wake_up'
,
instance
=
self
,
with
instance_activity
(
code_suffix
=
'wake_up'
,
instance
=
self
,
on_abort
=
__on_abort
,
on_commit
=
__on_commit
,
on_abort
=
__on_abort
,
on_commit
=
__on_commit
,
task_uuid
=
task_uuid
,
user
=
user
):
task_uuid
=
task_uuid
,
user
=
user
)
as
act
:
# Schedule vm
self
.
__schedule_vm
(
act
)
queue_name
=
self
.
get_remote_queue_name
(
'vm'
)
queue_name
=
self
.
get_remote_queue_name
(
'vm'
)
# Resume vm
with
act
.
sub_activity
(
'resuming'
):
vm_tasks
.
wake_up
.
apply_async
(
args
=
[
self
.
vm_name
,
vm_tasks
.
wake_up
.
apply_async
(
args
=
[
self
.
vm_name
,
self
.
mem_dump
[
'path'
]],
self
.
mem_dump
[
'path'
]],
queue
=
queue_name
)
.
get
()
queue
=
queue_name
)
.
get
()
# Estabilish network connection (vmdriver)
with
act
.
sub_activity
(
'deploying_net'
):
for
net
in
self
.
interface_set
.
all
():
net
.
deploy
()
def
wake_up_async
(
self
,
user
=
None
):
def
wake_up_async
(
self
,
user
=
None
):
"""Execute wake_up asynchronously.
"""Execute wake_up asynchronously.
"""
"""
...
...
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