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
ea017cbc
Commit
ea017cbc
authored
15 years ago
by
Iustin Pop
Browse files
Options
Downloads
Patches
Plain Diff
Read cluster tags in the RAPI backend
This also shows them in hbal in verbose mode.
parent
94e05c32
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Ganeti/HTools/Rapi.hs
+4
-2
4 additions, 2 deletions
Ganeti/HTools/Rapi.hs
hbal.hs
+4
-1
4 additions, 1 deletion
hbal.hs
with
8 additions
and
3 deletions
Ganeti/HTools/Rapi.hs
+
4
−
2
View file @
ea017cbc
...
...
@@ -33,7 +33,7 @@ import Network.Curl.Types ()
import
Network.Curl.Code
import
Data.List
import
Control.Monad
import
Text.JSON
(
JSObject
,
JSValue
,
fromJSObject
)
import
Text.JSON
(
JSObject
,
JSValue
,
fromJSObject
,
decodeStrict
)
import
Text.Printf
(
printf
)
import
Ganeti.HTools.Utils
...
...
@@ -119,9 +119,11 @@ loadData master = do -- IO monad
let
url
=
formatHost
master
node_body
<-
getUrl
$
printf
"%s/2/nodes?bulk=1"
url
inst_body
<-
getUrl
$
printf
"%s/2/instances?bulk=1"
url
tags_body
<-
getUrl
$
printf
"%s/2/tags"
url
return
$
do
-- Result monad
node_data
<-
node_body
>>=
getNodes
let
(
node_names
,
node_idx
)
=
assignIndices
node_data
inst_data
<-
inst_body
>>=
getInstances
node_names
let
(
_
,
inst_idx
)
=
assignIndices
inst_data
return
(
node_idx
,
inst_idx
,
[]
)
tags_data
<-
tags_body
>>=
(
fromJResult
.
decodeStrict
)
return
(
node_idx
,
inst_idx
,
tags_data
)
This diff is collapsed.
Click to expand it.
hbal.hs
+
4
−
1
View file @
ea017cbc
...
...
@@ -187,7 +187,7 @@ main = do
verbose
=
optVerbose
opts
shownodes
=
optShowNodes
opts
(
fixed_nl
,
il
,
_
,
csf
)
<-
loadExternalData
opts
(
fixed_nl
,
il
,
ctags
,
csf
)
<-
loadExternalData
opts
let
offline_names
=
optOffline
opts
all_nodes
=
Container
.
elems
fixed_nl
...
...
@@ -210,6 +210,9 @@ main = do
nl
=
Container
.
map
(
flip
Node
.
setMdsk
m_dsk
.
flip
Node
.
setMcpu
m_cpu
)
nm
when
(
not
oneline
&&
verbose
>
1
)
$
putStrLn
$
"Loaded cluster tags: "
++
intercalate
","
ctags
when
(
Container
.
size
il
==
0
)
$
do
(
if
oneline
then
putStrLn
$
formatOneline
0
0
0
else
printf
"Cluster is empty, exiting.
\n
"
)
...
...
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