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
507fda3f
Commit
507fda3f
authored
15 years ago
by
Iustin Pop
Browse files
Options
Downloads
Patches
Plain Diff
Allow displaying the instance map in hbal
This is similar to --print-nodes, but with much fewer fields.
parent
181d4e04
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Ganeti/HTools/CLI.hs
+8
-0
8 additions, 0 deletions
Ganeti/HTools/CLI.hs
Ganeti/HTools/Cluster.hs
+17
-1
17 additions, 1 deletion
Ganeti/HTools/Cluster.hs
hbal.1
+6
-0
6 additions, 0 deletions
hbal.1
hbal.hs
+12
-1
12 additions, 1 deletion
hbal.hs
with
43 additions
and
2 deletions
Ganeti/HTools/CLI.hs
+
8
−
0
View file @
507fda3f
...
...
@@ -34,6 +34,7 @@ module Ganeti.HTools.CLI
,
shTemplate
-- * The options
,
oPrintNodes
,
oPrintInsts
,
oPrintCommands
,
oOneline
,
oNoHeaders
...
...
@@ -79,6 +80,7 @@ defaultLuxiSocket = "/var/run/ganeti/socket/ganeti-master"
-- | Command line options structure.
data
Options
=
Options
{
optShowNodes
::
Bool
-- ^ Whether to show node status
,
optShowInsts
::
Bool
-- ^ Whether to show the instance map
,
optShowCmds
::
Maybe
FilePath
-- ^ Whether to show the command list
,
optOneline
::
Bool
-- ^ Switch output to a single line
,
optOutPath
::
FilePath
-- ^ Path to the output directory
...
...
@@ -110,6 +112,7 @@ data Options = Options
defaultOptions
::
Options
defaultOptions
=
Options
{
optShowNodes
=
False
,
optShowInsts
=
False
,
optShowCmds
=
Nothing
,
optOneline
=
False
,
optNoHeaders
=
False
...
...
@@ -145,6 +148,11 @@ oPrintNodes = Option "p" ["print-nodes"]
(
NoArg
(
\
opts
->
opts
{
optShowNodes
=
True
}))
"print the final node list"
oPrintInsts
::
OptType
oPrintInsts
=
Option
""
[
"print-instances"
]
(
NoArg
(
\
opts
->
opts
{
optShowInsts
=
True
}))
"print the final instance map"
oPrintCommands
::
OptType
oPrintCommands
=
Option
"C"
[
"print-commands"
]
(
OptArg
((
\
f
opts
->
opts
{
optShowCmds
=
Just
f
})
.
...
...
This diff is collapsed.
Click to expand it.
Ganeti/HTools/Cluster.hs
+
17
−
1
View file @
507fda3f
...
...
@@ -41,9 +41,11 @@ module Ganeti.HTools.Cluster
,
printSolution
,
printSolutionLine
,
formatCmds
,
printNodes
,
involvedNodes
,
splitJobs
-- * Display functions
,
printNodes
,
printInsts
-- * Balacing functions
,
checkMove
,
tryBalance
...
...
@@ -684,6 +686,20 @@ printNodes nl =
"pri"
"sec"
"p_fmem"
"p_fdsk"
"r_cpu"
::
String
in
unlines
(
header
:
map
helper
snl
)
-- | Print the instance list.
printInsts
::
Node
.
List
->
Instance
.
List
->
String
printInsts
nl
il
=
let
sil
=
sortBy
(
compare
`
on
`
Instance
.
idx
)
(
Container
.
elems
il
)
m_name
=
maximum
.
map
(
length
.
Instance
.
name
)
$
sil
m_nnm
=
maximum
.
map
(
length
.
Node
.
name
)
$
Container
.
elems
nl
helper
inst
=
printf
"%2s %-*s %-*s %-*s"
" "
m_name
(
Instance
.
name
inst
)
m_nnm
(
Container
.
nameOf
nl
(
Instance
.
pNode
inst
))
m_nnm
(
Container
.
nameOf
nl
(
Instance
.
sNode
inst
))
header
=
printf
"%2s %-*s %-*s %-*s"
" "
m_name
"Name"
m_nnm
"Pri_node"
m_nnm
"Sec_node"
::
String
in
unlines
(
header
:
map
helper
sil
)
-- | Shows statistics for a given node list.
printStats
::
Node
.
List
->
String
printStats
nl
=
...
...
This diff is collapsed.
Click to expand it.
hbal.1
+
6
−
0
View file @
507fda3f
...
...
@@ -33,6 +33,7 @@ Algorithm options:
Reporting options:
.BI "[ -C[" file "] ]"
.B "[ -p ]"
.B "[ --print-instances ]"
.B "[ -o ]"
.B "[ -v... | -q ]"
...
...
@@ -194,6 +195,11 @@ resource allocation in Ganeti) and thus we start a new jobset.
Prints the before and after node status, in a format designed to allow
the user to understand the node's most important parameters.
.TP
.B --print-instances
Prints the before and after instance map. This is less useful as the
node status, but it can help in understanding instance moves.
The node list will contain these informations:
.RS
.TP
...
...
This diff is collapsed.
Click to expand it.
hbal.hs
+
12
−
1
View file @
507fda3f
...
...
@@ -56,6 +56,7 @@ import Ganeti.Jobs
options
::
[
OptType
]
options
=
[
oPrintNodes
,
oPrintInsts
,
oPrintCommands
,
oOneline
,
oNodeFile
...
...
@@ -227,6 +228,11 @@ main = do
putStrLn
"Cluster is not N+1 happy, continuing but no guarantee
\
\
that the cluster will end N+1 happy."
when
(
optShowInsts
opts
)
$
do
putStrLn
""
putStrLn
"Initial instance map:"
putStrLn
$
Cluster
.
printInsts
nl
il
when
(
optShowNodes
opts
)
$
do
putStrLn
"Initial cluster status:"
...
...
@@ -257,7 +263,7 @@ main = do
(
fin_tbl
,
cmd_strs
)
<-
iterateDepth
ini_tbl
(
optMaxLength
opts
)
(
optDiskMoves
opts
)
nmlen
imlen
[]
oneline
min_cv
let
(
Cluster
.
Table
fin_nl
_
fin_cv
fin_plc
)
=
fin_tbl
let
(
Cluster
.
Table
fin_nl
fin_il
fin_cv
fin_plc
)
=
fin_tbl
ord_plc
=
reverse
fin_plc
sol_msg
=
if
null
fin_plc
then
printf
"No solution found
\n
"
...
...
@@ -296,6 +302,11 @@ main = do
exitWith
$
ExitFailure
1
Just
master
->
execJobSet
master
csf
fin_nl
il
cmd_jobs
)
when
(
optShowInsts
opts
)
$
do
putStrLn
""
putStrLn
"Final instance map:"
putStr
$
Cluster
.
printInsts
fin_nl
fin_il
when
(
optShowNodes
opts
)
$
do
let
ini_cs
=
Cluster
.
totalResources
nl
...
...
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