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
ec18dca9
Commit
ec18dca9
authored
16 years ago
by
Iustin Pop
Browse files
Options
Downloads
Patches
Plain Diff
Add command line support for offlining nodes
This patch modifies hbal (only, hn1 not yet) for setting nodes offline.
parent
c2c1ef0c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Ganeti/HTools/Container.hs
+1
-0
1 addition, 0 deletions
Ganeti/HTools/Container.hs
hbal.hs
+17
-2
17 additions, 2 deletions
hbal.hs
with
18 additions
and
2 deletions
Ganeti/HTools/Container.hs
+
1
−
0
View file @
ec18dca9
...
...
@@ -19,6 +19,7 @@ module Ganeti.HTools.Container
,
add
,
addTwo
,
remove
,
IntMap
.
map
-- * Conversion
,
elems
,
keys
...
...
This diff is collapsed.
Click to expand it.
hbal.hs
+
17
−
2
View file @
ec18dca9
...
...
@@ -17,6 +17,7 @@ import Text.Printf (printf)
import
qualified
Ganeti.HTools.Container
as
Container
import
qualified
Ganeti.HTools.Cluster
as
Cluster
import
qualified
Ganeti.HTools.Version
as
Version
import
qualified
Ganeti.HTools.Node
as
Node
import
Ganeti.HTools.Rapi
import
Ganeti.HTools.Utils
...
...
@@ -31,6 +32,7 @@ data Options = Options
,
optMaster
::
String
-- ^ Collect data from RAPI
,
optVerbose
::
Int
-- ^ Verbosity level
,
optShowVer
::
Bool
-- ^ Just show the program version
,
optOffline
::
[
String
]
-- ^ Names of offline nodes
}
deriving
Show
-- | Default values for the command line options.
...
...
@@ -45,6 +47,7 @@ defaultOptions = Options
,
optMaster
=
""
,
optVerbose
=
0
,
optShowVer
=
False
,
optOffline
=
[]
}
-- | Options list and functions
...
...
@@ -79,6 +82,9 @@ options =
,
Option
[
'V'
]
[
"version"
]
(
NoArg
(
\
opts
->
opts
{
optShowVer
=
True
}))
"show the version of the program"
,
Option
[
'O'
]
[
"offline"
]
(
ReqArg
(
\
n
opts
->
opts
{
optOffline
=
n
:
optOffline
opts
})
"NODE"
)
" set node as offline"
]
-- | Command line parser, using the 'options' structure.
...
...
@@ -109,7 +115,8 @@ iterateDepth :: Cluster.Table -- ^ The starting table
iterateDepth
ini_tbl
max_rounds
ktn
kti
nmlen
imlen
cmd_strs
oneline
=
let
Cluster
.
Table
ini_nl
ini_il
ini_cv
ini_plc
=
ini_tbl
all_inst
=
Container
.
elems
ini_il
node_idx
=
Container
.
keys
ini_nl
node_idx
=
map
Node
.
idx
.
filter
(
not
.
Node
.
offline
)
$
Container
.
elems
ini_nl
fin_tbl
=
Cluster
.
checkMove
node_idx
ini_tbl
all_inst
(
Cluster
.
Table
_
_
fin_cv
fin_plc
)
=
fin_tbl
ini_plc_len
=
length
ini_plc
...
...
@@ -152,7 +159,15 @@ main = do
host
->
(
readData
getNodes
host
,
readData
getInstances
host
)
(
nl
,
il
,
csf
,
ktn
,
kti
)
<-
liftM2
Cluster
.
loadData
node_data
inst_data
(
loaded_nl
,
il
,
csf
,
ktn
,
kti
)
<-
liftM2
Cluster
.
loadData
node_data
inst_data
let
offline_names
=
optOffline
opts
offline_indices
=
fst
.
unzip
.
filter
(
\
(
_
,
n
)
->
elem
n
offline_names
)
$
ktn
let
nl
=
Container
.
map
(
\
n
->
if
elem
(
Node
.
idx
n
)
offline_indices
then
Node
.
setOffline
n
True
else
n
)
loaded_nl
unless
oneline
$
printf
"Loaded %d nodes, %d instances
\n
"
(
Container
.
size
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