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
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
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
circle/vm/operations.py
+11
-2
No files found.
circle/vm/operations.py
View file @
5ae35aa2
...
@@ -202,8 +202,12 @@ class SaveAsTemplateOperation(InstanceOperation):
...
@@ -202,8 +202,12 @@ class SaveAsTemplateOperation(InstanceOperation):
def
_operation
(
self
,
activity
,
name
,
user
,
system
,
timeout
=
300
,
def
_operation
(
self
,
activity
,
name
,
user
,
system
,
timeout
=
300
,
with_shutdown
=
True
,
**
kwargs
):
with_shutdown
=
True
,
**
kwargs
):
if
with_shutdown
:
if
with_shutdown
:
ShutdownOperation
(
self
.
instance
)
.
call
(
parent_activity
=
activity
,
try
:
user
=
user
)
ShutdownOperation
(
self
.
instance
)
.
call
(
parent_activity
=
activity
,
user
=
user
)
except
Instance
.
WrongStateError
:
pass
# prepare parameters
# prepare parameters
params
=
{
params
=
{
'access_method'
:
self
.
instance
.
access_method
,
'access_method'
:
self
.
instance
.
access_method
,
...
@@ -260,6 +264,11 @@ class ShutdownOperation(InstanceOperation):
...
@@ -260,6 +264,11 @@ class ShutdownOperation(InstanceOperation):
name
=
_
(
"shutdown"
)
name
=
_
(
"shutdown"
)
description
=
_
(
"Shutdown virtual machine with ACPI signal."
)
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
):
def
on_abort
(
self
,
activity
,
error
):
if
isinstance
(
error
,
TimeLimitExceeded
):
if
isinstance
(
error
,
TimeLimitExceeded
):
activity
.
resultant_state
=
None
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