Revision bd3286e9 hspace.hs

b/hspace.hs
114 114
clusterData = [ ("MEM", printf "%.0f" . Cluster.csTmem)
115 115
              , ("DSK", printf "%.0f" . Cluster.csTdsk)
116 116
              , ("CPU", printf "%.0f" . Cluster.csTcpu)
117
              , ("VCPU", printf "%d" . Cluster.csVcpu)
117 118
              ]
118 119

  
119 120
-- | Recursively place instances on the cluster until we're out of space
......
189 190
  -- this should be the final entry
190 191
  printKeys [("OK", "1")]
191 192

  
193
formatRSpec :: String -> RSpec -> [(String, String)]
194
formatRSpec s r =
195
    [ ("KM_" ++ s ++ "_CPU", show $ rspecCpu r)
196
    , ("KM_" ++ s ++ "_MEM", show $ rspecMem r)
197
    , ("KM_" ++ s ++ "_DSK", show $ rspecDsk r)
198
    ]
199

  
200
printAllocationStats :: Node.List -> Node.List -> IO ()
201
printAllocationStats ini_nl fin_nl = do
202
  let ini_stats = Cluster.totalResources ini_nl
203
      fin_stats = Cluster.totalResources fin_nl
204
      (rini, ralo, runa) = Cluster.computeAllocationDelta ini_stats fin_stats
205
  printKeys $ formatRSpec "USED" rini
206
  printKeys $ formatRSpec "POOL" ralo
207
  printKeys $ formatRSpec "UNAV" runa
208

  
192 209
-- | Ensure a value is quoted if needed
193 210
ensureQuoted :: String -> String
194 211
ensureQuoted v = if not (all (\c -> (isAlphaNum c || c == '.')) v)
......
325 342
         hPutStrLn stderr $ Cluster.printNodes trl_nl (fromJust shownodes)
326 343

  
327 344
       printKeys $ printStats PTiered (Cluster.totalResources trl_nl)
328
       printKeys [("TSPEC", intercalate " " spec_map')])
345
       printKeys [("TSPEC", intercalate " " spec_map')]
346
       printAllocationStats nl trl_nl)
329 347

  
330 348
  -- Run the standard (avg-mode) allocation
331 349

  

Also available in: Unified diff