Revision d6eec019 htools/Ganeti/HTools/Node.hs
b/htools/Ganeti/HTools/Node.hs | ||
---|---|---|
6 | 6 |
|
7 | 7 |
{- |
8 | 8 |
|
9 |
Copyright (C) 2009, 2010, 2011 Google Inc. |
|
9 |
Copyright (C) 2009, 2010, 2011, 2012 Google Inc.
|
|
10 | 10 |
|
11 | 11 |
This program is free software; you can redistribute it and/or modify |
12 | 12 |
it under the terms of the GNU General Public License as published by |
... | ... | |
41 | 41 |
, setSec |
42 | 42 |
, setMdsk |
43 | 43 |
, setMcpu |
44 |
, setPolicy |
|
44 | 45 |
-- * Tag maps |
45 | 46 |
, addTags |
46 | 47 |
, delTags |
... | ... | |
124 | 125 |
, utilLoad :: T.DynUtil -- ^ Sum of instance utilisation |
125 | 126 |
, pTags :: TagMap -- ^ Map of primary instance tags and their count |
126 | 127 |
, group :: T.Gdx -- ^ The node's group (index) |
128 |
, iPolicy :: T.IPolicy -- ^ The instance policy (of the node's group) |
|
127 | 129 |
} deriving (Show, Read, Eq) |
128 | 130 |
|
129 | 131 |
instance T.Element Node where |
... | ... | |
219 | 221 |
, utilLoad = T.zeroUtil |
220 | 222 |
, pTags = Map.empty |
221 | 223 |
, group = group_init |
224 |
, iPolicy = T.defIPolicy |
|
222 | 225 |
} |
223 | 226 |
|
224 | 227 |
-- | Conversion formula from mDsk\/tDsk to loDsk. |
... | ... | |
257 | 260 |
setMcpu :: Node -> Double -> Node |
258 | 261 |
setMcpu t val = t { mCpu = val, hiCpu = mCpuTohiCpu val (tCpu t) } |
259 | 262 |
|
263 |
-- | Sets the policy. |
|
264 |
setPolicy :: T.IPolicy -> Node -> Node |
|
265 |
setPolicy pol node = node { iPolicy = pol } |
|
266 |
|
|
260 | 267 |
-- | Computes the maximum reserved memory for peers from a peer map. |
261 | 268 |
computeMaxRes :: P.PeerMap -> P.Elem |
262 | 269 |
computeMaxRes = P.maxElem |
Also available in: Unified diff