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
0a580d1d
authored
Sep 25, 2018
by
Chif Gergő
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Aggregate nodes in error message
Each node, which has unreachable monitor info shown in one error message.
parent
01039675
Pipeline
#660
passed with stage
in 0 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
3 deletions
+10
-3
circle/dashboard/views/node.py
+8
-3
circle/vm/models/node.py
+2
-0
No files found.
circle/dashboard/views/node.py
View file @
0a580d1d
...
...
@@ -193,7 +193,6 @@ class NodeList(LoginRequiredMixin, GraphMixin, SingleTableView):
def
get
(
self
,
*
args
,
**
kwargs
):
if
not
self
.
request
.
user
.
has_perm
(
'vm.view_statistics'
):
raise
PermissionDenied
()
self
.
wrong_nodes_message
()
if
self
.
request
.
is_ajax
():
nodes
=
Node
.
objects
.
all
()
nodes
=
[{
...
...
@@ -211,14 +210,20 @@ class NodeList(LoginRequiredMixin, GraphMixin, SingleTableView):
return
super
(
NodeList
,
self
)
.
get
(
*
args
,
**
kwargs
)
def
get_queryset
(
self
):
self
.
wrong_nodes_message
()
return
Node
.
objects
.
annotate
(
number_of_VMs
=
Count
(
'instance_set'
))
.
select_related
(
'host'
)
def
wrong_nodes_message
(
self
):
wrong_nodes
=
''
for
node
in
Node
.
objects
.
all
():
if
node
.
monitor_info
is
None
:
messages
.
error
(
self
.
request
,
"Can't reach "
+
node
.
name
+
" monitor info"
)
if
wrong_nodes
!=
''
:
wrong_nodes
+=
','
wrong_nodes
+=
' '
+
node
.
name
if
wrong_nodes
!=
''
:
messages
.
error
(
self
.
request
,
"Can't reach"
+
wrong_nodes
+
" monitor info"
)
class
NodeCreate
(
LoginRequiredMixin
,
SuperuserRequiredMixin
,
TemplateView
):
...
...
circle/vm/models/node.py
View file @
0a580d1d
...
...
@@ -364,6 +364,8 @@ class Node(OperatedMixin, TimeStampedModel):
return
self
.
info
.
get
(
'driver_version'
)
def
get_monitor_info
(
self
,
metric
):
# return with the metric value if the monitor info not none
# or return 0 if its None or the metric unreachable
if
self
.
monitor_info
is
None
:
return
0
elif
self
.
monitor_info
.
get
(
metric
)
is
None
:
...
...
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