Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • New API to list affinity types available.
  • New user APIs to create and list Affinity groups based on affinity types available.
  • Ability to associate affinity groups to VMs during deployment.
  • AffinityGroupProcessor adapter that defines the interface needed to implement an affinity type. This can be implemented by a plugin to add affinity/anti-affinity types to CloudStack.
  • A default HostAffinityProcessor plugin that implements this adapter and processes the host affinity rule.
  • A default HostAntiAffinityProcessor plugin that implements this adapter and processes the host anti-affinity rule.
  • DeploymentPlanningManager - a manager which contains planning for volume, vm, and network.
  • For VM deployment, this manager will be invoked by VirtualMachineManager to handle the following:
    • Process Affinity/Anti-affinity - Call the chain of AffinityGroupProcessor adapters to set deploymentplan scope and exclude list
    • Call DeploymentPlanner - to use heuristics to find the best spot to place the vm/volume. Planner will drill down to the write set of clusters to look for placement based on various heuristics.
    • Call Allocators - Given a cluster, allocators matches the requirements to capabilities of the physical resource (host, storage pool).

AffinityGroupProcessor Adapter

...

Code Block
public interface AffinityGroupProcessor extends Adapter {

    /**
     * process() is called to apply the affinity/anti-affinity rules to the deployment plan and avoid set for ththe given VM placement.
     * @param vm    virtual machine.
     * @param plan  deployment plan that tells you where it's being deployed to.
     * @param avoid avoid these data centers, pods, clusters, or hosts.
     */
    void process(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan, ExcludeList avoid) throws AffinityConflictException;

    /**
     * getType() should return the affinity/anti-affinity group being implemented
     * @return String Affinity/Anti-affinity type
     */
    String getType();
}

...

For the given VM, it will list the other VMs associated to its affinity group and set the hostIds of these VM’s in the ExcludeList, so that the planner will not place this VM on these hosts.

AffinityGroupPlanner (DeploymentPlanner)

...

DeploymentPlanningManager

During VM deployment, deployment planners are invoked currently and they apply the algorithms Admins have set to provide better performance/value. But now  we need to first consider the user preferences of the VM placement defined using affinity groups and set the correct scope for searching the deployment  destination. Then this scope can be passed along to the deployment planners to process.

Thus there is a need of some layer above the deployment planners to orchestrate these deployment stages:

  1. Process Affinity/Anti-affinity - Call the chain of AffinityGroupProcessor adapters to set deploymentplan scope and exclude list
  2. Call DeploymentPlanner - to use heuristics to find the best spot to place the vm/volume. Planner will drill down to the write set of clusters to look for placement based on various heuristics.
  3. Call Allocators - Given a cluster, allocators matches the requirements to capabilities of the physical resource (host, storage pool)

...

  1. .
Code Block
public interface DeploymentPlannerDeploymentPlanningManager extends AdapterManager {

       /**
     * Manages vm deployment stages:
     * plan is called to determine where a virtual machine should be running.
     * @param vm virtual machine.
     * @param plan  deployment plan that tells you where it's being deployed to.
     * @param avoid avoid these data centers, pods, clusters, or hosts.
     * @return DeployDestination for that virtual machine.
     */
    DeployDestination plan    First Process Affinity/Anti-affinity - Call the chain of AffinityGroupProcessor adapters to set deploymentplan scope and exclude list
     *    Secondly, Call DeploymentPlanner - to use heuristics to find the best spot to place the vm/volume. Planner will drill down to the write set of clusters to look for placement based on various heuristics.
     *    Lastly, Call Allocators - Given a cluster, allocators matches the requirements to capabilities of the physical resource (host, storage pool).
     *        
     */
    DeployDestination planDeployment(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan, ExcludeList avoid) throws InsufficientServerCapacityException, AffinityConflictException;
}

API changes

Following are the API additions and changes.

...