Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
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
5ae35aa2
authored
Apr 16, 2014
by
Guba Sándor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
operations: Added ShutdownOperation precondition.
SaveAsTemplateOperation optimistic shutdown.
parent
aea984d1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
+9
-0
circle/vm/operations.py
+9
-0
No files found.
circle/vm/operations.py
View file @
5ae35aa2
...
...
@@ -202,8 +202,12 @@ class SaveAsTemplateOperation(InstanceOperation):
def
_operation
(
self
,
activity
,
name
,
user
,
system
,
timeout
=
300
,
with_shutdown
=
True
,
**
kwargs
):
if
with_shutdown
:
try
:
ShutdownOperation
(
self
.
instance
)
.
call
(
parent_activity
=
activity
,
user
=
user
)
except
Instance
.
WrongStateError
:
pass
# prepare parameters
params
=
{
'access_method'
:
self
.
instance
.
access_method
,
...
...
@@ -260,6 +264,11 @@ class ShutdownOperation(InstanceOperation):
name
=
_
(
"shutdown"
)
description
=
_
(
"Shutdown virtual machine with ACPI signal."
)
def
check_precond
(
self
):
super
(
ShutdownOperation
,
self
)
.
check_precond
()
if
self
.
instance
.
status
not
in
[
'RUNNING'
]:
raise
self
.
instance
.
WrongStateError
(
self
.
instance
)
def
on_abort
(
self
,
activity
,
error
):
if
isinstance
(
error
,
TimeLimitExceeded
):
activity
.
resultant_state
=
None
...
...
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