Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

 https://issues.apache.org/jira/browse/CLOUDSTACK-739

Branch

A new branch will be created off master soon for this work. Will update the branch details once started on it.Work is in progress on the affinity_groups branch

Introduction

Purpose

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.

...

Code Block
public interface DeploymentPlanningManager extends Manager {

       /**
         * Manages vm deployment stages:
         *       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;
}

...

This is a new user API to list affinity groups.Parameters include:
a)    Affinity group Id
b)    Affinity group Name
c)    VM Id
d)    AccountName and DomainId

DeleteAffinityGroup API

This is a new user API to delete affinity groups. Parameters include:
a)    Affinity group Id
b)    Affinity group Name
c)    VM Id
d)    AccountName and DomainId

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

DeployVirtualMachine API

User can set a list of affinity group Ids OR names during a VM deployment. Additional parameters:
a)    affinitygroupids
b)    affinitygroupnames

ListAffinityGroupTypes API

It does return the details of the affinity group and also the VM Ids that are part of this group.

Code Block

{ "listaffinitygroupsresponse" : { "count":1 ,"affinitygroup" : [
{"id":"538d0918-2605-42ff-b4ef-2f1e95ac77b1","name":"db","account":"admin","domainid":"24fd1d41-a2fa-11e2-af0a-90004e86b601","domain":"ROOT","virtualmachineIds":["ac5e0006-0d1a-4334-82cf-9a06732c56c0","126318c6-0fcc-4eb7-89ae-0f4790c4145a"]}
] } }

} }
DeleteAffinityGroup API

This is a new user API to delete affinity groups. Parameters include:
a)    Affinity group Id
b)    Affinity group Name
c)    AccountName and DomainId

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

DeployVirtualMachine API

User can set a list of affinity group Ids OR names during a VM deployment. Additional parameters:
a)    affinitygroupids
b)    affinitygroupnames

ListAffinityGroupTypes API

Lists the affinity/ anti-affinity types available in the deployment.

ListVirtualMachines API

The response of this command will include the affinity_groups associated to the VM.

Code Block

{ "listvirtualmachinesresponse" : { "count":1 ,"virtualmachine" : [  {"id":"2e3e0afd-4b32-428c-835d-72a0cce8cbc1","name":"2e3e0afd-4b32-428c-835d-72a0cce8cbc1","account":"admin","domainid":"6a04ecc4-9bed-11e2-bff6-7010fdc4e018","domain":"ROOT","created":"2013-04-03T14:44:02-0700","state":"Destroyed","haenable":false,"zoneid":"d8ac0a8a-fb57-43c7-8014-3a1f697e68fb","zonename":"lab","templateid":"677cd3ca-9bed-11e2-bff6-7010fdc4e018","templatename":"CentOS 5.6(64-bit) no GUI (XenServer)","templatedisplaytext":"CentOS 5.6(64-bit) no GUI (XenServer)","passwordenabled":false,"serviceofferingid":"adf0cd87-c863-4b79-afda-41f0ee549afa","serviceofferingname":"Medium Instance","cpunumber":1,"cpuspeed":1000,"memory":1024,"guestosid":"67803a82-9bed-11e2-bff6-7010fdc4e018","rootdeviceid":0,"rootdevicetype":"ROOT","securitygroup":[],"nic":[
{"id":"0852d991-0cc5-4397-abe2-9f6bc7fdb8e3","networkid":"3360145c-46a0-44fb-8fca-1cc6e1969c47","networkname":"n1","netmask":"255.255.255.0","gateway":"10.1.1.1","ipaddress":"10.1.1.249","traffictype":"Guest","type":"Isolated","isdefault":true,"macaddress":"02:00:70:b5:00:07"}

],"hypervisor":"XenServer","instancename":"i-2-11-VM","tags":[],*"affinitygroup":[
{"id":"96e30154-ef42-4bc8-a7d4-601e9426fb79","name":"webvms","account":"admin"}

]*,"jobstatus":0} ] } }}

Also affinitygroupid parameter is added to listVirtualMachines API to list VMs by affinity groupLists the affinity/ anti-affinity types available in the deployment.

DB Changes

As part of this feature following new tables have been added to the cloud schema:

...