From bccf801f3242eaa91242ba1363529579d04bfc37 Mon Sep 17 00:00:00 2001 From: Matt Van Dijk Date: Fri, 24 Apr 2015 13:59:22 -0400 Subject: [PATCH] MongoDB database management commands Spec for enabling various database management commands for MongoDB. database-create, list, and delete will be supported. Change-Id: Ifaf22fbc40ce3dea86aa06fbe83557a0ed16f4e9 Implements: blueprint mongodb-database --- doc/source/index.rst | 8 ++ specs/liberty/mongodb-database.rst | 159 +++++++++++++++++++++++++++++ 2 files changed, 167 insertions(+) create mode 100644 specs/liberty/mongodb-database.rst diff --git a/doc/source/index.rst b/doc/source/index.rst index 5cf2203..58e348c 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -20,6 +20,14 @@ Kilo approved specs: specs/kilo/* +Liberty approved specs: + +.. toctree:: + :glob: + :maxdepth: 1 + + specs/liberty/* + ====================== Repository Information ====================== diff --git a/specs/liberty/mongodb-database.rst b/specs/liberty/mongodb-database.rst new file mode 100644 index 0000000..af55f9d --- /dev/null +++ b/specs/liberty/mongodb-database.rst @@ -0,0 +1,159 @@ +.. + This work is licensed under a Creative Commons Attribution 3.0 Unported + License. + + http://creativecommons.org/licenses/by/3.0/legalcode + + Sections of this template were taken directly from the Nova spec + template at: + https://github.com/openstack/nova-specs/blob/master/specs/template.rst + + +============================= + MongoDB database management +============================= + +https://blueprints.launchpad.net/trove/+spec/mongodb-database + +Enable MongoDB database management functionality. + + +Problem description +=================== + +The MongoDB datastore does not support database management features. Allowing +the user to create, list, and delete databases through the API is essential. + + +Proposed change +=============== + +Three standard Trove commands will be enabled for MongoDB: + +1. database-create +2. database-list +3. database-delete + +The changes will be confined to the guestagent code. The taskmanager, API, and +conductor do not require any code changes. The code changes will be to +implement a new class service.MongoDBAdmin and the corresponding methods as +members of the class. The methods of manager.Manager will be updated to call +the admin functions. + +Calls to MongoDB will be done in Python via the PyMongo library, which is +required to be pre-installed on the guest. + + +Configuration +------------- + +No changes will be made to any configuration files. + + +Database +-------- + +No new items will be added here. + + +Public API +---------- + +No API changes. + + +Public API Security +------------------- + +No API Security changes. + + +Internal API +------------ + +No Internal API changes. + + +Guest Agent +----------- + +Modified files: + +:: + + trove/guestagent/db/models.py - add a MongoDBSchema class. + trove/guestagent/datastore/experimental/mongodb/manager.py - enable functions. + trove/guestagent/datastore/experimental/mongodb/service.py - add functions. + +The Guest Agent will be changed to support the following manager functions: + +1. create_database - MongoDB does not have a method to explicitly create a + database. The database to use is specified via 'use ', but this does + not create the database. Databases are created when a 'document' is first + inserted into them. To ensure a database is created, a dummy document will + be inserted but then deleted. + +2. list_databases - Run 'pymongo.MongoClient.database_names()' and return the resulting list. + +3. delete_database - Drop the database with + 'pymongo.MongoClient.drop_database("")'. Users associated with the + database will have to be removed manually. + + +Alternatives +------------ + +create_database could not create a dummy object in the database. + + +Implementation +============== + +Assignee(s) +----------- + +Matthew Van Dijk + + +Milestones +---------- + +liberty-1 + + +Work Items +---------- + +The changes will be implemented in a single commit. The scope is small and the +functionality is linked. + + +Upgrade Implications +==================== + +There will be no upgrade implications. + + +Dependencies +============ + +There are no dependencies on other work in progress. + + +Testing +======= + +Unit tests will be added to validate non-trivial code paths. +Integration tests may be added as needed. + +Documentation Impact +==================== + +The MongoDB datastore documentation can be updated to reflect the enabled +features. + + +References +========== + +There are no external references in this document.