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
7e142ce6
authored
Feb 14, 2014
by
Dudás Ádám
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: record unanticipated VM state changes to activity log
closes #70
parent
9406a057
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
+13
-2
circle/vm/models/instance.py
+13
-2
No files found.
circle/vm/models/instance.py
View file @
7e142ce6
...
@@ -22,7 +22,8 @@ from taggit.managers import TaggableManager
...
@@ -22,7 +22,8 @@ from taggit.managers import TaggableManager
from
acl.models
import
AclBase
from
acl.models
import
AclBase
from
storage.models
import
Disk
from
storage.models
import
Disk
from
..tasks
import
local_tasks
,
vm_tasks
,
agent_tasks
from
..tasks
import
local_tasks
,
vm_tasks
,
agent_tasks
from
.activity
import
instance_activity
,
InstanceActivity
from
.activity
import
(
ActivityInProgressError
,
instance_activity
,
InstanceActivity
)
from
.common
import
BaseResourceConfigModel
,
Lease
from
.common
import
BaseResourceConfigModel
,
Lease
from
.network
import
Interface
from
.network
import
Interface
from
.node
import
Node
,
Trait
from
.node
import
Node
,
Trait
...
@@ -274,6 +275,7 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
...
@@ -274,6 +275,7 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
return
'NOSTATE'
if
act
is
None
else
act
.
resultant_state
return
'NOSTATE'
if
act
is
None
else
act
.
resultant_state
def
manual_state_change
(
self
,
new_state
,
reason
=
None
,
user
=
None
):
def
manual_state_change
(
self
,
new_state
,
reason
=
None
,
user
=
None
):
# TODO cancel concurrent activity (if exists)
act
=
InstanceActivity
.
create
(
code_suffix
=
'manual_state_change'
,
act
=
InstanceActivity
.
create
(
code_suffix
=
'manual_state_change'
,
instance
=
self
,
user
=
user
)
instance
=
self
,
user
=
user
)
act
.
finished
=
act
.
started
act
.
finished
=
act
.
started
...
@@ -283,7 +285,16 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
...
@@ -283,7 +285,16 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
act
.
save
()
act
.
save
()
def
vm_state_changed
(
self
,
new_state
):
def
vm_state_changed
(
self
,
new_state
):
pass
try
:
act
=
InstanceActivity
.
create
(
code_suffix
=
'vm_state_changed'
,
instance
=
self
)
except
ActivityInProgressError
:
pass
# discard state change if another activity is in progress.
else
:
act
.
finished
=
act
.
started
act
.
resultant_state
=
new_state
act
.
succeeded
=
True
act
.
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
:
...
...
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