Jump to: navigation, search


< Trove
Revision as of 09:38, 17 September 2013 by Sushilkm (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Extending Flavor API to create and delete Flavors from trove

== Requirements ==

  1. Management API to add/delete flavors from trove.
  2. Categorization for service_type for a flavor created from trove.(This categorization would be used to validate the guest vm creation and resize activities to related flavors, mapped for service.)

== Implementation ==

  1. In Troveclient's management.py a new class MgmtFlavors has been added with two methods for creation and deletion of flavors using the API "/mgmt/flavors" in trove.
  2. In Trove, new controller MgmtFlavorController has been added in trove.extensions.mgmt.flavors.service.py and is registered in trove.extensions.routes.mgmt.py
  3. This controller has two public methods create and delete which could be called under admin context only.
  4. Create method in controller also does a json-schema validation using the new schema added in trove.common.apischema.py
  5. Controller methods in turn calls their counter-parts from trove.flavor.models.py
  6. New class FlavorManage with 3 methods(create, delete, load_flavor) have been implemented in trove.flavor.models.py.
  7. Class FlavorView in trove.flavor.views.py has been edited to show service for the flavors.
  8. To keep the service_type classification, table service_flavors is created using trove.db.sqlalchemy.migrate_repo.versions.016_service_flavor.py and mapped in db.sqlalchemy.mappers.py as service_flavor.
  9. service_flavors table is created with three columns(id, service_type, flavor_id).
  10. New model ServiceFlavor has been created in trove.flavor.models.py to work with table service_flavors and is registered in trove.db.sqlalchemy.session.py
  11. Create method in trove.flavor.models.py creates the flavor using nova client and creates a record in service_flavors table. Delete method deletes the flavor from nova and removes entry from trove database. Load_flavor has been written to fetch the flavor details using nova client.
  12. Integration tests have been updated in trove.tests.api.flavors.py and unit-tests have been written as tests.unittests.mgmt.flavors.test_flavors_controller.py and tests.unittests.mgmt.flavors. test_flavors_models.py