Revision 9cd6c325
b/htools/Ganeti/HTools/Instance.hs | ||
---|---|---|
33 | 33 |
, create |
34 | 34 |
, instanceRunning |
35 | 35 |
, instanceOffline |
36 |
, instanceNotOffline |
|
36 | 37 |
, instanceDown |
37 | 38 |
, applyIfOnline |
38 | 39 |
, setIdx |
... | ... | |
97 | 98 |
instanceOffline (Instance {runSt = T.AdminOffline}) = True |
98 | 99 |
instanceOffline _ = False |
99 | 100 |
|
101 |
|
|
102 |
-- | Helper to check if the instance is not offline. |
|
103 |
instanceNotOffline :: Instance -> Bool |
|
104 |
instanceNotOffline = not . instanceOffline |
|
105 |
|
|
100 | 106 |
-- | Check if instance is down. |
101 | 107 |
instanceDown :: Instance -> Bool |
102 | 108 |
instanceDown inst | instanceRunning inst = False |
... | ... | |
106 | 112 |
-- | Apply the function if the instance is online. Otherwise use |
107 | 113 |
-- the initial value |
108 | 114 |
applyIfOnline :: Instance -> (a -> a) -> a -> a |
109 |
applyIfOnline = applyIf . not . instanceOffline
|
|
115 |
applyIfOnline = applyIf . instanceNotOffline
|
|
110 | 116 |
|
111 | 117 |
-- | Constant holding the local storage templates. |
112 | 118 |
-- |
b/htools/Ganeti/HTools/Loader.hs | ||
---|---|---|
341 | 341 |
nodeImem node il = |
342 | 342 |
let rfind = flip Container.find il |
343 | 343 |
il' = map rfind $ Node.pList node |
344 |
oil' = filter (not . Instance.instanceOffline) il'
|
|
344 |
oil' = filter Instance.instanceNotOffline il'
|
|
345 | 345 |
in sum . map Instance.mem $ oil' |
346 | 346 |
|
347 | 347 |
|
Also available in: Unified diff