Revision 9cd6c325 htools/Ganeti/HTools/Instance.hs
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 |
-- |
Also available in: Unified diff