Trove/trove-versions-types

Overview
Datastore types management will allow users of Trove to select database type and version on db engine from the list provided by operator. Operator will have possibility to control datastore types, add new and deactivate old versions.

To implement this capability users can specify datastore type and optional version of engine on instance create.

Datastore Type is a family of database engines, like mysql, mongodb, cassandra.

Datastore Version defines engine version of selected datastore type and contains list of system packages which provides this datastore.

Each datastore type has several versions of engine.

Type can have default version for type.

Versions can be marked as active or inactive Active versions available for user and can be used for create db instance User dont see inactive versions and cannot create new instance with inactive version. But inactive version can be used in already running instances.

For each datastore type operator can specify OS image on which instance will works.

For each version of each type operator can specify different image, which will have more precedence then image for type.

Thus we have flexible selection of image, type of db, and version.

For each version should be specified list of system packages which provides installation of db with specified version on specified image.

Possible to specify only one package here, but in some cases need to specify several packages with exactly version.

For mysql you can specify server, client, shared and shared-compat packages. It matters if you have more then one version available in your repos. For example, if you specify only "mysql-server-5.5" package, and you have mariadb and percona repos enabled, you can got mysql-server-5.5, mariadb-shared-5.5, percona-client-55 installed on your image.

Possible to use vanilla images (sure, with prepared GA and package repositories) and preinstalled.

To get trove avoid package installation, on image should be installed all packages specified in list in version.

Management Resources
Two new resources, datastore_type and datastore_version will be exposed as part of Trove.

datastore_type resource will allow operator to define new datastore type, datastore_type contains the following data:

id - A system-defined UUID assigned to the datastore type when it is created for the first time.

name - Name of the datastore type

engine - Name of manager class which provides implementation

image_id - UUID of image which will be used for instance provisioning

default_version - version which will used if user doesnt specified version on instance create

User can see only id and name of datastore type.

datastore_version resource allow operator to define versions of specified database type, contains following data:

id - A system-defined UUID assigned to the datastore type version when it is created for the first time.

name - Name of the datastore type version

datastore_type - datastore type which this version belongs to

image_id - UUID of image which will be used for instance provisioning (overloads image_id from datastore_type)

packages - space separated list of system packages provides this version of datastore

active - bool (1|0) - defines this version is active or not

User can see only id and name, also user can see and use only active versions

To implement this capability operator should define datastore types and available versions in db.

trove-manage will have following commands:

update_datastore_type name engine image_id - update datastore type with specified name

If datastore type with this name not exists - it will be created

This command returns UUID or name of created/updated datastore type.

update_datastore_version datastore_type name image_id packages active - update version with specified name

If version with this name not exists - it will be created

This command returns UUID or name of created/updated datastore type version.

API details
User can list datastore types and available versions

Datastore types list (New call)
Request

GET /{tenant_id}/datastores

Response {   "id": "73144fc8-f2c5-4490-a2d7-76604c4528dd", "links": [ ...   ],     "name": "MongoDB" } {   "id": "e60153d4-8ac4-414a-ad58-fe2e0035704a", "links": [ ...   ],     "name": "Mysql" }

Show datastore type (New call)
Request

GET /{tenant_id}/datastores/e60153d4-8ac4-414a-ad58-fe2e0035704a

Response {   "id": "e60153d4-8ac4-414a-ad58-fe2e0035704a", "links": [ ...   ],     "name": "Mysql" }

Datastore type versions list (New call)
Request

GET /{tenant_id}/datastores/e60153d4-8ac4-414a-ad58-fe2e0035704a/versions

Response {   "id": "7d109ae8-d38f-41c8-86e4-a8e613f81be5", "links": [ ...   ],     "name": "ubuntu percona-5.5.33" } {   "id": "8ae342fb-19ac-4882-8978-fe1afb38c7c7", "links": [ ...   ],     "name": "fedora oracle-5.1.71" } {   "id": "94ed1f9f-6c1a-4d6e-87e9-04ecff37b64b", "links": [ ...   ],     "name": "ubuntu maria-10.0.4" }

Show version (New call)
Request

GET /{tenant_id}/datastores/versions/7d109ae8-d38f-41c8-86e4-a8e613f81be5

Response {   "id": "7d109ae8-d38f-41c8-86e4-a8e613f81be5", "links": [ ...   ],     "name": "ubuntu percona-5.5.33" }

Create instance
To specify datastore type and version you can add datastore and datastore_version parameters to body.

To dont break the existing 1.0 contract datastore_type is optional in body. In case if datastore is not specified, will used default (specified in trove.conf)

Create instance with specified datastore type and version (Existing call)
Request

POST /instances { "instance" : { "flavorRef" : "2", "name" : "as", "datastore": { "type" : "e60153d4-8ac4-414a-ad58-fe2e0035704a", "version" : "94ed1f9f-6c1a-4d6e-87e9-04ecff37b64b" },     "volume" : { "size" : "1" } } } Response {   "created": "2013-10-09T10:56:56", "flavor": { "id": "2", "links": [ ...       ]    },     "id": "86bb7492-d797-4562-b864-851c8fad7216", "links": [ ...   ],     "name": "as", "datastore": { "type": "Mysql", "version": "ubuntu maria-10.0.4" },    "status": "BUILD", "updated": "2013-10-09T10:56:56", "volume": { "size": 1 } }

List instances (Existing call)
Request

GET /instances

Response {   "flavor": { "id": "2", "links": [ ...       ]    },     "id": "b1f0dff8-6303-4711-9d23-e899abc5d24d", "links": [ ...   ],     "name": "as_2", "datastore": { "type": "Mysql" },   "status": "ACTIVE", "volume": { "size": 1 } } {   "flavor": { "id": "2", "links": [ ...       ]    },     "id": "be1f10ae-afa9-4f75-808d-f7782784f363", "links": [ ...   ],     "name": "as_2", "datastore": { "type": "Mysql" },   "status": "ACTIVE", "volume": { "size": 1 } }

Get instance (Existing call)
Request

GET /instances/be1f10ae-afa9-4f75-808d-f7782784f363

Response {   "created": "2013-10-08T09:05:45", "flavor": { "id": "2", "links": [ ...       ]    },     "id": "be1f10ae-afa9-4f75-808d-f7782784f363", "links": [ ...   ],     "name": "as_2", "datastore": { "type": "Mysql", "version": "ubuntu maria-10.0.4" },   "status": "ACTIVE", "updated": "2013-10-08T09:05:52", "volume": { "size": 1 } }

You can use names as well as UUIDs