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
1fd46fee
authored
Mar 31, 2014
by
Dudás Ádám
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: check by default whether instance is destroyed
parent
106096b6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
8 deletions
+4
-8
circle/vm/models/operation.py
+4
-8
No files found.
circle/vm/models/operation.py
View file @
1fd46fee
...
...
@@ -90,7 +90,8 @@ class Operation(object):
return
self
.
_exec_op
(
activity
=
activity
,
**
kwargs
)
def
check_precond
(
self
):
pass
if
self
.
instance
.
destroyed_at
:
raise
self
.
instance
.
InstanceDestroyedError
(
self
.
instance
)
def
check_auth
(
self
,
user
):
if
not
self
.
instance
.
has_level
(
user
,
self
.
acl_level
):
...
...
@@ -147,9 +148,6 @@ class DeployOperation(Operation):
activity
.
resultant_state
=
'RUNNING'
def
_operation
(
self
,
activity
,
user
,
system
):
if
self
.
instance
.
destroyed_at
:
raise
self
.
instance
.
InstanceDestroyedError
(
self
.
instance
)
self
.
instance
.
_schedule_vm
(
activity
)
# Deploy virtual images
...
...
@@ -188,10 +186,6 @@ class DestroyOperation(Operation):
:type task_uuid: str
"""
)
def
check_precond
(
self
):
if
self
.
instance
.
destroyed_at
:
raise
self
.
instance
.
InstanceDestroyedError
(
self
.
instance
)
def
on_commit
(
self
,
activity
):
activity
.
resultant_state
=
'DESTROYED'
...
...
@@ -423,6 +417,7 @@ class SleepOperation(Operation):
description
=
_
(
"""Suspend virtual machine with memory dump."""
)
def
check_precond
(
self
):
super
(
SleepOperation
,
self
)
.
check_precond
()
if
self
.
instance
.
status
not
in
[
'RUNNING'
]:
raise
self
.
instance
.
WrongStateError
(
self
.
instance
)
...
...
@@ -464,6 +459,7 @@ class WakeUpOperation(Operation):
"""
)
def
check_precond
(
self
):
super
(
WakeUpOperation
,
self
)
.
check_precond
()
if
self
.
instance
.
status
not
in
[
'SUSPENDED'
]:
raise
self
.
instance
.
WrongStateError
(
self
.
instance
)
...
...
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