You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Bug Reference

 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.

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.

But currently, there is no way for a user to let CloudStack know how to place a certain VM in relationship to other already existing VMs in the account.

Following are some real life use cases that indicate the need of a mechanism to enable users specify inter-VM placement strategy.

Use Cases:

  • Deploying an n-Tier App:  When a user wants to deploy a n-Tier App, they might not want VMs in the same Tier to be either on the same host or even on the same POD.  This is one of the ways they can get even more high availability within a zone.
  • User who is deploying multiple VMs as part of an application deployment might have some application restrictions to have VMs running as close to each other as possible.
  • Web VMs in a Basic Zone: For users deploying multiple Web VMs in a Basic zone, they might want to ensure that all web VMs are on as far apart as possible for higher availability.

To address this problem, we will introduce the Affinity Groups feature.

The highlights of the feature include:

  • Admins will be able to expose available ‘affinity/anti-affinity types’ available in the cloud
  • Users can create affinity groups, each group having a certain affinity/anti-affinity type
  • Users associate affinity groups to VMs during deployment.
  • Cloudstack’s Deployment Planner takes into account the affinity groups of the VM and figures out a deployment destination
  • VM’s association with the affinity/anti-affinity groups will be referred while service offering upgrade, migration.
  • Ability to implement new affinity/anti-affinity types via plugin framework

Feature Specifications

The scope of this feature consists of following requirements:

  • Feature needs to be supported on Basic as well as Advanced zones
  • Users should be allowed to configure affinity/anti-affinity while creating or updating VMs
  • For each VM, users should be able to provide multiple affinity/anti-affinity groups.
  • User should be able to create affinity groups based on the available affinity/anti-affinity types
  • When configuring Affinity / anti-affinity for a VM, users should be allowed to provide a list of affinity / anti-affinity groups or select affinity /anti-affinity groups from a list (via UI)

Feature Assumptions

  • If the VM placement cannot happen as per the affinity/anti-affinity groups specified, deployment will fail and user should modify the affinity groups specified and re-initiate the deployment.
  • User can update/delete the affinity group associations of a VM only when the VM is in stopped state.

UI/UX Requirements

  • Affinity group tab that lists the groups created by this user
  • Ability to create a new Affinity group based on globally available affinity types
  • As part of VM creation/update wizards, users should be provided with the following:
    • Choice to associate affinity and/or anti-affinity groups
    • If chosen, users should be provided with a list of affinity groups available or define a new affinity group

Use cases

Admin

  • Admin decides what are the affinity/anti-affinity types available to the users.
  • This depends on which AffinityGroupProcessor plugins are included in the deployment.

User

  • User can list the affinity /anti-affinity types available using listAffinityTypes API
  • User creates affinity /anti-affinity group using a type available
  • During VM deployment, user can specify affinity/anti-affinity group Ids or names to be associated with the VM.
  • User can list the affinity /anti-affinity groups of a VM
  • User can delete/update the affinity /anti-affinity groups a VM is associated to.
  • User can delete the affinity /anti-affinity group only if there are no VM's associated with it.

Architecture and Design description

The high level functional breakdown of the feature is as follows:

  • 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.
  • Affinity Planner – a planner that takes into account the affinity groups of the VM during placement.

API changes

Following are the API additions and changes.

CreateAffinityGroup API

This is a new user API to create affinity groups for the account. Parameters include:
a)    AccountName
b)    DomainId
c)    Name
d)    Type (affinity/anti-affinity)
e)    Description

ListAffinityGroups API

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

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

a) zoneId

UI flow

  • either demonstrate it visually here or link to relevant mockups

Appendix

Appendix A:

Appendix B:

  • No labels