Jump to: navigation, search

Difference between revisions of "Trove/associate-flavors-datastores"

(API Resources)
 
(12 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
=Overview=
 
=Overview=
This proposal includes the ability to associate flavor types with datastore versions. The management
+
This proposal includes the ability to associate flavor types with datastore versions. The trove-manage utility will provide the ability to add/delete this information.  
api will provide the ability to add this information.  
 
 
An example use case of this feature is say we have an enterprise version datastore which requires
 
An example use case of this feature is say we have an enterprise version datastore which requires
 
minimum 2GB flavor associated with it. There is no way to currently to enforce that.
 
minimum 2GB flavor associated with it. There is no way to currently to enforce that.
Line 7: Line 6:
 
= API Resources =  
 
= API Resources =  
 
== Summary ==
 
== Summary ==
 +
 +
Existing Routes (that will remain untouched)
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
Line 12: Line 13:
 
|-
 
|-
 
| GET || /{tenant_id}/flavors || Gets list of flavors for the default datastore version
 
| GET || /{tenant_id}/flavors || Gets list of flavors for the default datastore version
 +
|}
 +
 +
New Routes
 +
{| class="wikitable"
 
|-
 
|-
| GET || /{tenant_id}/flavors/{datastore_version_id} || Gets list of flavors for a given datastore version
+
! Verb !! Resource !! Description
|-
 
| POST || /{tenant_id}/mgmt/datastores/versions/{datastore_version_id}/flavors || Adds flavors for a given datastore version id
 
 
|-
 
|-
| DELETE || /{tenant_id}/mgmt/datastores/versions/{datastore_version_id}/flavors/{flavor_id} || Deletes a flavor's association with a given datastore
+
| GET ||"/{tenant_id}/flavors/datastores/versions/{datastore_version_id} || Gets list of flavors for a given datastore version
 
 
 
|}
 
|}
 
 
== Example Calls ==
 
== Example Calls ==
 
=== List Flavors (GET) ===
 
=== List Flavors (GET) ===
Line 50: Line 51:
 
  }
 
  }
  
=== Add flavors datastore version ===
+
==Trove-manage util extension==
 
+
trove-manage datastore-version-flavor-add datastore_version_id flavor_id_list <br/>
This call adds flavors to a given datastore version
+
<br/>
+
trove-manage datastore-version-flavor-delete datastore_version_id flavor_id
POST /{tenant_id}/mgmt/datastores/versions/{datastore_version_id}/flavors
 
 
 
'''Request'''
 
{
 
    "flavors": {
 
        [
 
            {
 
                "id": "550e8400-e29b-41d4-a716-446655440000",
 
            },
 
            {
 
                "id": "220e8400-e29b-41d4-a716-446655449934",
 
            },
 
        ]
 
    }
 
}
 
 
 
Response: 204
 
 
 
=== Delete a flavor association with datastore version ===
 
 
 
This call allows a user to disassociate a flavor to a datastore version
 
 
 
/{tenant_id}/mgmt/datastores/versions/{datastore_version_id}/flavors/{flavor_id}
 
 
 
==== Augments existing API call: List All Datastore Types & Versions ====
 
'''Request'''
 
 
 
GET/{tenant_id}/datastores
 
 
 
'''Response'''
 
<pre>
 
{
 
  "datastores":[
 
      {
 
        "default_version":"1",
 
        "id":"1",
 
        "links":[
 
            {
 
              "href":"https://API/v1.0/1234/datastores/1",
 
              "rel":"self"
 
            },
 
            {
 
              "href":"https://API/datastores/1",
 
              "rel":"bookmark"
 
            }
 
        ],
 
        "name":"mysql",
 
        "versions":[
 
            {
 
              "id":"1",
 
              "links":[
 
                  {
 
                    "href":"https://API/v1.0/1234/datastores/versions/1",
 
                    "rel":"self"
 
                  },
 
                  {
 
                    "href":"https://API/datastores/versions/1",
 
                    "rel":"bookmark"
 
                  }
 
              ],
 
              "name":"mysql-5.5",
 
              <span style="color:blue"> "flavors": [8, 9, 10] </span>
 
            },
 
            {
 
              "id":"2",
 
              "links":[
 
                  {
 
                    "href":"https://API/v1.0/1234/datastores/versions/2",
 
                    "rel":"self"
 
                  },
 
                  {
 
                    "href":"https://API/datastores/versions/2",
 
                    "rel":"bookmark"
 
                  }
 
              ],
 
              "name":"mysql-5.6"
 
              <span style="color:blue">"flavors": [8] </span>
 
            }
 
        ]
 
      },
 
      {
 
        "default_version":"1",
 
        "id":"2",
 
        "links":[
 
            {
 
              "href":"https://API/v1.0/1234/datastores/2",
 
              "rel":"self"
 
            },
 
            {
 
              "href":"https://API/datastores/2",
 
              "rel":"bookmark"
 
            }
 
        ],
 
        "name":"redis",
 
        "versions":[
 
            {
 
              "id":"1",
 
              "links":[
 
                  {
 
                    "href":"https://API/v1.0/1234/datastores/versions/1",
 
                    "rel":"self"
 
                  },
 
                  {
 
                    "href":"https://API/datastores/versions/1",
 
                    "rel":"bookmark"
 
                  }
 
              ],
 
              "name":"redis-2.6",
 
              <span style="color:blue"> "flavors": [1,2,3,4] </span>
 
            },
 
         
 
        ]
 
      }
 
  ]
 
}
 
</pre>
 
  
 
=Database Schema=
 
=Database Schema=
Two new entities will be created in the trove database: capabilities and datastore_version_capabilitiesThese entities will store the capabilities and the association between those capabilities and the datastore
+
One new entity will be created in the trove database: datastore_version_metadataThis will store any additional metadata related to a datastore version including its relation with flavors - key=flavor and the value=flavor_id.
  
 
'''Datastore Version Metadata '''
 
'''Datastore Version Metadata '''
  
This table will contain the id, name and description of the capabilities
+
This table will contain the id, datastore_version_id, key and value
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
Line 185: Line 70:
 
| datastore_version_id || VARCHAR || 36 || False || -
 
| datastore_version_id || VARCHAR || 36 || False || -
 
|-
 
|-
| key || VARCHAR || 256 || False || -
+
| key || VARCHAR || 128 || False || -
 
|-
 
|-
| value || VARCHAR ||  256 || True || -
+
| value || VARCHAR ||  128 || True || -
 
|}
 
|}
 
== Other Comments ==
 
== Other Comments ==

Latest revision as of 19:22, 19 November 2014

Overview

This proposal includes the ability to associate flavor types with datastore versions. The trove-manage utility will provide the ability to add/delete this information. An example use case of this feature is say we have an enterprise version datastore which requires minimum 2GB flavor associated with it. There is no way to currently to enforce that.

API Resources

Summary

Existing Routes (that will remain untouched)

Verb Resource Description
GET /{tenant_id}/flavors Gets list of flavors for the default datastore version

New Routes

Verb Resource Description
GET "/{tenant_id}/flavors/datastores/versions/{datastore_version_id} Gets list of flavors for a given datastore version

Example Calls

List Flavors (GET)

This call lists all flavors for a given datastore version

/{tenant_id}/flavors/datastores/versions/{datastore_version_id}

Response

{
"flavors": [
   {
       "id": 1,
       "links": [
                      {
                      "href": "https://ord.databases.api.rackspacecloud.com/v1.0/1234/flavors/1",
                      "rel": "self"
                      },
                     {
                      "href": "https://ord.databases.api.rackspacecloud.com/flavors/1",
                      "rel": "bookmark"
                     }
                  ],
       "name": "512MB Instance",
       "ram": 512
   },
]
}

Trove-manage util extension

trove-manage datastore-version-flavor-add datastore_version_id flavor_id_list

trove-manage datastore-version-flavor-delete datastore_version_id flavor_id

Database Schema

One new entity will be created in the trove database: datastore_version_metadata. This will store any additional metadata related to a datastore version including its relation with flavors - key=flavor and the value=flavor_id.

Datastore Version Metadata

This table will contain the id, datastore_version_id, key and value

Name Data Type Length Nullable Details
id VARCHAR 36 False Primary Key, Generated UUID
datastore_version_id VARCHAR 36 False -
key VARCHAR 128 False -
value VARCHAR 128 True -

Other Comments

There is an older blueprint https://blueprints.launchpad.net/trove/+spec/service-type-filter-on-flavors which got abandoned. I propose that it should be broken up into to blueprints :

  1. Ability to add flavors via trove
  2. Associating flavors with datastore versions

This spec elaborates on (2) and can be used for the same.