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
f89235f1
Commit
f89235f1
authored
15 years ago
by
Iustin Pop
Browse files
Options
Downloads
Patches
Plain Diff
Read cluster tags in the LUXI backend
parent
ea017cbc
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/Luxi.hs
+18
-2
18 additions, 2 deletions
Ganeti/HTools/Luxi.hs
Ganeti/Luxi.hs
+2
-0
2 additions, 0 deletions
Ganeti/Luxi.hs
with
20 additions
and
2 deletions
Ganeti/HTools/Luxi.hs
+
18
−
2
View file @
f89235f1
...
...
@@ -38,7 +38,7 @@ import Ganeti.HTools.Loader
import
Ganeti.HTools.Types
import
qualified
Ganeti.HTools.Node
as
Node
import
qualified
Ganeti.HTools.Instance
as
Instance
import
Ganeti.HTools.Utils
(
fromJVal
,
annotateResult
)
import
Ganeti.HTools.Utils
(
fromJVal
,
annotateResult
,
tryFromObj
,
asJSObject
)
-- * Utility functions
...
...
@@ -75,6 +75,10 @@ queryInstancesMsg =
use_locking
=
JSBool
False
in
JSArray
[
nnames
,
fields
,
use_locking
]
-- | The input data for cluster query
queryClusterInfoMsg
::
JSValue
queryClusterInfoMsg
=
JSArray
[]
-- | Wraper over callMethod doing node query.
queryNodes
::
L
.
Client
->
IO
(
Result
JSValue
)
queryNodes
=
L
.
callMethod
L
.
QueryNodes
queryNodesMsg
...
...
@@ -83,6 +87,9 @@ queryNodes = L.callMethod L.QueryNodes queryNodesMsg
queryInstances
::
L
.
Client
->
IO
(
Result
JSValue
)
queryInstances
=
L
.
callMethod
L
.
QueryInstances
queryInstancesMsg
queryClusterInfo
::
L
.
Client
->
IO
(
Result
JSValue
)
queryClusterInfo
=
L
.
callMethod
L
.
QueryClusterInfo
queryClusterInfoMsg
-- | Parse a instance list in JSON format.
getInstances
::
NameAssoc
->
JSValue
...
...
@@ -140,6 +147,13 @@ parseNode (JSArray [ name, mtotal, mnode, mfree, dtotal, dfree
parseNode
v
=
fail
(
"Invalid node query result: "
++
show
v
)
getClusterTags
::
JSValue
->
Result
[
String
]
getClusterTags
v
=
do
let
errmsg
=
"Parsing cluster info"
obj
<-
annotateResult
errmsg
$
asJSObject
v
tags
<-
tryFromObj
errmsg
(
fromJSObject
obj
)
"tag"
return
tags
-- * Main loader functionality
-- | Builds the cluster data from an URL.
...
...
@@ -152,10 +166,12 @@ loadData master =
(
\
s
->
do
nodes
<-
queryNodes
s
instances
<-
queryInstances
s
cinfo
<-
queryClusterInfo
s
return
$
do
-- Result monad
node_data
<-
nodes
>>=
getNodes
let
(
node_names
,
node_idx
)
=
assignIndices
node_data
inst_data
<-
instances
>>=
getInstances
node_names
let
(
_
,
inst_idx
)
=
assignIndices
inst_data
return
(
node_idx
,
inst_idx
,
[]
)
ctags
<-
cinfo
>>=
getClusterTags
return
(
node_idx
,
inst_idx
,
ctags
)
)
This diff is collapsed.
Click to expand it.
Ganeti/Luxi.hs
+
2
−
0
View file @
f89235f1
...
...
@@ -63,6 +63,7 @@ withTimeout secs descr action = do
data
LuxiOp
=
QueryInstances
|
QueryNodes
|
QueryJobs
|
QueryClusterInfo
|
SubmitManyJobs
-- | The serialisation of LuxiOps into strings in messages.
...
...
@@ -70,6 +71,7 @@ strOfOp :: LuxiOp -> String
strOfOp
QueryNodes
=
"QueryNodes"
strOfOp
QueryInstances
=
"QueryInstances"
strOfOp
QueryJobs
=
"QueryJobs"
strOfOp
QueryClusterInfo
=
"QueryClusterInfo"
strOfOp
SubmitManyJobs
=
"SubmitManyJobs"
-- | The end-of-message separator.
...
...
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