Migrate a notifier patch from common:

commit c767e9beffe4b826eac869ce7e2eef2cc1499bbe
Author: Andrew Bogott <abogott@wikimedia.org>
Date: Thu Jul 19 03:34:31 2012 -0500

Add multiple-driver support to the notifier api.

Move all of the functionality previously provided by the list_notifier
into the basic notifier api. Move and restructure tests accordingly.

Remove the list_notifier file and test file.

For bug 1025820

Change-Id: Icadaafe8bc312942249272873d9a4a8f1aa49a94
This commit is contained in:
Andrew Bogott
2012-08-03 20:15:54 -05:00
parent 9092f08ccd
commit 4186762f99
2 changed files with 9 additions and 2 deletions

View File

@@ -30,6 +30,7 @@ from nova import exception
from nova import flags
from nova.openstack.common import importutils
from nova.openstack.common import log as logging
from nova.openstack.common.notifier import api as notifier_api
from nova.openstack.common.notifier import test_notifier
from nova.openstack.common import rpc
import nova.policy
@@ -50,7 +51,7 @@ class VolumeTestCase(test.TestCase):
self.compute = importutils.import_object(FLAGS.compute_manager)
self.flags(compute_driver='nova.virt.fake.FakeDriver')
self.stubs.Set(nova.flags.FLAGS, 'notification_driver',
'nova.openstack.common.notifier.test_notifier')
['nova.openstack.common.notifier.test_notifier'])
self.volume = importutils.import_object(FLAGS.volume_manager)
self.context = context.get_admin_context()
instance = db.instance_create(self.context, {})
@@ -60,6 +61,7 @@ class VolumeTestCase(test.TestCase):
def tearDown(self):
db.instance_destroy(self.context, self.instance_uuid)
notifier_api._reset_drivers()
super(VolumeTestCase, self).tearDown()
@staticmethod

View File

@@ -22,6 +22,7 @@ from nova import db
from nova import flags
from nova.openstack.common import importutils
from nova.openstack.common import log as logging
from nova.openstack.common.notifier import api as notifier_api
from nova.openstack.common.notifier import test_notifier
from nova import test
from nova.volume import utils as volume_utils
@@ -39,7 +40,7 @@ class UsageInfoTestCase(test.TestCase):
stub_network=True,
host='fake')
self.stubs.Set(flags.FLAGS, 'notification_driver',
'nova.openstack.common.notifier.test_notifier')
['nova.openstack.common.notifier.test_notifier'])
self.volume = importutils.import_object(FLAGS.volume_manager)
self.user_id = 'fake'
self.project_id = 'fake'
@@ -48,6 +49,10 @@ class UsageInfoTestCase(test.TestCase):
self.context = context.RequestContext(self.user_id, self.project_id)
test_notifier.NOTIFICATIONS = []
def tearDown(self):
notifier_api._reset_drivers()
super(UsageInfoTestCase, self).tearDown()
def _create_volume(self, params={}):
"""Create a test volume"""
vol = {}