...
A new branch will be created off master soon for this work. Will update the branch details once started on it.
As part of cloud orchestration there is always a need for cloud admins and users to be able to judiciously place the VMs to ensure better availability of their service. Cloudstack API ‘deployVirtualMachine’ lets you specify the compute/disk tags to choose a specific compute host/storage during VM placement.
...
The scope of this feature consists of following requirements:
...
Admin
...
The high level functional breakdown of the feature is as follows:
This is a new adapter interface that any plugin implementation of some affinity/anti-affinity group should follow.
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 th 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.
* @return DeployDestination for that virtual machine.
*/
void process(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan, ExcludeList avoid);
/**
* getType() should return the affinity/anti-affinity group being implemented
* @return String Affinity/Anti-affinity type
*/
String getType();
}
|
We will provide default implementation of the host affinity rule. This processor will implement the AffinityGroupProcessor adapter.
For the given VM, it will list the other VMs associated to its affinity group and set the same hostId in the DeploymentPlan for placement by the planner.
We will provide default implementation of the host anti-affinity rule. This processor will implement the AffinityGroupProcessor adapter.
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.
Code Block |
---|
public interface DeploymentPlanner extends Adapter {
/**
* 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(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan, ExcludeList avoid) throws InsufficientServerCapacityException;
…}
|
Following are the API additions and changes.
...
UpdateVMAffinityGroup API
This is a new user API to update the affinity groups assocaited with the VM. Parameters include:
a) List of Affinity group Ids OR
b) List of Affinity group Name
c) VM Id
...