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
27671a61
Commit
27671a61
authored
15 years ago
by
Iustin Pop
Browse files
Options
Downloads
Patches
Plain Diff
Small change in some list arguments
This is simpler than the concat operator.
parent
1cd133d6
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
+4
-3
4 additions, 3 deletions
Ganeti/HTools/Luxi.hs
Ganeti/HTools/Text.hs
+2
-2
2 additions, 2 deletions
Ganeti/HTools/Text.hs
with
6 additions
and
5 deletions
Ganeti/HTools/Luxi.hs
+
4
−
3
View file @
27671a61
...
...
@@ -93,7 +93,8 @@ getInstances ktn arr = toArray arr >>= mapM (parseInstance ktn)
parseInstance
::
[(
String
,
Ndx
)]
->
JSValue
->
Result
(
String
,
Instance
.
Instance
)
parseInstance
ktn
(
JSArray
(
name
:
disk
:
mem
:
vcpus
:
status
:
pnode
:
snodes
:
[]
))
=
do
parseInstance
ktn
(
JSArray
[
name
,
disk
,
mem
,
vcpus
,
status
,
pnode
,
snodes
])
=
do
xname
<-
annotateResult
"Parsing new instance"
(
fromJVal
name
)
let
convert
v
=
annotateResult
(
"Instance '"
++
xname
++
"'"
)
(
fromJVal
v
)
xdisk
<-
convert
disk
...
...
@@ -115,8 +116,8 @@ getNodes arr = toArray arr >>= mapM parseNode
-- | Construct a node from a JSON object.
parseNode
::
JSValue
->
Result
(
String
,
Node
.
Node
)
parseNode
(
JSArray
(
name
:
mtotal
:
mnode
:
mfree
:
dtotal
:
dfree
:
ctotal
:
offline
:
drained
:
[
]
)
)
parseNode
(
JSArray
[
name
,
mtotal
,
mnode
,
mfree
,
dtotal
,
dfree
,
ctotal
,
offline
,
drained
])
=
do
xname
<-
annotateResult
"Parsing new node"
(
fromJVal
name
)
let
convert
v
=
annotateResult
(
"Node '"
++
xname
++
"'"
)
(
fromJVal
v
)
...
...
This diff is collapsed.
Click to expand it.
Ganeti/HTools/Text.hs
+
2
−
2
View file @
27671a61
...
...
@@ -42,7 +42,7 @@ import qualified Ganeti.HTools.Instance as Instance
-- | Load a node from a field list.
loadNode
::
(
Monad
m
)
=>
[
String
]
->
m
(
String
,
Node
.
Node
)
loadNode
(
name
:
tm
:
nm
:
fm
:
td
:
fd
:
tc
:
fo
:
[]
)
=
do
loadNode
[
name
,
tm
,
nm
,
fm
,
td
,
fd
,
tc
,
fo
]
=
do
new_node
<-
if
any
(
==
"?"
)
[
tm
,
nm
,
fm
,
td
,
fd
,
tc
]
||
fo
==
"Y"
then
return
$
Node
.
create
name
0
0
0
0
0
0
True
...
...
@@ -60,7 +60,7 @@ loadNode s = fail $ "Invalid/incomplete node data: '" ++ show s ++ "'"
-- | Load an instance from a field list.
loadInst
::
(
Monad
m
)
=>
[(
String
,
Ndx
)]
->
[
String
]
->
m
(
String
,
Instance
.
Instance
)
loadInst
ktn
(
name
:
mem
:
dsk
:
vcpus
:
status
:
pnode
:
snode
:
[]
)
=
do
loadInst
ktn
[
name
,
mem
,
dsk
,
vcpus
,
status
,
pnode
,
snode
]
=
do
pidx
<-
lookupNode
ktn
name
pnode
sidx
<-
(
if
null
snode
then
return
Node
.
noSecondary
else
lookupNode
ktn
name
snode
)
...
...
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