Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cc-server
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirror
cc-server
Commits
72ad3cec
Commit
72ad3cec
authored
13 years ago
by
Antoine Millet
Browse files
Options
Downloads
Patches
Plain Diff
Better error reporting in Elector class.
parent
5ab5e88b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ccserver/election.py
+18
-3
18 additions, 3 deletions
ccserver/election.py
with
18 additions
and
3 deletions
ccserver/election.py
+
18
−
3
View file @
72ad3cec
...
...
@@ -86,7 +86,16 @@ class Elector(object):
distribute
=
getattr
(
self
,
func
)
# Get the destination hypervisor candidates:
candidates
=
self
.
_get_candidates
(
self
.
FILTERS
[
mtype
])
candidates
,
errors
=
self
.
_get_candidates
(
self
.
FILTERS
[
mtype
])
# Check if VM migration election raised an error:
if
errors
:
# If errors are found, we report only the first of them, because we
# have currently no way to report problem for each vm:
vm
,
desc
=
errors
[
0
]
raise
ElectionError
(
'
No destination found for %r, last destination
'
'
filtered by %s
'
%
(
vm
[
'
id
'
],
desc
))
# Distributes VMs to each candidate:
migration_plan
=
distribute
(
mtype
,
candidates
)
...
...
@@ -110,6 +119,7 @@ class Elector(object):
hvs
=
self
.
_server
.
list
(
self
.
_query_dest
,
show
=
hv_tags
)
candidates
=
[]
errors
=
[]
# Filters the candidates:
for
vm
in
vms
:
...
...
@@ -121,9 +131,14 @@ class Elector(object):
vm_dest
=
copy
(
hvs
)
for
func
,
desc
in
filterfuncs
:
vm_dest
=
func
(
vm
,
vm_dest
)
candidates
.
append
((
vm
,
vm_dest
))
# VM is added to errors if none destination HV is found for it:
if
not
vm_dest
:
errors
.
append
((
vm
,
desc
))
break
else
:
candidates
.
append
((
vm
,
vm_dest
))
return
candidates
return
candidates
,
errors
#####
##### Distribution algorithm methods:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment