Revision 1a0dacf6 src/Ganeti/DataCollectors/Lv.hs
b/src/Ganeti/DataCollectors/Lv.hs | ||
---|---|---|
39 | 39 |
import qualified Control.Exception as E |
40 | 40 |
import Control.Monad |
41 | 41 |
import Data.Attoparsec.Text.Lazy as A |
42 |
import Data.List |
|
42 |
--import Data.List
|
|
43 | 43 |
import Data.Text.Lazy (pack, unpack) |
44 | 44 |
import Network.BSD (getHostName) |
45 | 45 |
import System.Process |
... | ... | |
145 | 145 |
exitIfBad "Unable to obtain the list of instances" instances |
146 | 146 |
|
147 | 147 |
-- | Adds the name of the instance to the information about one logical volume. |
148 |
addInstNameToOneLv :: [Instance] -> LVInfo -> LVInfo |
|
149 |
addInstNameToOneLv instances lvInfo = |
|
150 |
let vg_name = lviVgName lvInfo |
|
151 |
lv_name = lviName lvInfo |
|
152 |
instanceHasDisk = any (includesLogicalId vg_name lv_name) . instDisks |
|
153 |
rightInstance = find instanceHasDisk instances |
|
154 |
in
|
|
155 |
case rightInstance of |
|
156 |
Nothing -> lvInfo |
|
157 |
Just i -> lvInfo { lviInstance = Just $ instName i } |
|
148 |
--addInstNameToOneLv :: [Instance] -> LVInfo -> LVInfo
|
|
149 |
--addInstNameToOneLv instances lvInfo =
|
|
150 |
-- let vg_name = lviVgName lvInfo
|
|
151 |
-- lv_name = lviName lvInfo
|
|
152 |
-- instanceHasDisk = any (includesLogicalId vg_name lv_name) . instDisks
|
|
153 |
-- rightInstance = find instanceHasDisk instances
|
|
154 |
-- in
|
|
155 |
-- case rightInstance of
|
|
156 |
-- Nothing -> lvInfo
|
|
157 |
-- Just i -> lvInfo { lviInstance = Just $ instName i }
|
|
158 | 158 |
|
159 | 159 |
-- | Adds the name of the instance to the information about logical volumes. |
160 | 160 |
addInstNameToLv :: [Instance] -> [LVInfo] -> [LVInfo] |
161 |
addInstNameToLv instances = map (addInstNameToOneLv instances)
|
|
161 |
addInstNameToLv _instances = id -- map (addInstNameToOneLv instances)
|
|
162 | 162 |
|
163 | 163 |
-- | This function computes the JSON representation of the LV status. |
164 | 164 |
buildJsonReport :: Options -> IO J.JSValue |
Also available in: Unified diff