...
...
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.
...
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:
...
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; …} |
Following are the API additions and changes.
...