Revision d953a965 htools/Ganeti/HTools/Text.hs
b/htools/Ganeti/HTools/Text.hs | ||
---|---|---|
118 | 118 |
serializeISpec :: ISpec -> String |
119 | 119 |
serializeISpec ispec = |
120 | 120 |
-- this needs to be kept in sync with the object definition |
121 |
let ISpec mem_s cpu_c disk_s disk_c nic_c = ispec |
|
122 |
strings = [show mem_s, show cpu_c, show disk_s, show disk_c, show nic_c] |
|
121 |
let ISpec mem_s cpu_c disk_s disk_c nic_c su = ispec |
|
122 |
strings = [show mem_s, show cpu_c, show disk_s, show disk_c, show nic_c, |
|
123 |
show su] |
|
123 | 124 |
in intercalate "," strings |
124 | 125 |
|
125 | 126 |
-- | Generate disk template data. |
... | ... | |
238 | 239 |
|
239 | 240 |
-- | Loads a spec from a field list. |
240 | 241 |
loadISpec :: String -> [String] -> Result ISpec |
241 |
loadISpec owner [mem_s, cpu_c, dsk_s, dsk_c, nic_c] = do |
|
242 |
loadISpec owner [mem_s, cpu_c, dsk_s, dsk_c, nic_c, su] = do
|
|
242 | 243 |
xmem_s <- tryRead (owner ++ "/memsize") mem_s |
243 | 244 |
xcpu_c <- tryRead (owner ++ "/cpucount") cpu_c |
244 | 245 |
xdsk_s <- tryRead (owner ++ "/disksize") dsk_s |
245 | 246 |
xdsk_c <- tryRead (owner ++ "/diskcount") dsk_c |
246 | 247 |
xnic_c <- tryRead (owner ++ "/niccount") nic_c |
247 |
return $ ISpec xmem_s xcpu_c xdsk_s xdsk_c xnic_c |
|
248 |
xsu <- tryRead (owner ++ "/spindleuse") su |
|
249 |
return $ ISpec xmem_s xcpu_c xdsk_s xdsk_c xnic_c xsu |
|
248 | 250 |
loadISpec owner s = fail $ "Invalid ispec data for " ++ owner ++ ": " ++ show s |
249 | 251 |
|
250 | 252 |
-- | Loads an ipolicy from a field list. |
Also available in: Unified diff