Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gutyán Gábor
/
circlestack
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
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
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
circle/vm/models/instance.py
+7
-6
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