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
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
6b0da54a
authored
Mar 16, 2014
by
Bach Dániel
Committed by
Őry Máté
Mar 17, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: fix disappearing vnc port + node
parent
041646aa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
7 deletions
+17
-7
circle/vm/models/instance.py
+4
-5
circle/vm/tests/test_models.py
+13
-2
No files found.
circle/vm/models/instance.py
View file @
6b0da54a
...
...
@@ -389,16 +389,15 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
except
ActivityInProgressError
:
pass
# discard state change if another activity is in progress.
else
:
if
new_state
==
'STOPPED'
:
self
.
vnc_port
=
None
self
.
node
=
None
self
.
save
()
act
.
finished
=
act
.
started
act
.
resultant_state
=
new_state
act
.
succeeded
=
True
act
.
save
()
if
new_state
==
'STOPPED'
:
self
.
vnc_port
=
None
self
.
node
=
None
self
.
save
()
@permalink
def
get_absolute_url
(
self
):
return
(
'dashboard.views.detail'
,
None
,
{
'pk'
:
self
.
id
})
...
...
circle/vm/tests/test_models.py
View file @
6b0da54a
from
django.test
import
TestCase
from
mock
import
Mock
from
mock
import
Mock
,
MagicMock
,
patch
from
..models.common
import
(
Lease
)
from
..models.instance
import
(
find_unused_port
,
InstanceTemplate
,
Instance
find_unused_port
,
InstanceTemplate
,
Instance
,
ActivityInProgressError
)
from
..models.network
import
(
Interface
...
...
@@ -39,6 +39,17 @@ class InstanceTestCase(TestCase):
inst
=
Mock
(
state
=
'RUNNING'
)
assert
Instance
.
is_running
.
getter
(
inst
)
def
test_mon_stopped_while_activity_running
(
self
):
node
=
Mock
()
port
=
Mock
()
inst
=
MagicMock
(
spec
=
Instance
,
node
=
node
,
vnc_port
=
port
)
inst
.
save
.
side_effect
=
AssertionError
with
patch
(
'vm.models.instance.InstanceActivity'
)
as
ia
:
ia
.
create
.
side_effect
=
ActivityInProgressError
(
MagicMock
())
Instance
.
vm_state_changed
(
inst
,
'STOPPED'
)
self
.
assertEquals
(
inst
.
node
,
node
)
self
.
assertEquals
(
inst
.
vnc_port
,
port
)
class
InterfaceTestCase
(
TestCase
):
...
...
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