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
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
c342b6da
authored
Jul 21, 2014
by
Guba Sándor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: rewrite manual_state_change
parent
dc0fd302
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
9 deletions
+4
-9
circle/vm/models/instance.py
+4
-9
No files found.
circle/vm/models/instance.py
View file @
c342b6da
...
...
@@ -270,6 +270,7 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
(
'create_vm'
,
_
(
'Can create a new VM.'
)),
(
'config_ports'
,
_
(
'Can configure port forwards.'
)),
(
'recover'
,
_
(
'Can recover a destroyed VM.'
)),
(
'change_state'
,
_
(
'Can change VM state to NOSTATE.'
)),
)
verbose_name
=
_
(
'instance'
)
verbose_name_plural
=
_
(
'instances'
)
...
...
@@ -442,19 +443,13 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
self
.
time_of_suspend
,
self
.
time_of_delete
=
self
.
get_renew_times
()
super
(
Instance
,
self
)
.
clean
(
*
args
,
**
kwargs
)
def
manual_state_change
(
self
,
new_state
=
"NOSTATE"
,
reason
=
None
,
user
=
None
):
def
manual_state_change
(
self
,
activity
,
new_state
=
"NOSTATE"
,
reason
=
None
,
user
=
None
):
""" Manually change state of an Instance.
Can be used to recover VM after administrator fixed problems.
"""
# TODO cancel concurrent activity (if exists)
act
=
InstanceActivity
.
create
(
code_suffix
=
'manual_state_change'
,
instance
=
self
,
user
=
user
)
act
.
finished
=
act
.
started
act
.
result
=
reason
act
.
resultant_state
=
new_state
act
.
succeeded
=
True
act
.
save
()
activity
.
resultant_state
=
new_state
def
vm_state_changed
(
self
,
new_state
):
# log state change
...
...
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