Datastore-specific API controllers

Datastore-specific API controllers

Improve user and database API extensions to handle datastore-specific properties and allow them to work with clusters.

Launchpad Blueprint:

Also see 1

Problem Description

User and database commands are currently routed through MySQL-specific API extensions. This causes several problems with input validation which is MySQL-specific and does not work well with other datastores. It also forces MySQL-specific properties on models and views which do not have (or have different) meaning on non-MySQL-like datastores.

Another long-lasting problem has been that the above APIs do not work with cluster instances.

Proposed Change

This document proposes introduction of generic API controllers.

Any datastore-specific parsing, handling and validations would be provided in derived classes. Trove would load the appropriate derived-controller dynamically based on the target datastore of the API call.

The goal is to provide a consistent experience to the Trove user. The base controller implementations would provide the execution flow and handle common Trove validations (e.g. check for existence, duplicates) and notifications.

The derived classes would provide datastore-specific parsing and model validations (e.g. username validation, parsing datastore-specific properties from the payload). Datastore-specific views would map models properties on the output payload.

The default controller would also include cluster interface which would, by default, route all request to one (controller) instance of the cluster leaving the rest on the cluster itself. This strategy proved successful with many if not all currently existing datastores. Datastores may override the node selection or entirely re-implement any of the calls shall it be necessary.

We would avoid introduction of new (cluster) API endpoints (e.g. trove cluster-user-create) at this time. It is not clear whether that is required at all for the above APIs and it draws yet another distinction between clusters and single Trove instances which may not be warranted.

This work would be entirely internal to the API engine. The existing endpoints (guest-agent or user facing) would not be affected.


There would be a datastore-specific property for each controller implementation.



Public API


Public API Security


Python API


CLI (python-troveclient)

The CLI would be modified to accept cluster IDs for the related commands.

Internal API

There can be only a single controller per ReST API endpoint.

This would be a Rounting Controller. This controller would be responsible for detecting the target instance’s datastore and loading the derived controller implementation for it (see Configuration). It would then simply pass the request on this derived controller.

The derived controller would extend the Base implementation with the same interface. Generally it would just parse the payload and construct datastore-specific model objects and views. The base implementation would handle the generic validations and execution flow.

The base implementation would also be responsible for detecting the instance type (i.e. single or cluster) and routing the cluster requests to the cluster interface which would then pass it down to one (controller) instance from the cluster. The controller instance would be selected from the nodes exposed by the cluster strategy (i.e. nodes displayed by “trove cluster-instances” command).

Guest Agent




Dashboard Impact (UX)




Petr Malik <>



Work Items

  • Implement the base controllers.

  • Implement derived controllers.

  • Switch datastores to use their respective derived controllers.

Upgrade Implications





Unittests will be added to test the base and derived controller functionality.

Documentation Impact




Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.

trove-specs 0.0.1.dev177