BtrPlace is a virtual machines placement algorithm for hosting platforms. You can specialize it safely through independant constraints to make it support what match your expectations.

BtrPlace in use

In a nutshell

Create a Model that represents the current state of the platform:

      Model model = source      
    

Express your expectations with constraints (here, through btrpsl): VM2 and VM3 must run on distinct nodes. 3 vCPU resources must allocated to VM1. N4 must be offline.

    spread(VM[2..3]);
    preserve(VM1, "cpu", 3);
    offline(@N4);

Use BtrPlace to compute a reconfiguration plan to reach a model satisfying your constraints:

    Set<SatConstraint> constraints = ...
    ReconfigurationAlgorithm cra = new DefaultChocoReconfigurationAlgorithm();
    ReconfigurationPlan plan = cra.solve(model, constraints);

And that's it ! Plan contains the schedule of actions to reach a new viable model according to the stated constraints and the actions semantic. The result will be:

      destination model = plan.getResultingModel();

The complete tutorial is available here. Don't forget BtrPlace is meant for being flexible. So document yourself, and develop your own constraints or optimization objectives.

Fork me on GitHub