Revision 96f9b0a6 src/Ganeti/HTools/Node.hs
b/src/Ganeti/HTools/Node.hs | ||
---|---|---|
111 | 111 |
, fDsk :: Int -- ^ Free disk space (MiB) |
112 | 112 |
, tCpu :: Double -- ^ Total CPU count |
113 | 113 |
, uCpu :: Int -- ^ Used VCPU count |
114 |
, spindleCount :: Int -- ^ Node spindles (spindle_count node parameter) |
|
114 |
, tSpindles :: Int -- ^ Node spindles (spindle_count node parameter, |
|
115 |
-- or actual spindles, see note below) |
|
116 |
, fSpindles :: Int -- ^ Free spindles (see note below) |
|
115 | 117 |
, pList :: [T.Idx] -- ^ List of primary instance indices |
116 | 118 |
, sList :: [T.Idx] -- ^ List of secondary instance indices |
117 | 119 |
, idx :: T.Ndx -- ^ Internal index for book-keeping |
... | ... | |
128 | 130 |
-- threshold |
129 | 131 |
, hiCpu :: Int -- ^ Autocomputed from mCpu high cpu |
130 | 132 |
-- threshold |
131 |
, hiSpindles :: Double -- ^ Auto-computed from policy spindle_ratio
|
|
132 |
-- and the node spindle count |
|
133 |
, instSpindles :: Double -- ^ Spindles used by instances |
|
133 |
, hiSpindles :: Double -- ^ Limit auto-computed from policy spindle_ratio
|
|
134 |
-- and the node spindle count (see note below)
|
|
135 |
, instSpindles :: Double -- ^ Spindles used by instances (see note below)
|
|
134 | 136 |
, offline :: Bool -- ^ Whether the node should not be used for |
135 | 137 |
-- allocations and skipped from score |
136 | 138 |
-- computations |
... | ... | |
143 | 145 |
, iPolicy :: T.IPolicy -- ^ The instance policy (of the node's group) |
144 | 146 |
, exclStorage :: Bool -- ^ Effective value of exclusive_storage |
145 | 147 |
} deriving (Show, Eq) |
148 |
{- A note on how we handle spindles |
|
149 |
|
|
150 |
With exclusive storage spindles is a resource, so we track the number of |
|
151 |
spindles still available (fSpindles). This is the only reliable way, as some |
|
152 |
spindles could be used outside of Ganeti. When exclusive storage is off, |
|
153 |
spindles are a way to represent disk I/O pressure, and hence we track the amount |
|
154 |
used by the instances. We compare it against 'hiSpindles', computed from the |
|
155 |
instance policy, to avoid policy violations. In both cases we store the total |
|
156 |
spindles in 'tSpindles'. |
|
157 |
-} |
|
146 | 158 |
|
147 | 159 |
instance T.Element Node where |
148 | 160 |
nameOf = name |
... | ... | |
217 | 229 |
-- The index and the peers maps are empty, and will be need to be |
218 | 230 |
-- update later via the 'setIdx' and 'buildPeers' functions. |
219 | 231 |
create :: String -> Double -> Int -> Int -> Double |
220 |
-> Int -> Double -> Bool -> Int -> T.Gdx -> Bool -> Node |
|
232 |
-> Int -> Double -> Bool -> Int -> Int -> T.Gdx -> Bool -> Node
|
|
221 | 233 |
create name_init mem_t_init mem_n_init mem_f_init |
222 |
dsk_t_init dsk_f_init cpu_t_init offline_init spindles_init |
|
223 |
group_init excl_stor = |
|
234 |
dsk_t_init dsk_f_init cpu_t_init offline_init spindles_t_init
|
|
235 |
spindles_f_init group_init excl_stor =
|
|
224 | 236 |
Node { name = name_init |
225 | 237 |
, alias = name_init |
226 | 238 |
, tMem = mem_t_init |
... | ... | |
229 | 241 |
, tDsk = dsk_t_init |
230 | 242 |
, fDsk = dsk_f_init |
231 | 243 |
, tCpu = cpu_t_init |
232 |
, spindleCount = spindles_init |
|
244 |
, tSpindles = spindles_t_init |
|
245 |
, fSpindles = spindles_f_init |
|
233 | 246 |
, uCpu = 0 |
234 | 247 |
, pList = [] |
235 | 248 |
, sList = [] |
... | ... | |
249 | 262 |
, loDsk = mDskToloDsk T.defReservedDiskRatio dsk_t_init |
250 | 263 |
, hiCpu = mCpuTohiCpu (T.iPolicyVcpuRatio T.defIPolicy) cpu_t_init |
251 | 264 |
, hiSpindles = computeHiSpindles (T.iPolicySpindleRatio T.defIPolicy) |
252 |
spindles_init |
|
265 |
spindles_t_init
|
|
253 | 266 |
, instSpindles = 0 |
254 | 267 |
, utilPool = T.baseUtil |
255 | 268 |
, utilLoad = T.zeroUtil |
... | ... | |
316 | 329 |
node { iPolicy = pol |
317 | 330 |
, hiCpu = mCpuTohiCpu (T.iPolicyVcpuRatio pol) (tCpu node) |
318 | 331 |
, hiSpindles = computeHiSpindles (T.iPolicySpindleRatio pol) |
319 |
(spindleCount node)
|
|
332 |
(tSpindles node)
|
|
320 | 333 |
} |
321 | 334 |
|
322 | 335 |
-- | Computes the maximum reserved memory for peers from a peer map. |
... | ... | |
665 | 678 |
"ptags" -> intercalate "," . map (uncurry (printf "%s=%d")) . |
666 | 679 |
Map.toList $ pTags t |
667 | 680 |
"peermap" -> show $ peers t |
668 |
"spindle_count" -> show $ spindleCount t
|
|
681 |
"spindle_count" -> show $ tSpindles t
|
|
669 | 682 |
"hi_spindles" -> show $ hiSpindles t |
670 | 683 |
"inst_spindles" -> show $ instSpindles t |
671 | 684 |
_ -> T.unknownField |
Also available in: Unified diff