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
6a54d7e1
authored
Mar 09, 2014
by
Dudás Ádám
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: refactor vm_state_changed
parent
a6bd2dd0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
circle/vm/models/instance.py
+8
-7
No files found.
circle/vm/models/instance.py
View file @
6a54d7e1
...
@@ -287,14 +287,10 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
...
@@ -287,14 +287,10 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
act
.
save
()
act
.
save
()
def
vm_state_changed
(
self
,
new_state
):
def
vm_state_changed
(
self
,
new_state
):
# log state change
try
:
try
:
act
=
InstanceActivity
.
create
(
act
=
InstanceActivity
.
create
(
code_suffix
=
'vm_state_changed'
,
code_suffix
=
'monitor_event_
%
s'
%
new_state
,
instance
=
self
)
instance
=
self
)
if
new_state
==
"STOPPED"
:
self
.
vnc_port
=
None
self
.
node
=
None
self
.
save
()
except
ActivityInProgressError
:
except
ActivityInProgressError
:
pass
# discard state change if another activity is in progress.
pass
# discard state change if another activity is in progress.
else
:
else
:
...
@@ -303,6 +299,11 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
...
@@ -303,6 +299,11 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
act
.
succeeded
=
True
act
.
succeeded
=
True
act
.
save
()
act
.
save
()
if
new_state
==
'STOPPED'
:
self
.
vnc_port
=
None
self
.
node
=
None
self
.
save
()
def
clean
(
self
,
*
args
,
**
kwargs
):
def
clean
(
self
,
*
args
,
**
kwargs
):
if
self
.
time_of_delete
is
None
:
if
self
.
time_of_delete
is
None
:
self
.
_do_renew
(
which
=
'delete'
)
self
.
_do_renew
(
which
=
'delete'
)
...
...
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