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
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
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
17 deletions
+16
-17
circle/vm/models/instance.py
+0
-7
circle/vm/operations.py
+16
-10
No files found.
circle/vm/models/instance.py
View file @
faa40f86
...
@@ -785,13 +785,6 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
...
@@ -785,13 +785,6 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
raise
humanize_exception
(
ugettext_noop
(
raise
humanize_exception
(
ugettext_noop
(
"Operation aborted by user."
),
e
)
"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
):
def
delete_mem_dump
(
self
,
timeout
=
15
):
queue_name
=
self
.
mem_dump
[
'datastore'
]
.
get_remote_queue_name
(
queue_name
=
self
.
mem_dump
[
'datastore'
]
.
get_remote_queue_name
(
'storage'
,
'fast'
)
'storage'
,
'fast'
)
...
...
circle/vm/operations.py
View file @
faa40f86
...
@@ -735,20 +735,26 @@ class SleepOperation(InstanceOperation):
...
@@ -735,20 +735,26 @@ class SleepOperation(InstanceOperation):
else
:
else
:
activity
.
resultant_state
=
'ERROR'
activity
.
resultant_state
=
'ERROR'
def
_operation
(
self
,
activity
,
timeout
=
240
):
def
_operation
(
self
,
activity
):
# Destroy networks
with
activity
.
sub_activity
(
'shutdown_net'
,
with
activity
.
sub_activity
(
'shutdown_net'
,
readable_name
=
ugettext_noop
(
readable_name
=
ugettext_noop
(
"shutdown network"
)):
"shutdown network"
)):
self
.
instance
.
shutdown_net
()
self
.
instance
.
shutdown_net
()
self
.
instance
.
_suspend_vm
(
parent_activity
=
activity
)
self
.
instance
.
yield_node
()
# Suspend vm
@register_operation
with
activity
.
sub_activity
(
'suspending'
,
class
SuspendVmOperation
(
SubOperationMixin
,
RemoteInstanceOperation
):
readable_name
=
ugettext_noop
(
id
=
"_suspend_vm"
"suspend virtual machine"
)):
name
=
_
(
"suspend virtual machine"
)
self
.
instance
.
suspend_vm
(
timeout
=
timeout
)
task
=
vm_tasks
.
suspend
remote_queue
=
(
"vm"
,
"slow"
)
timeout
=
600
self
.
instance
.
yield_node
()
def
_get_remote_args
(
self
,
**
kwargs
):
# VNC port needs to be kept
return
(
super
(
SleepOperation
.
SuspendVmOperation
,
self
)
.
_get_remote_args
(
**
kwargs
)
+
[
self
.
instance
.
mem_dump
[
'path'
]])
@register_operation
@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