-- | Retrieves all the nodes of the instance.
--
-- As instances not using DRBD can be sent as a parameter as well,
-- the primary node has to be appended to the results.
getInstAllNodes :: ConfigData -> String -> ErrorResult [Node]
getInstAllNodes cfg name = do
  inst <- getInstanceByName cfg name
  inst_disks <- getInstDisksFromObj cfg inst
  let disk_nodes = concatMap (getDrbdDiskNodes cfg) inst_disks
  pNode <- getInstPrimaryNode cfg name
  return . nub $ pNode:disk_nodes

-- | Get disks for a given instance.
-- The instance is specified by name or uuid.
getInstAllNodes :: ConfigData -> String -> ErrorResult [Node]
getInstAllNodes cfg name = do
  inst <- getInstanceByName cfg name
  inst_disks <- getInstDisksFromObj cfg inst
  let disk_nodes = concatMap (getDrbdDiskNodes cfg) inst_disks
  pNode <- getInstPrimaryNode cfg name
  return . nub $ pNode:disk_nodes

-- | Get disks for a given instance.
-- The instance is specified by name or uuid.
getInstAllNodes cfg name = do
  inst <- getInstanceByName cfg name
  inst_disks <- getInstDisksFromObj cfg inst
  let disk_nodes = concatMap (getDrbdDiskNodes cfg) inst_disks
  pNode <- getInstPrimaryNode cfg name
  return . nub $ pNode:disk_nodes

-- | Get disks for a given instance.
-- The instance is specified by name or uuid.