summaryrefslogtreecommitdiff
path: root/trove/backup
diff options
context:
space:
mode:
authorMorgan Jones <morgan@parelastic.com>2015-09-21 10:31:31 -0400
committerPeter Stachowski <peter@tesora.com>2016-02-27 00:16:28 +0000
commit5c29f40d5fda268becf2b5f97e66937195ce8c4b (patch)
treeec97d613ea54bb0f9121181d5f02978a47e44164 /trove/backup
parent7395cd9b0b4f2d61bbe00abb5d6fa9c5196189cb (diff)
downloadtrove-5c29f40d5fda268becf2b5f97e66937195ce8c4b.tar.gz
Implement DBaaS Ceilometer Notifications
Defines and implements create|end|error notifications for all state-changing Trove API calls. Adds a notification to the TroveContext to transfer the notification to the guest and conductor so that errors on asynchronous commands can be forwarded to the Conductor to be transferred to the control plane bus. Also did some cleanup on the existing notifications to bring them all under a common framework in trove/common/notifications.py. The trove.instance.exists notification was not integrated into the new framework due to its close-coupling with the Nova notification code. Reworked the cluster action mechanism to move routing functionality from the strategy to the Cluster base class. This was done to support tying notifications to cluster specific actions. Implements Blueprint: ceilometer-integration Change-Id: I9c57d24f80d8d3116fc0cc8948094087a0495135
Diffstat (limited to 'trove/backup')
-rw-r--r--trove/backup/service.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/trove/backup/service.py b/trove/backup/service.py
index cdba5d80..6ebe8c95 100644
--- a/trove/backup/service.py
+++ b/trove/backup/service.py
@@ -20,6 +20,8 @@ from trove.backup import views
from trove.common import apischema
from trove.common import cfg
from trove.common.i18n import _
+from trove.common import notification
+from trove.common.notification import StartNotification
from trove.common import pagination
from trove.common import wsgi
@@ -62,7 +64,12 @@ class BackupController(wsgi.Controller):
name = data['name']
desc = data.get('description')
parent = data.get('parent_id')
- backup = Backup.create(context, instance, name, desc, parent_id=parent)
+ context.notification = notification.DBaaSBackupCreate(context,
+ request=req)
+ with StartNotification(context, name=name, instance_id=instance,
+ description=desc, parent_id=parent):
+ backup = Backup.create(context, instance, name, desc,
+ parent_id=parent)
return wsgi.Result(views.BackupView(backup).data(), 202)
def delete(self, req, tenant_id, id):
@@ -70,5 +77,8 @@ class BackupController(wsgi.Controller):
'ID: %(backup_id)s') %
{'tenant_id': tenant_id, 'backup_id': id})
context = req.environ[wsgi.CONTEXT_KEY]
- Backup.delete(context, id)
+ context.notification = notification.DBaaSBackupDelete(context,
+ request=req)
+ with StartNotification(context, backup_id=id):
+ Backup.delete(context, id)
return wsgi.Result(None, 202)