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
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
Show 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"] {
...
@@ -974,6 +974,10 @@ textarea[name="new_members"] {
color
:
orange
;
color
:
orange
;
}
}
#vm-info-pane
{
margin-bottom
:
20px
;
}
.node-list-table
tbody
>
tr
>
td
,
.node-list-table
thead
>
tr
>
th
{
.node-list-table
tbody
>
tr
>
td
,
.node-list-table
thead
>
tr
>
th
{
vertical-align
:
middle
;
vertical-align
:
middle
;
}
}
...
...
circle/dashboard/templates/dashboard/vm-detail/home.html
View file @
fed6ed40
...
@@ -90,6 +90,20 @@
...
@@ -90,6 +90,20 @@
</div>
</div>
</form>
</form>
</div>
<!-- id:vm-details-tags -->
</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>
<dl>
<dt>
{% trans "Template" %}:
</dt>
<dt>
{% trans "Template" %}:
</dt>
<dd>
<dd>
...
...
circle/vm/models/instance.py
View file @
fed6ed40
...
@@ -919,10 +919,16 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
...
@@ -919,10 +919,16 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
delete_dump
.
apply_async
(
args
=
[
self
.
mem_dump
[
'path'
]],
delete_dump
.
apply_async
(
args
=
[
self
.
mem_dump
[
'path'
]],
queue
=
queue_name
)
.
get
(
timeout
=
timeout
)
queue
=
queue_name
)
.
get
(
timeout
=
timeout
)
def
allocate_node
(
self
):
def
allocate_node
(
self
,
activity
):
if
self
.
node
is
None
:
if
self
.
node
is
not
None
:
self
.
node
=
self
.
select_node
()
return
None
with
activity
.
sub_activity
(
'scheduling'
,
readable_name
=
ugettext_noop
(
"schedule"
))
as
sa
:
sa
.
result
=
self
.
node
=
self
.
select_node
()
self
.
save
()
self
.
save
()
return
self
.
node
def
yield_node
(
self
):
def
yield_node
(
self
):
if
self
.
node
is
not
None
:
if
self
.
node
is
not
None
:
...
...
circle/vm/operations.py
View file @
fed6ed40
...
@@ -293,7 +293,7 @@ class DeployOperation(InstanceOperation):
...
@@ -293,7 +293,7 @@ class DeployOperation(InstanceOperation):
def
_operation
(
self
,
activity
,
timeout
=
15
):
def
_operation
(
self
,
activity
,
timeout
=
15
):
# Allocate VNC port and host node
# Allocate VNC port and host node
self
.
instance
.
allocate_vnc_port
()
self
.
instance
.
allocate_vnc_port
()
self
.
instance
.
allocate_node
()
self
.
instance
.
allocate_node
(
activity
)
# Deploy virtual images
# Deploy virtual images
with
activity
.
sub_activity
(
with
activity
.
sub_activity
(
...
@@ -398,12 +398,7 @@ class MigrateOperation(InstanceOperation):
...
@@ -398,12 +398,7 @@ class MigrateOperation(InstanceOperation):
def
_operation
(
self
,
activity
,
to_node
=
None
,
timeout
=
120
):
def
_operation
(
self
,
activity
,
to_node
=
None
,
timeout
=
120
):
if
not
to_node
:
if
not
to_node
:
with
activity
.
sub_activity
(
'scheduling'
,
self
.
instance
.
allocate_node
(
activity
)
readable_name
=
ugettext_noop
(
"schedule"
))
as
sa
:
to_node
=
self
.
instance
.
select_node
()
sa
.
result
=
to_node
try
:
try
:
with
activity
.
sub_activity
(
with
activity
.
sub_activity
(
'migrate_vm'
,
readable_name
=
create_readable
(
'migrate_vm'
,
readable_name
=
create_readable
(
...
@@ -742,7 +737,7 @@ class WakeUpOperation(InstanceOperation):
...
@@ -742,7 +737,7 @@ class WakeUpOperation(InstanceOperation):
def
_operation
(
self
,
activity
,
timeout
=
60
):
def
_operation
(
self
,
activity
,
timeout
=
60
):
# Schedule vm
# Schedule vm
self
.
instance
.
allocate_vnc_port
()
self
.
instance
.
allocate_vnc_port
()
self
.
instance
.
allocate_node
()
self
.
instance
.
allocate_node
(
activity
)
# Resume vm
# Resume vm
with
activity
.
sub_activity
(
with
activity
.
sub_activity
(
...
...
circle/vm/tests/test_models.py
View file @
fed6ed40
...
@@ -112,8 +112,7 @@ class InstanceTestCase(TestCase):
...
@@ -112,8 +112,7 @@ class InstanceTestCase(TestCase):
migrate_op
(
system
=
True
)
migrate_op
(
system
=
True
)
migr
.
apply_async
.
assert_called
()
migr
.
apply_async
.
assert_called
()
self
.
assertIn
(
call
.
sub_activity
(
inst
.
allocate_node
.
assert_called
()
u'scheduling'
,
readable_name
=
u'schedule'
),
act
.
mock_calls
)
inst
.
select_node
.
assert_called
()
inst
.
select_node
.
assert_called
()
def
test_migrate_wo_scheduling
(
self
):
def
test_migrate_wo_scheduling
(
self
):
...
@@ -130,7 +129,7 @@ class InstanceTestCase(TestCase):
...
@@ -130,7 +129,7 @@ class InstanceTestCase(TestCase):
migrate_op
(
to_node
=
inst
.
node
,
system
=
True
)
migrate_op
(
to_node
=
inst
.
node
,
system
=
True
)
migr
.
apply_async
.
assert_called
()
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
):
def
test_migrate_with_error
(
self
):
inst
=
Mock
(
destroyed_at
=
None
,
spec
=
Instance
)
inst
=
Mock
(
destroyed_at
=
None
,
spec
=
Instance
)
...
@@ -149,11 +148,9 @@ class InstanceTestCase(TestCase):
...
@@ -149,11 +148,9 @@ class InstanceTestCase(TestCase):
migr
.
apply_async
.
assert_called
()
migr
.
apply_async
.
assert_called
()
self
.
assertIn
(
call
.
sub_activity
(
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)'
),
u'rollback_net'
,
readable_name
=
u'redeploy network (rollback)'
),
act
.
mock_calls
)
act
.
mock_calls
)
inst
.
select
_node
.
assert_called
()
inst
.
allocate
_node
.
assert_called
()
def
test_status_icon
(
self
):
def
test_status_icon
(
self
):
inst
=
MagicMock
(
spec
=
Instance
)
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