Bug Reference

CLOUDSTACK-241

Branch

regions

https://git-wip-us.apache.org/repos/asf?p=incubator-cloudstack.git;a=shortlog;h=refs/heads/regions

Introduction

Purpose

The objective of this feature is to add AWS EC2 like Regions implementation into CloudStack.  Regions are dispersed and located in separate geographic areas. Availability Zones(or Zones in CloudStack) are distinct locations within a Region that are engineered to be isolated from failures in other Zones and provide inexpensive, low latency network connectivity to other Zones in the same Region

Regions would provide the following benefits:

References

Requirements Doc: Regions requirements

Feature Specifications

Introduce the notion of Regions, which will be managed independently by a separate management servers.  With Regions, infrastructure will be organized as follows:

Region -> Zone -> Pod -> Cluster

 Accounts

 User Accounts will be available across Regions. User should be able to use the same account in all Regions. Switching between Regions should not require the user to sign-in again

Templates

 CS Templates are currently zone specific. Templates should be available to all zones within a region. User should be able to migrate templates from one Region to another. This requires S3 like object store

Snapshots

Snapshots also should be available to all zones within a Region. CS currently stores snapshots in secondary storage. Snapshots should instead be stored in the object-store

S3 like Object-store/Integration

Current secondary storage is at zone level. S3 like is object-store or integration with other object-stores(like Hadoop) is required to move data across Regions. Each Region should have object store and the data within it should be available to all zones within the region. Utility to move data across Regions should be supported. Templates and Snapshots will be stored in this object store. Requirements for  S3 based secondary storage.  This is tracked in ticket CLOUDSTACK-714 separately

ELB

ELB will be elevated to Region level. Jira ticket CLOUDSTACK-653

EIP

EIP enhancements CLOUDSTACK-652

Authentication Service

 An authentication service will available for components like object-store to authenticate and get account information using getUser API

Assumptions

Object Store: This feature assumes that S3 like object store is available. Either implemented in CloudStack or through integration.

Templates, Snapshots, EIP and ELP work is not part of this spec. There are being tracked separately as per JIRA tickets mentioned above.

Account Provisioning: Typically account provisioning is external to CloudStack. Adding accounts in all regions and keeping the data in sync is not handled by CloudStack. Only events are generated when changes are made.

Usage

  1. Usage records will be generated by each Region separately. Portal layer above CS should combine usage across Regions into a consolidated invoice.

Use cases

(Using external provisioning system)

Similarly for users and domains.

Architecture and Design description

Database

Each Region will have a separate database. Below data will be common to all databases across Regions:

  1. Account
  2. User
  3. Domain

Remaining data is expected to be per-Region(including projects, global config, resource limits) and not shared across databases in other Regions. 

New Tables

Table

Columns

Description

region

id
name
end_point 

Integer - Unique Id of the Region. Number regions are expected to be small, hence using integer instead of long
Name of the Region. Should be unique.
Region end_point. e.g http://10.147.30.11:8080/client

 

 

 

Event framework

Events are published using the event framework.

Authentication

Once logged in User should be able to switch from one Region to another without providing credentials again

web services APIs

New APIs

addRegion

Registers a region into another region

Request Parameters:

  1. id: (int) Region Id 
  2. name: (String) Name of the Region
  3. endpoint: (String) Region end point. e.g. http://10.147.30.11:8080/client 

Response Parameters:

  1. id: Region Id 
  2. name: Name of the Region
  3. endpoint: Region end point

updateRegion

Updates region details

Request Parameters:

  1. id: (int)Region Id
  2. name: (String)Name of the Region
  3. endpoint: (String)Region end point. e.g. https://10.147.30.11:8080/client

Response Parameters:

  1. id: Region Id 
  2. name: Name of the Region
  3. endpoint: Region end point

removeRegion

Removes region from current region.

Request Parameters:

  1. id: (int)id of the Region to  be removed

Response Parameters:

  1. Boolean success

listRegions

list all Regions. Can be filtered by id or name

Request Parameters:

  1. id: list by Region Id
  2. name: (String)list by Region Name

Response Parameters (List):

  1. id: Region Id 
  2. name: Name of the Region
  3. endpoint: Region end point

getUser

Admin only API. Get user details by api_key. 

Request Parameters:

  1. userapikey: (String)Get user details by API key 

Changes to existing APIs

Limitations

1. Account/User/Domain data propogation/sync has to be handled outside cloudstack

2. Only events will be generated by cloudstack

Upgrade

During upgrade, flexibility will be provided to move existing zones into any Region.

Upgrade scenarios:

Scripts

Offline scripts will be provided to move data across regions to ease

UI flow

Sample Workflow

Single Region

If an environment has only 1 region, functionality will be same as the current CS installation.  Id of this region will be 1. All accounts/users/domains will have region_id as 1

Adding 2nd Region

1. Install a 2nd CS instance.

2. While installing database set region_id using -r option in cloud-setup-databases script.

cloud-setup-databases cloud:<dbpassword>@localhost --deploy-as=root:<password> -e <encryption_type> -m <management_server_key> -k <database_key-r <region_id>

3. Start mgmt server

4. Using addRegion API, add region 1 to region 2 and also region 2 to region 1.

5. copy account/user/domain tables from Region1 DB to Region2 DB:

6. Restart mgmt servers in region 2

Adding 3rd and subsequent Regions

1. Install CS in all new regions

2. While installing database set region_id using -r option in cloud-setup-databases script.

cloud-setup-databases cloud:<dbpassword>@localhost --deploy-as=root:<password> -e <encryption_type> -m <management_server_key> -k <database_key-r <region_id>

3. Start mgmt server

4. Using addRegion API, add existing regions to region n and also region n to all existing regions

5. copy account/user/domain tables from any existing Region DB to RegionN DB. 

6. Restart mgmt servers in region N

Remove Region

1. Remove region from all other regions using removeRegion API

Appendix

Appendix A:

Appendix B: