Trove/ceilometer integration

= Ceilometer integration =

Use cases
Use cases:
 * get stats about instances/backups usage
 * get notifications about instance status changes (eg. crash, resize, etc.)
 * get notifications about backups status changes

Notifications
Trove should emit notifications in for different events, such as:


 * Instance events:
 * instance.create.start|end|error
 * instance.delete.start|end|error
 * instance.modify_flavor.start|end|error
 * instance.modify_volume.start|end|error
 * instance.migrate.start|end|error
 * instance.reboot(restart?).start|end|error


 * Cluster events:
 * cluster.create.start|end|error
 * cluster.delete.start|end|error
 * cluster.resize.start|end|error

Note: cluster notifications are emmited by taskmanager.

Note: clusters notification payload looks like:

{              "id": cluster.id, "name": cluster.name, "task": { "id": cluster.task_id, "name": cluster.task_name, "description": cluster.task_description },              "created": cluster.created, "updated": cluster.updated, "datastore": { "type": cluster.datastore.name, "version": cluster.datastore_version.name, },              "cluster_size": 3, "instances": [ {                                   'instance_id': , 'name': 'MyDB, 'created_at': UTCDATE, 'instance_id': , 'volume_size': 1, 'volume_id': , 'type': config_serv, },                             ...               ]      }

Noteː instance notification payload isn't changed.


 * Backup events:
 * backup.create.start|end|error
 * backup.delete.start|end|error

Backup notifications are emitted by the next services:
 * backup.create:
 * trove-taskmanger emmits start|error
 * trove-conductor emmits end|error
 * backup-delete:
 * trove-taskmanger emmits start|end|error

Payload for backup eventsː {       "created": "2014-02-13T21:47:16", "description": "My Backup", "id": "61f12fef-edb1-4561-8122-e7c00ef26a82", "instance_id": "d4603f69-ec7e-4e9b-803f-600b9205576f", "locationRef": null, "name": "snapshot", "parent_id": null, "size": null, "status": "NEW", "updated": "2014-02-13T21:47:16" "tenant_id": "d4603f69-ec7e-4e9b-803f-600b9205276a", }

Additional attribute of the payload is "exception" - string representation of raised exception. "exception" attribute appears only when error occures.

Noteː size, status, locationRef, parent_id values may vairy (depends on notification type).

Justification
Trove should emit events for resources as they are manipulated. These events can be used to meter the service and possibly used to calculate bills. Notification Events: trove/trove-notifications

Benefits

 * Ability to integrate with Ceilometer
 * Ability to integrate with billing systems in terms of Public cloud deployments

Impacts
Existing notifications events are going to be changed:
 * create -> instance.create.start|end|error
 * delete -> instance.delete.start|end|error
 * modify_flavor -> modify_flavor.start|end|error
 * modify_volume -> modify_volume.volume.start|end|error

New notifications are going to be added:
 * backup.create.start|end|error
 * start and/or error notifications are going to be sent by taskmanager
 * end and/or error notifications are going to be sent by conductor (because conductor is the only one place to verify that backup was created properly)
 * backup.delete.start|end|error (all notifications are emited by taskmanager)

Configuration
No changes

Database
No changes

New routes
No changes

Modifications to existing
No changes

Internal API
-

From trove-api to trove-taskamanger
No changes

-

From trove-taskamanger to trove-guestagent
No changes

= Ceilometer plugin =

Ceilometer plugin should be implemented right after all notification modifications are merged into Trove codebase Ceilometer blueprint https://blueprints.launchpad.net/ceilometer/+spec/trove-plugin