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
fed6ed40
authored
Sep 25, 2014
by
Bach Dániel
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'issue-289' into 'master'
show current node of vm fixes
#289
parents
dc674ca8
bc48c0ba
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
17 deletions
+33
-17
circle/dashboard/static/dashboard/dashboard.css
+4
-0
circle/dashboard/templates/dashboard/vm-detail/home.html
+14
-0
circle/vm/models/instance.py
+9
-3
circle/vm/operations.py
+3
-8
circle/vm/tests/test_models.py
+3
-6
No files found.
circle/dashboard/static/dashboard/dashboard.css
View file @
fed6ed40
...
...
@@ -974,6 +974,10 @@ textarea[name="new_members"] {
color
:
orange
;
}
#vm-info-pane
{
margin-bottom
:
20px
;
}
.node-list-table
tbody
>
tr
>
td
,
.node-list-table
thead
>
tr
>
th
{
vertical-align
:
middle
;
}
...
...
circle/dashboard/templates/dashboard/vm-detail/home.html
View file @
fed6ed40
...
...
@@ -90,6 +90,20 @@
</div>
</form>
</div>
<!-- id:vm-details-tags -->
{% if request.user.is_superuser %}
<dl>
<dt>
{% trans "Node" %}:
</dt>
<dd>
{% if instance.node %}
<a
href=
"{{ instance.node.get_absolute_url }}"
>
{{ instance.node.name }}
</a>
{% else %}
-
{% endif %}
</dd>
{% endif %}
</dl>
<dl>
<dt>
{% trans "Template" %}:
</dt>
<dd>
...
...
circle/vm/models/instance.py
View file @
fed6ed40
...
...
@@ -919,10 +919,16 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
delete_dump
.
apply_async
(
args
=
[
self
.
mem_dump
[
'path'
]],
queue
=
queue_name
)
.
get
(
timeout
=
timeout
)
def
allocate_node
(
self
):
if
self
.
node
is
None
:
self
.
node
=
self
.
select_node
()
def
allocate_node
(
self
,
activity
):
if
self
.
node
is
not
None
:
return
None
with
activity
.
sub_activity
(
'scheduling'
,
readable_name
=
ugettext_noop
(
"schedule"
))
as
sa
:
sa
.
result
=
self
.
node
=
self
.
select_node
()
self
.
save
()
return
self
.
node
def
yield_node
(
self
):
if
self
.
node
is
not
None
:
...
...
circle/vm/operations.py
View file @
fed6ed40
...
...
@@ -293,7 +293,7 @@ class DeployOperation(InstanceOperation):
def
_operation
(
self
,
activity
,
timeout
=
15
):
# Allocate VNC port and host node
self
.
instance
.
allocate_vnc_port
()
self
.
instance
.
allocate_node
()
self
.
instance
.
allocate_node
(
activity
)
# Deploy virtual images
with
activity
.
sub_activity
(
...
...
@@ -398,12 +398,7 @@ class MigrateOperation(InstanceOperation):
def
_operation
(
self
,
activity
,
to_node
=
None
,
timeout
=
120
):
if
not
to_node
:
with
activity
.
sub_activity
(
'scheduling'
,
readable_name
=
ugettext_noop
(
"schedule"
))
as
sa
:
to_node
=
self
.
instance
.
select_node
()
sa
.
result
=
to_node
self
.
instance
.
allocate_node
(
activity
)
try
:
with
activity
.
sub_activity
(
'migrate_vm'
,
readable_name
=
create_readable
(
...
...
@@ -742,7 +737,7 @@ class WakeUpOperation(InstanceOperation):
def
_operation
(
self
,
activity
,
timeout
=
60
):
# Schedule vm
self
.
instance
.
allocate_vnc_port
()
self
.
instance
.
allocate_node
()
self
.
instance
.
allocate_node
(
activity
)
# Resume vm
with
activity
.
sub_activity
(
...
...
circle/vm/tests/test_models.py
View file @
fed6ed40
...
...
@@ -112,8 +112,7 @@ class InstanceTestCase(TestCase):
migrate_op
(
system
=
True
)
migr
.
apply_async
.
assert_called
()
self
.
assertIn
(
call
.
sub_activity
(
u'scheduling'
,
readable_name
=
u'schedule'
),
act
.
mock_calls
)
inst
.
allocate_node
.
assert_called
()
inst
.
select_node
.
assert_called
()
def
test_migrate_wo_scheduling
(
self
):
...
...
@@ -130,7 +129,7 @@ class InstanceTestCase(TestCase):
migrate_op
(
to_node
=
inst
.
node
,
system
=
True
)
migr
.
apply_async
.
assert_called
()
self
.
assertNotIn
(
call
.
sub_activity
(
u'scheduling'
),
act
.
mock_calls
)
inst
.
allocate_node
.
assert_called
(
)
def
test_migrate_with_error
(
self
):
inst
=
Mock
(
destroyed_at
=
None
,
spec
=
Instance
)
...
...
@@ -149,11 +148,9 @@ class InstanceTestCase(TestCase):
migr
.
apply_async
.
assert_called
()
self
.
assertIn
(
call
.
sub_activity
(
u'scheduling'
,
readable_name
=
u'schedule'
),
act
.
mock_calls
)
self
.
assertIn
(
call
.
sub_activity
(
u'rollback_net'
,
readable_name
=
u'redeploy network (rollback)'
),
act
.
mock_calls
)
inst
.
select
_node
.
assert_called
()
inst
.
allocate
_node
.
assert_called
()
def
test_status_icon
(
self
):
inst
=
MagicMock
(
spec
=
Instance
)
...
...
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