Versions Compared

Key

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

Bug Reference

The Jira issue associated with this design spec https://issues.apache.org/jira/browse/CLOUDSTACK-739

Branch

What branch is this work being done inA new branch will be created off master soon for this work. Will update the branch details once started on it.

Introduction

Purpose

State the purpose of the document; something like: this is functional specificationS of feature "..." which has Jira ID CS-xyzw
References

relevant links

Document History
Glossary
Feature Specifications

put a summary or a brief description of the feature in question
list what is deliberately not supported or what the feature will not offer - to clear any prospective ambiguities
list all open items or unresolved issues the developer is unable to decide about without further discussion
quality risks (test guidelines)
functional
non functional: performance, scalability, stability, overload scenarios, etc
corner cases and boundary conditions
negative usage scenarios
specify supportability characteristics:
what new logging (or at least the important one) is introduced
how to debug and troubleshoot
what are the audit events
list JMX interfaces
graceful failure and recovery scenarios
possible fallback or work around route if feature does not work as expected, if those workarounds do exist ofcourse.
if feature depends other run-time environment related requirements, provide sanity check list for support people to run
explain configuration characteristics:
configuration parameters or files introduced/changed
branding parameters or files introduced/changed
highlight parameters for performance tweaking
highlight how installation/upgrade scenarios change
deployment requirements (fresh install vs. upgrade) if any
system requirements: memory, CPU, desk space, etc
interoperability and compatibility requirements:
OS
xenserver, hypervisros
storage, networks, other
list localization and internationalization specifications
explain the impact and possible upgrade/migration solution introduced by the feature
explain performance & scalability implications when feature is used from small scale to large scale
explain security specifications
list your evaluation of possible security attacks against the feature and the answers in your design* *
explain marketing specifications
explain levels or types of users communities of this feature (e.g. admin, user, etc)

Use cases

put the relevant use case/stories to explain how the feature is going to be used/work
Architecture and Design description

discussion of alternatives amongst design ideas, their resources/time tradeoffs and limitations. Explain why a certain design idea is chosen over others
highlight architectural patterns being used (queues, async/sync, state machines, etc)
talk about main algorithms used
explain what components are being changed and what the dependent components are
regarding database: talk about tables being added/modified
performance implications: what are the improvements or risks introduced to capacity, response time, resources usage and other relevant KPIs
preferably show class diagrams, sequence diagrams and state diagrams
if possible, publish signatures of all methods classes and interfaces implement, and the explain the object information of different classes

Web Services APIs

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) zoneIdlist changes to existing web services APIs and new APIs introduced with signatures and throughout documentation

UI flow

  • either demonstrate it visually here or link to relevant mockups

Appendix

Appendix A:

Appendix B: