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
52026bc1
authored
8 years ago
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'issue-426' into 'master'
vmdriver queue alive check Closes
#426
See merge request
!371
parents
2c4472cf
2192dc4f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
1 deletions
+29
-1
circle/dashboard/templates/dashboard/node-detail.html
+5
-0
circle/dashboard/tests/test_views.py
+13
-0
circle/dashboard/views/node.py
+8
-0
circle/vm/models/node.py
+2
-0
circle/vm/tasks/vm_tasks.py
+1
-1
No files found.
circle/dashboard/templates/dashboard/node-detail.html
View file @
52026bc1
...
...
@@ -56,6 +56,11 @@
<span
class=
"label label-warning"
>
{% trans "Offline" %}
</span>
{% endif %}
</div>
<div>
{% for k, v in queues.iteritems %}
<span
class=
"label label-{% if v %}success{% else %}danger{% endif %}"
>
{{ k }}
</span>
{% endfor %}
</div>
</div>
<div
class=
"col-md-10"
id=
"node-detail-pane"
>
<div
class=
"panel panel-default"
id=
"node-detail-panel"
>
...
...
This diff is collapsed.
Click to expand it.
circle/dashboard/tests/test_views.py
View file @
52026bc1
...
...
@@ -588,6 +588,12 @@ class NodeDetailTest(LoginMixin, MockCeleryMixin, TestCase):
node
=
Node
.
objects
.
get
(
pk
=
1
)
trait
,
created
=
Trait
.
objects
.
get_or_create
(
name
=
'testtrait'
)
node
.
traits
.
add
(
trait
)
self
.
patcher
=
patch
(
"vm.tasks.vm_tasks.get_queues"
,
return_value
=
{
'x'
:
[{
'name'
:
"devenv.vm.fast"
}],
'y'
:
[{
'name'
:
"devenv.vm.slow"
}],
'z'
:
[{
'name'
:
"devenv.net.fast"
}],
})
self
.
patcher
.
start
()
def
tearDown
(
self
):
super
(
NodeDetailTest
,
self
)
.
tearDown
()
...
...
@@ -595,6 +601,7 @@ class NodeDetailTest(LoginMixin, MockCeleryMixin, TestCase):
self
.
u2
.
delete
()
self
.
us
.
delete
()
self
.
g1
.
delete
()
self
.
patcher
.
stop
()
def
test_404_superuser_node_page
(
self
):
c
=
Client
()
...
...
@@ -602,6 +609,12 @@ class NodeDetailTest(LoginMixin, MockCeleryMixin, TestCase):
response
=
c
.
get
(
'/dashboard/node/25555/'
)
self
.
assertEqual
(
response
.
status_code
,
404
)
def
test_200_superuser_node_page
(
self
):
c
=
Client
()
self
.
login
(
c
,
'superuser'
)
response
=
c
.
get
(
'/dashboard/node/1/'
)
self
.
assertEqual
(
response
.
status_code
,
200
)
def
test_302_user_node_page
(
self
):
c
=
Client
()
self
.
login
(
c
,
'user1'
)
...
...
This diff is collapsed.
Click to expand it.
circle/dashboard/views/node.py
View file @
52026bc1
...
...
@@ -37,6 +37,7 @@ from django_tables2 import SingleTableView
from
firewall.models
import
Host
from
vm.models
import
Node
,
NodeActivity
,
Trait
from
vm.tasks.vm_tasks
import
check_queue
from
..forms
import
TraitForm
,
HostForm
,
NodeForm
from
..tables
import
NodeListTable
...
...
@@ -107,6 +108,13 @@ class NodeDetailView(LoginRequiredMixin,
context
[
'trait_form'
]
=
form
context
[
'graphite_enabled'
]
=
(
settings
.
GRAPHITE_URL
is
not
None
)
node_hostname
=
self
.
object
.
host
.
hostname
context
[
'queues'
]
=
{
'vmcelery.fast'
:
check_queue
(
node_hostname
,
"vm"
,
"fast"
),
'vmcelery.slow'
:
check_queue
(
node_hostname
,
"vm"
,
"slow"
),
'netcelery.fast'
:
check_queue
(
node_hostname
,
"net"
,
"fast"
),
}
return
context
def
post
(
self
,
request
,
*
args
,
**
kwargs
):
...
...
This diff is collapsed.
Click to expand it.
circle/vm/models/node.py
View file @
52026bc1
...
...
@@ -160,6 +160,8 @@ class Node(OperatedMixin, TimeStampedModel):
"""
try
:
self
.
get_remote_queue_name
(
"vm"
,
"fast"
)
self
.
get_remote_queue_name
(
"vm"
,
"slow"
)
self
.
get_remote_queue_name
(
"net"
,
"fast"
)
except
:
return
False
else
:
...
...
This diff is collapsed.
Click to expand it.
circle/vm/tasks/vm_tasks.py
View file @
52026bc1
...
...
@@ -57,7 +57,7 @@ def get_queues():
inspect
=
celery
.
control
.
inspect
()
inspect
.
timeout
=
0.5
result
=
inspect
.
active_queues
()
logger
.
debug
(
'Queue list of length
%
d cached.'
,
len
(
result
))
logger
.
debug
(
'Queue list of length
%
d cached.'
,
result
and
len
(
result
))
cache
.
set
(
key
,
result
,
10
)
return
result
...
...
This diff is collapsed.
Click to expand it.
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