addInstNameToOneLv :: [Instance] -> LVInfo -> LVInfo
addInstNameToOneLv instances lvInfo =
  let vg_name = lviVgName lvInfo
      lv_name = lviName lvInfo
      instanceHasDisk = any (includesLogicalId vg_name lv_name) . instDisks
      rightInstance = find instanceHasDisk instances
    in 
      case rightInstance of
        Nothing -> lvInfo
        Just i -> lvInfo { lviInstance = Just $ instName i }

-- | Adds the name of the instance to the information about logical volumes.
addInstNameToOneLv :: [Instance] -> LVInfo -> LVInfo
addInstNameToOneLv instances lvInfo =
  let vg_name = lviVgName lvInfo
      lv_name = lviName lvInfo
      instanceHasDisk = any (includesLogicalId vg_name lv_name) . instDisks
      rightInstance = find instanceHasDisk instances
    in 
      case rightInstance of
        Nothing -> lvInfo
        Just i -> lvInfo { lviInstance = Just $ instName i }

-- | Adds the name of the instance to the information about logical volumes.
addInstNameToOneLv instances lvInfo =
  let vg_name = lviVgName lvInfo
      lv_name = lviName lvInfo
      instanceHasDisk = any (includesLogicalId vg_name lv_name) . instDisks
      rightInstance = find instanceHasDisk instances
    in 
      case rightInstance of
        Nothing -> lvInfo
        Just i -> lvInfo { lviInstance = Just $ instName i }

-- | Adds the name of the instance to the information about logical volumes.