From 2c89a8b2606e0c219dfa3cf81969b9751bcbbbb4 Mon Sep 17 00:00:00 2001 From: Jay Lau Date: Sun, 15 Sep 2013 14:03:42 +0800 Subject: [PATCH] Change service id to compute for compute/api.py Now the default service id for nova api notification is aggregate, this is not accurate, we should change it to compute. Fix bug 1225579 Change-Id: Ife558024c57d9fd035cd1a618063c656e03c52a3 --- nova/compute/api.py | 2 +- nova/tests/compute/test_compute.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/nova/compute/api.py b/nova/compute/api.py index 3e6d784d313..2d3ec351164 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -75,7 +75,7 @@ LOG = logging.getLogger(__name__) -get_notifier = functools.partial(notifier.get_notifier, service='aggregate') +get_notifier = functools.partial(notifier.get_notifier, service='compute') wrap_exception = functools.partial(exception.wrap_exception, get_notifier=get_notifier) diff --git a/nova/tests/compute/test_compute.py b/nova/tests/compute/test_compute.py index 1b2090923d7..eefe57cd1fb 100644 --- a/nova/tests/compute/test_compute.py +++ b/nova/tests/compute/test_compute.py @@ -8297,9 +8297,13 @@ def test_add_host_to_aggregate_raise_not_found(self): # Ensure ComputeHostNotFound is raised when adding invalid host. aggr = self.api.create_aggregate(self.context, 'fake_aggregate', 'fake_zone') + fake_notifier.NOTIFICATIONS = [] self.assertRaises(exception.ComputeHostNotFound, self.api.add_host_to_aggregate, self.context, aggr['id'], 'invalid_host') + self.assertEqual(len(fake_notifier.NOTIFICATIONS), 2) + self.assertEqual(fake_notifier.NOTIFICATIONS[1].publisher_id, + 'compute.fake-mini') def test_remove_host_from_aggregate_active(self): # Ensure we can remove a host from an aggregate.