-- | Computes the secondary node UUID for a DRBD disk
computeDiskSecondaryNode :: Disk -> String -> Maybe String
computeDiskSecondaryNode dsk primary =
  case diskLogicalId dsk of
    Just (LIDDrbd8 a b _ _ _ _) -> Just $ if primary == a then b else a
    _ -> Nothing

-- | Get instances of a given node.
-- The node is specified through its UUID.
-- The secondary calculation is expensive and frequently called, so optimise
-- this to allocate fewer temporary values
computeDiskSecondaryNode :: Disk -> String -> Maybe String
computeDiskSecondaryNode dsk primary =
  case diskLogicalId dsk of
    Just (LIDDrbd8 a b _ _ _ _) -> Just $ if primary == a then b else a
    _ -> Nothing

-- | Get instances of a given node.
-- The node is specified through its UUID.
-- The secondary calculation is expensive and frequently called, so optimise
-- this to allocate fewer temporary values
computeDiskSecondaryNode dsk primary =
  case diskLogicalId dsk of
    Just (LIDDrbd8 a b _ _ _ _) -> Just $ if primary == a then b else a
    _ -> Nothing

-- | Get instances of a given node.
-- The node is specified through its UUID.
-- The secondary calculation is expensive and frequently called, so optimise
-- this to allocate fewer temporary values