Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gutyán Gábor
/
circlestack
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
faa40f86
authored
Sep 26, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: move Instance.suspend_vm to SuspendVmOperation
parent
71c7bedb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
18 deletions
+17
-18
circle/vm/models/instance.py
+0
-7
circle/vm/operations.py
+17
-11
No files found.
circle/vm/models/instance.py
View file @
faa40f86
...
...
@@ -785,13 +785,6 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
raise
humanize_exception
(
ugettext_noop
(
"Operation aborted by user."
),
e
)
def
suspend_vm
(
self
,
timeout
=
230
):
queue_name
=
self
.
get_remote_queue_name
(
'vm'
,
'slow'
)
return
vm_tasks
.
sleep
.
apply_async
(
args
=
[
self
.
vm_name
,
self
.
mem_dump
[
'path'
]],
queue
=
queue_name
)
.
get
(
timeout
=
timeout
)
def
delete_mem_dump
(
self
,
timeout
=
15
):
queue_name
=
self
.
mem_dump
[
'datastore'
]
.
get_remote_queue_name
(
'storage'
,
'fast'
)
...
...
circle/vm/operations.py
View file @
faa40f86
...
...
@@ -735,20 +735,26 @@ class SleepOperation(InstanceOperation):
else
:
activity
.
resultant_state
=
'ERROR'
def
_operation
(
self
,
activity
,
timeout
=
240
):
# Destroy networks
with
activity
.
sub_activity
(
'shutdown_net'
,
readable_name
=
ugettext_noop
(
"shutdown network"
)):
def
_operation
(
self
,
activity
):
with
activity
.
sub_activity
(
'shutdown_net'
,
readable_name
=
ugettext_noop
(
"shutdown network"
)):
self
.
instance
.
shutdown_net
()
self
.
instance
.
_suspend_vm
(
parent_activity
=
activity
)
self
.
instance
.
yield_node
()
# Suspend vm
with
activity
.
sub_activity
(
'suspending'
,
readable_name
=
ugettext_noop
(
"suspend virtual machine"
)):
self
.
instance
.
suspend_vm
(
timeout
=
timeout
)
@register_operation
class
SuspendVmOperation
(
SubOperationMixin
,
RemoteInstanceOperation
):
id
=
"_suspend_vm"
name
=
_
(
"suspend virtual machine"
)
task
=
vm_tasks
.
suspend
remote_queue
=
(
"vm"
,
"slow"
)
timeout
=
600
self
.
instance
.
yield_node
()
# VNC port needs to be kept
def
_get_remote_args
(
self
,
**
kwargs
):
return
(
super
(
SleepOperation
.
SuspendVmOperation
,
self
)
.
_get_remote_args
(
**
kwargs
)
+
[
self
.
instance
.
mem_dump
[
'path'
]])
@register_operation
...
...
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