Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
grid5000
reference-repository
Commits
23501e81
Commit
23501e81
authored
Apr 29, 2016
by
Jérémie Gaidamour
Browse files
[dev] Bug fix in hashdiff for pdu arrays
parent
4e19b8f7
Changes
1
Hide whitespace changes
Inline
Side-by-side
generators/input-validators/check-cluster-homogeneity.rb
View file @
23501e81
...
@@ -43,8 +43,15 @@ def cluster_homogeneity(refapi_hash, verbose=false)
...
@@ -43,8 +43,15 @@ def cluster_homogeneity(refapi_hash, verbose=false)
pdu
pdu
pdu.port
pdu.port
pdu.uid
pdu.uid
pdu[0]
pdu[1]
supported_job_types.max_walltime
supported_job_types.max_walltime
mic.ip
mic.mac
status
)
)
ignore_netkeys
=
<<-
eos
ignore_netkeys
=
<<-
eos
...
@@ -107,15 +114,37 @@ eos
...
@@ -107,15 +114,37 @@ eos
#next if node_uid != 'graphene-2'
#next if node_uid != 'graphene-2'
diffs
=
HashDiff
.
diff
(
refnode
,
node
)
diffs
=
HashDiff
.
diff
(
refnode
,
node
)
# Hack HashDiff output for arrays:
#[["-", "pdu[1]", {"uid"=>"graphene-pdu9", "port"=>24}],
# ["-", "pdu[0]", {"uid"=>"graphene-pdu9", "port"=>23}],
# ["+", "pdu[0]", {"uid"=>"graphene-pdu9", "port"=>21}],
# ["+", "pdu[1]", {"uid"=>"graphene-pdu9", "port"=>22}]]
# => should be something like this:
# [["~", "pdu[0]", {"uid"=>"graphene-pdu9", "port"=>23}, {"uid"=>"graphene-pdu9", "port"=>22},
# ["~", "pdu[1]", {"uid"=>"graphene-pdu9", "port"=>24}, {"uid"=>"graphene-pdu9", "port"=>23}}
d
=
diffs
.
select
{
|
x
|
x
[
0
]
!=
'~'
}.
group_by
{
|
x
|
x
[
1
]
}
d
.
each
{
|
k
,
v
|
d
[
k
]
=
v
.
group_by
{
|
x
|
x
[
0
]
}
}
d
.
each
{
|
k
,
v
|
if
v
.
key?
(
'-'
)
&&
v
.
key?
(
'+'
)
#puts "Warning: #{node_uid}: convert +/- -> ~ for #{k}"
diffs
.
delete
([
"-"
,
k
,
v
[
'-'
][
0
][
2
]])
diffs
.
delete
([
"+"
,
k
,
v
[
'+'
][
0
][
2
]])
diffs
<<
[
"~"
,
k
,
v
[
'-'
][
0
][
2
],
v
[
'+'
][
0
][
2
]
]
end
}
# end of hack
# Remove keys that are specific to each nodes (ip, mac etc.)
# Remove keys that are specific to each nodes (ip, mac etc.)
diffs
.
clone
.
each
{
|
diff
|
diffs
.
clone
.
each
{
|
diff
|
diffs
.
delete
(
diff
)
if
diff
[
0
]
==
'~'
&&
ignore_keys
.
include?
(
diff
[
1
])
diffs
.
delete
(
diff
)
if
diff
[
0
]
==
'~'
&&
ignore_keys
.
include?
(
diff
[
1
])
}
}
if
verbose
&&
!
diffs
.
empty?
if
verbose
&&
!
diffs
.
empty?
puts
"Differences between
#{
refnode_uid
}
and
#{
node_uid
}
:"
puts
"Differences between
#{
refnode_uid
}
and
#{
node_uid
}
:"
pp
diffs
pp
diffs
end
end
count
[
site_uid
][
cluster_uid
]
+=
diffs
.
size
count
[
site_uid
][
cluster_uid
]
+=
diffs
.
size
...
...
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