On Thu, May 16, 2013 at 8:43 PM, Klaus Aehlig <[email protected]> wrote:

> Non-redundant instances need to be moved to a different node
> before maintenance of the node. Even though they can be moved to
> any node, there must be enough capacity to host the instances of the
> reboot group to be evacuated.
>
> This is achieved by greedily moving the non-redundant instances
> to other nodes, till we run out of capacity. In this way we
> refine the groups obtained by coloring the drbd-induced graph.
>
> Signed-off-by: Klaus Aehlig <[email protected]>
> ---
>  src/Ganeti/HTools/Program/Hroller.hs | 69
> ++++++++++++++++++++++++++++++++++--
>  1 file changed, 66 insertions(+), 3 deletions(-)
>
> diff --git a/src/Ganeti/HTools/Program/Hroller.hs
> b/src/Ganeti/HTools/Program/Hroller.hs
> index 88b3c34..f567ba5 100644
> --- a/src/Ganeti/HTools/Program/Hroller.hs
> +++ b/src/Ganeti/HTools/Program/Hroller.hs
> @@ -39,13 +39,16 @@ import qualified Data.IntMap as IntMap
>
>  import qualified Ganeti.HTools.Container as Container
>  import qualified Ganeti.HTools.Node as Node
> +import qualified Ganeti.HTools.Instance as Instance
>  import qualified Ganeti.HTools.Group as Group
>
> +import Ganeti.BasicTypes
>  import Ganeti.Common
>  import Ganeti.HTools.CLI
>  import Ganeti.HTools.ExtLoader
>  import Ganeti.HTools.Graph
>  import Ganeti.HTools.Loader
> +import Ganeti.HTools.Types
>  import Ganeti.Utils
>
>  -- | Options list and functions.
> @@ -74,6 +77,60 @@ options = do
>  arguments :: [ArgCompletion]
>  arguments = []
>
> +-- | Compute the result of moving an instance to a different node.
> +move :: Idx -> Ndx -> (Node.List, Instance.List)
> +        -> OpResult (Node.List, Instance.List)
> +move idx new_ndx (nl, il) = do
> +  let new_node = Container.find new_ndx nl
> +      inst = Container.find idx il
> +      old_ndx = Instance.pNode inst
> +      old_node = Container.find old_ndx nl
> +  new_node' <- Node.addPriEx True new_node inst
> +  let old_node' = Node.removePri old_node inst
> +      inst' = Instance.setPri inst new_ndx
> +      nl' = Container.addTwo old_ndx old_node' new_ndx new_node' nl
> +      il' = Container.add idx inst' il
> +  return (nl', il')
>

Are we just "picking" a new node for the instance? What if it doesn't fit?
We really need to use the hail code for this, I believe.
If that fails at least we can report it's impossible to move the instances
out.

Thanks,

Guido

Reply via email to