trove-specs/specs/kilo/datastore-visibility.rst
Nikhil Manchanda 4a72d213aa Add unit tests for Trove specs
Add simple unit tests to the Trove specs repo which ensure that
specifications submitted follow the template correctly and address
all the needed sections.

Update tox to run these unit tests automatically.

At the beginning of each release, test_titles.py will need to be updated
and 'current_release' modified to reflect the new release directory.  At
the same time, the new release directory will be created, the index.rst
file in doc/source ammended to include this directory, and any unmerged
specs moved there.  In this way, changes to the template will only
affect specs going forward and avoids having to modify any specs that
have merged in previous releases.

(It will also have the side effect of signalling the 'opening' of the
release to new specs.)

Change-Id: I8f1175bceed63d36d96b6c6c6b4188ef27d3102e
2015-06-16 21:53:16 +00:00

7.3 KiB

Datastore Visibility

Launchpad blueprint:

https://blueprints.launchpad.net/trove/+spec/datastore-visibility

Motivation: Since Trove supports multiple datastore types, there is a need for Trove to have a greater control over the customer visibility of these datastore types. This change enables Trove to control the visibility of the various datastore types.

Problem Description

There might be some datastore types, which the deployers require to be active but not visible to customers in the production environment. Example use case: Say we want to have an active datastore A in production and not expose it to customers yet.

Proposed Change

This change suggests adding a visibility attribute to the datastore versions. This enables the datastore to still be active, but not visible to the users. The visibility flag will ensure it is visible on the datastore list call only to admins.

  1. Visibility attribute to the datastore version. It can be: public/private/unlisted/deprecated.
  2. Adding a datastore version members table to add tenants for private datastores.
  3. If visibility is public:
    • All users can view it in the list.
    • All users can make a GET call on the datastore version.
    • All admin can view it in the list.
    • All admin can make a GET call on the datastore version.
  4. If visibility is private:
    • Members only can view it in the list.
    • Members only can make a GET call on the datastore version.
    • All admin can view it in the list.
    • All admin can make a GET call on the datastore version.
    • All admin can add and remove tenants as members of a datastore version.
  5. If visibility is unlisted:
    • All users can make a GET call on the datastore version.
    • All admin can view it in the list.
    • All admin can make a GET call on the datastore version.
  6. If visibility is deprecated:
    • All admin can view it in the list.
    • All admin can make a GET call on the datastore version.
    • Only admins can create a 'deprecated' instance.

Configuration

None

Database

  1. Database migration of adding a column 'visibility' to the datastore_versions table.

Table datastore_versions:

Field          | Type        | Null | Key     | Default | Extra|
---------------------------------------------------------------|
id             | varchar(36) | NO   | PRIMARY | NULL    |      |
datastore_id   | varchar(36) | YES  | MUL     | NULL    |      |
name           | varchar(255)| YES  |         | NULL    |      |
image_id       | varchar(36) | NO   |         | NULL    |      |
packages       | varchar(511)| YES  |         | NULL    |      |
active         | tinyint(1)  | NO   |         | NULL    |      |
manager        | varchar(255)| YES  |         | NULL    |      |
visibility     | varchar(255)| NO   |         | public  |      |
  1. New table datastore_version_members which consists of columns - id, datastore_version_id,tenant_id.

Table datastore_version_members:

Field               | Type        | Null | Key         | Default | Extra|
------------------------------------------------------------------------|
id                  | varchar(36) | NO   | PRIMARY     | NULL    |      |
datastore_version_id| varchar(36) | YES  | Foreign [1] | NULL    |      |
tenant_id           | varchar(36) | NO   |             | NULL    |      |

[1] datastore_version_id is a Foreign-Key on datastore_version.id

Public API

  1. Set visibility

    POST /{tenant_id}/mgmt/datastores/{datastore}/versions/{id}

    Request:

    {
        "datastore_version":{
            "visibility":"<visibility value>"
        }
    }
  2. Get datastore version - A visibility field added only for admin users.

    GET /{tenant_id}/datastores/{datastore_id}/versions/{id}

    Response:

    {
        "version":{
            "active":true,
            "datastore":"9dd70f56-72e9-444b-9881-f564ac955056",
            "id":"65747630-1ce7-4be0-92d4-8695825a475b",
            "image":"32070be9-3cab-4cee-be05-524b4f379447",
            "links":[
                {
                    "href":"https://172.16.117.178:8779/v1.0/9a4e7142f34b4ce990a276c82b7beb15/datastores/versions/65747630-1ce7-4be0-92d4-8695825a475b",
                    "rel":"self"
                },
                {
                    "href":"https://172.16.117.178:8779/datastores/versions/65747630-1ce7-4be0-92d4-8695825a475b",
                    "rel":"bookmark"
                }
            ],
            "name":"5.5",
            "packages":"mysql-server-5.5",
            "visibility":"public"
        }
    }
  1. Add a member:

    POST /{tenant_id}/mgmt/datastores/{datastore}/versions/{id}/members

    Request:

    {
        "member":"<TENANT_ID>"
    }
  2. Delete a member:

DELETE /{tenant_id}/mgmt/datastores/{datastore}/versions/{id}/members/{member_id}

  1. Get a member:

    GET /{tenant_id}/mgmt/datastores/{datastore}/versions/{id}/members/{member_id}

    Response:

    {
       "datastore_version_member":{
          "id":"<MEMBER_ID>",
          "datastore_version_id":"<DATASTORE_VERSION_ID>",
          "member":"<TENANT_ID>"
        }
    }
  2. List members for a datastore version

GET /{tenant_id}/mgmt/datastores/{datastore}/versions/{id}/members

Response:

{
   "datastore_version_members":[
        {
            "id":"<MEMBER_ID>",
            "datastore_version_id":"<DATASTORE_VERSION_ID>",
            "member":"<TENANT_ID>"
        },
        {
            "id":"<MEMBER_ID>",
            "datastore_version_id":"<DATASTORE_VERSION_ID>",
            "member":"<TENANT_ID>"
        }
    ]
}
  1. Get members by tenant id:

    GET /{tenant_id}/mgmt/datastores/{datastore}/versions/members/{tenant_id}

    Response:

    {
       "datastore_version_members":[
          {
             "id":"<MEMBER_ID>",
             "datastore_version_id":"<DATASTORE_VERSION_ID>",
             "member":"<TENANT_ID>"
          },
          {
             "id":"<MEMBER_ID>",
             "datastore_version_id":"<DATASTORE_VERSION_ID>",
             "member":"<TENANT_ID>"
          }
       ]
    }

Public API Security

None

Internal API

None

Guest Agent

None

Alternatives

None

Implementation

Assignee(s)

Primary:
Co-Authored by:

Milestones

Kilo-1 Kilo-2

Work Items

Already in review process - References [1].

Implementation

It is in the process of review - References [1].

Dependencies

None

Testing

Unit tests, fake tests and real mode tests.

Documentation Impact

Since API calls have been added/modified, their respective samples would need to be incorporated in the API docs.

References

  1. https://review.openstack.org/#/c/110197/