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
1e4b5230
Commit
1e4b5230
authored
15 years ago
by
Iustin Pop
Browse files
Options
Downloads
Patches
Plain Diff
Node: add function for conflicting primary count
parent
b2999982
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/Node.hs
+10
-0
10 additions, 0 deletions
Ganeti/HTools/Node.hs
with
10 additions
and
0 deletions
Ganeti/HTools/Node.hs
+
10
−
0
View file @
1e4b5230
...
...
@@ -48,6 +48,7 @@ module Ganeti.HTools.Node
,
addSec
-- * Stats
,
availDisk
,
conflictingPrimaries
-- * Formatting
,
defaultFields
,
showHeader
...
...
@@ -60,6 +61,7 @@ module Ganeti.HTools.Node
import
Data.List
import
qualified
Data.Map
as
Map
import
qualified
Data.Foldable
as
Foldable
import
Text.Printf
(
printf
)
import
qualified
Ganeti.HTools.Container
as
Container
...
...
@@ -158,6 +160,14 @@ delTags = foldl' delTag
rejectAddTags
::
TagMap
->
[
String
]
->
Bool
rejectAddTags
t
=
any
(
flip
Map
.
member
t
)
-- | Check how many primary instances have conflicting tags. The
-- algorithm to compute this is to sum the count of all tags, then
-- subtract the size of the tag map (since each tag has at least one,
-- non-conflicting instance); this is equivalent to summing the
-- values in the tag map minus one.
conflictingPrimaries
::
Node
->
Int
conflictingPrimaries
(
Node
{
pTags
=
t
})
=
Foldable
.
sum
t
-
Map
.
size
t
-- * Initialization functions
-- | Create a new node.
...
...
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