Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
snf-ganeti
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
itminedu
snf-ganeti
Commits
ce0392e6
Commit
ce0392e6
authored
15 years ago
by
Iustin Pop
Browse files
Options
Downloads
Patches
Plain Diff
Some cleanup of Loader.mergeData
This doesn't need to be a monadic function, let's make it a simpler one.
parent
a5f8dcdc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Ganeti/HTools/Loader.hs
+6
-6
6 additions, 6 deletions
Ganeti/HTools/Loader.hs
with
6 additions
and
6 deletions
Ganeti/HTools/Loader.hs
+
6
−
6
View file @
ce0392e6
...
...
@@ -135,7 +135,7 @@ mergeData :: [(String, DynUtil)] -- ^ Instance utilisation data
Instance
.
AssocList
)
-- ^ Data from either Text.loadData
-- or Rapi.loadData
->
Result
(
Node
.
List
,
Instance
.
List
,
String
)
mergeData
um
(
nl
,
il
)
=
do
mergeData
um
(
nl
,
il
)
=
let
il2
=
Container
.
fromAssocList
il
il3
=
foldl'
(
\
im
(
name
,
n_util
)
->
case
Container
.
findByName
im
name
of
...
...
@@ -144,16 +144,16 @@ mergeData um (nl, il) = do
let
new_i
=
inst
{
Instance
.
util
=
n_util
}
in
Container
.
add
(
Instance
.
idx
inst
)
new_i
im
)
il2
um
let
nl2
=
foldl'
fixNodes
nl
(
Container
.
elems
il3
)
let
nl3
=
Container
.
fromAssocList
nl2
=
foldl'
fixNodes
nl
(
Container
.
elems
il3
)
nl3
=
Container
.
fromAssocList
(
map
(
\
(
k
,
v
)
->
(
k
,
Node
.
buildPeers
v
il3
))
nl2
)
node_names
=
map
Node
.
name
$
Container
.
elems
nl
3
inst_names
=
map
Instance
.
name
$
Container
.
elems
il
3
node_names
=
map
(
Node
.
name
.
snd
)
nl
inst_names
=
map
(
Instance
.
name
.
snd
)
il
common_suffix
=
longestDomain
(
node_names
++
inst_names
)
csl
=
length
common_suffix
snl
=
Container
.
map
(
\
n
->
setName
n
(
stripSuffix
csl
$
nameOf
n
))
nl3
sil
=
Container
.
map
(
\
i
->
setName
i
(
stripSuffix
csl
$
nameOf
i
))
il3
return
(
snl
,
sil
,
common_suffix
)
in
Ok
(
snl
,
sil
,
common_suffix
)
-- | Checks the cluster data for consistency.
checkData
::
Node
.
List
->
Instance
.
List
...
...
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