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
May 12, 2016
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
Show 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 @@
...
@@ -56,6 +56,11 @@
<span
class=
"label label-warning"
>
{% trans "Offline" %}
</span>
<span
class=
"label label-warning"
>
{% trans "Offline" %}
</span>
{% endif %}
{% endif %}
</div>
</div>
<div>
{% for k, v in queues.iteritems %}
<span
class=
"label label-{% if v %}success{% else %}danger{% endif %}"
>
{{ k }}
</span>
{% endfor %}
</div>
</div>
</div>
<div
class=
"col-md-10"
id=
"node-detail-pane"
>
<div
class=
"col-md-10"
id=
"node-detail-pane"
>
<div
class=
"panel panel-default"
id=
"node-detail-panel"
>
<div
class=
"panel panel-default"
id=
"node-detail-panel"
>
...
...
circle/dashboard/tests/test_views.py
View file @
52026bc1
...
@@ -588,6 +588,12 @@ class NodeDetailTest(LoginMixin, MockCeleryMixin, TestCase):
...
@@ -588,6 +588,12 @@ class NodeDetailTest(LoginMixin, MockCeleryMixin, TestCase):
node
=
Node
.
objects
.
get
(
pk
=
1
)
node
=
Node
.
objects
.
get
(
pk
=
1
)
trait
,
created
=
Trait
.
objects
.
get_or_create
(
name
=
'testtrait'
)
trait
,
created
=
Trait
.
objects
.
get_or_create
(
name
=
'testtrait'
)
node
.
traits
.
add
(
trait
)
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
):
def
tearDown
(
self
):
super
(
NodeDetailTest
,
self
)
.
tearDown
()
super
(
NodeDetailTest
,
self
)
.
tearDown
()
...
@@ -595,6 +601,7 @@ class NodeDetailTest(LoginMixin, MockCeleryMixin, TestCase):
...
@@ -595,6 +601,7 @@ class NodeDetailTest(LoginMixin, MockCeleryMixin, TestCase):
self
.
u2
.
delete
()
self
.
u2
.
delete
()
self
.
us
.
delete
()
self
.
us
.
delete
()
self
.
g1
.
delete
()
self
.
g1
.
delete
()
self
.
patcher
.
stop
()
def
test_404_superuser_node_page
(
self
):
def
test_404_superuser_node_page
(
self
):
c
=
Client
()
c
=
Client
()
...
@@ -602,6 +609,12 @@ class NodeDetailTest(LoginMixin, MockCeleryMixin, TestCase):
...
@@ -602,6 +609,12 @@ class NodeDetailTest(LoginMixin, MockCeleryMixin, TestCase):
response
=
c
.
get
(
'/dashboard/node/25555/'
)
response
=
c
.
get
(
'/dashboard/node/25555/'
)
self
.
assertEqual
(
response
.
status_code
,
404
)
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
):
def
test_302_user_node_page
(
self
):
c
=
Client
()
c
=
Client
()
self
.
login
(
c
,
'user1'
)
self
.
login
(
c
,
'user1'
)
...
...
circle/dashboard/views/node.py
View file @
52026bc1
...
@@ -37,6 +37,7 @@ from django_tables2 import SingleTableView
...
@@ -37,6 +37,7 @@ from django_tables2 import SingleTableView
from
firewall.models
import
Host
from
firewall.models
import
Host
from
vm.models
import
Node
,
NodeActivity
,
Trait
from
vm.models
import
Node
,
NodeActivity
,
Trait
from
vm.tasks.vm_tasks
import
check_queue
from
..forms
import
TraitForm
,
HostForm
,
NodeForm
from
..forms
import
TraitForm
,
HostForm
,
NodeForm
from
..tables
import
NodeListTable
from
..tables
import
NodeListTable
...
@@ -107,6 +108,13 @@ class NodeDetailView(LoginRequiredMixin,
...
@@ -107,6 +108,13 @@ class NodeDetailView(LoginRequiredMixin,
context
[
'trait_form'
]
=
form
context
[
'trait_form'
]
=
form
context
[
'graphite_enabled'
]
=
(
context
[
'graphite_enabled'
]
=
(
settings
.
GRAPHITE_URL
is
not
None
)
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
return
context
def
post
(
self
,
request
,
*
args
,
**
kwargs
):
def
post
(
self
,
request
,
*
args
,
**
kwargs
):
...
...
circle/vm/models/node.py
View file @
52026bc1
...
@@ -160,6 +160,8 @@ class Node(OperatedMixin, TimeStampedModel):
...
@@ -160,6 +160,8 @@ class Node(OperatedMixin, TimeStampedModel):
"""
"""
try
:
try
:
self
.
get_remote_queue_name
(
"vm"
,
"fast"
)
self
.
get_remote_queue_name
(
"vm"
,
"fast"
)
self
.
get_remote_queue_name
(
"vm"
,
"slow"
)
self
.
get_remote_queue_name
(
"net"
,
"fast"
)
except
:
except
:
return
False
return
False
else
:
else
:
...
...
circle/vm/tasks/vm_tasks.py
View file @
52026bc1
...
@@ -57,7 +57,7 @@ def get_queues():
...
@@ -57,7 +57,7 @@ def get_queues():
inspect
=
celery
.
control
.
inspect
()
inspect
=
celery
.
control
.
inspect
()
inspect
.
timeout
=
0.5
inspect
.
timeout
=
0.5
result
=
inspect
.
active_queues
()
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
)
cache
.
set
(
key
,
result
,
10
)
return
result
return
result
...
...
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