Revision d752eb39 Ganeti/HTools/Text.hs
b/Ganeti/HTools/Text.hs | ||
---|---|---|
66 | 66 |
-- | Load an instance from a field list. |
67 | 67 |
loadInst :: (Monad m) => |
68 | 68 |
[(String, Ndx)] -> [String] -> m (String, Instance.Instance) |
69 |
loadInst ktn (name:mem:dsk:status:pnode:snode:[]) = do |
|
69 |
loadInst ktn (name:mem:dsk:vcpus:status:pnode:snode:[]) = do
|
|
70 | 70 |
pidx <- lookupNode ktn name pnode |
71 | 71 |
sidx <- (if null snode then return Node.noSecondary |
72 | 72 |
else lookupNode ktn name snode) |
73 | 73 |
vmem <- tryRead name mem |
74 | 74 |
vdsk <- tryRead name dsk |
75 |
vvcpus <- tryRead name vcpus |
|
75 | 76 |
when (sidx == pidx) $ fail $ "Instance " ++ name ++ |
76 | 77 |
" has same primary and secondary node - " ++ pnode |
77 |
let newinst = Instance.create name vmem vdsk status pidx sidx |
|
78 |
let newinst = Instance.create name vmem vdsk vvcpus status pidx sidx
|
|
78 | 79 |
return (name, newinst) |
79 | 80 |
loadInst _ s = fail $ "Invalid/incomplete instance data: '" ++ (show s) ++ "'" |
80 | 81 |
|
Also available in: Unified diff