diff --git a/Authors b/Authors index d2b1b627..2e50cfbe 100644 --- a/Authors +++ b/Authors @@ -1,4 +1,5 @@ Alex Meade +Alexander Sakhnov Andrey Brindeyev Andy Smith Andy Southgate @@ -64,6 +65,7 @@ Masanori Itoh Matt Dietz Michael Gundlach Mike Scherbakov +Mohammed Naser Monsyne Dragon Monty Taylor MORITA Kazutaka diff --git a/nova/notifier/api.py b/nova/notifier/api.py index d49517c8..98969fd3 100644 --- a/nova/notifier/api.py +++ b/nova/notifier/api.py @@ -17,7 +17,9 @@ import uuid from nova import flags from nova import utils +from nova import log as logging +LOG = logging.getLogger('nova.exception') FLAGS = flags.FLAGS @@ -37,6 +39,12 @@ class BadPriorityException(Exception): pass +def publisher_id(service, host=None): + if not host: + host = FLAGS.host + return "%s.%s" % (service, host) + + def notify(publisher_id, event_type, priority, payload): """ Sends a notification using the specified driver @@ -79,4 +87,8 @@ def notify(publisher_id, event_type, priority, payload): priority=priority, payload=payload, timestamp=str(utils.utcnow())) - driver.notify(msg) + try: + driver.notify(msg) + except Exception, e: + LOG.exception(_("Problem '%(e)s' attempting to " + "send to notification system." % locals())) diff --git a/nova/rpc.py b/nova/rpc.py index f52f377b..055f8220 100644 --- a/nova/rpc.py +++ b/nova/rpc.py @@ -219,7 +219,7 @@ class AdapterConsumer(Consumer): return self.pool.spawn_n(self._process_data, msg_id, ctxt, method, args) - @exception.wrap_exception + @exception.wrap_exception() def _process_data(self, msg_id, ctxt, method, args): """Thread that maigcally looks for a method on the proxy object and calls it. @@ -279,7 +279,7 @@ class FanoutAdapterConsumer(AdapterConsumer): # them when done, so they're not left around on restart. # Also, we're the only one that should be consuming. exclusive # implies auto_delete, so we'll just set that.. - self.exclusive = True + self.exclusive = False LOG.info(_('Created "%(exchange)s" fanout exchange ' 'with "%(key)s" routing key'), dict(exchange=self.exchange, key=self.routing_key)) diff --git a/nova/tests/test_network.py b/nova/tests/test_network.py index d6c36348..63317b05 100644 --- a/nova/tests/test_network.py +++ b/nova/tests/test_network.py @@ -359,3 +359,35 @@ class VlanNetworkTestCase(test.TestCase): self.mox.ReplayAll() self.network.validate_networks(None, requested_networks) + + +class CommonNetworkTestCase(test.TestCase): + + class FakeNetworkManager(network_manager.NetworkManager): + """This NetworkManager doesn't call the base class so we can bypass all + inherited service cruft and just perform unit tests. + """ + + class FakeDB: + def fixed_ip_get_by_instance(self, context, instance_id): + return [dict(address='10.0.0.0'), dict(address='10.0.0.1'), + dict(address='10.0.0.2')] + + def __init__(self): + self.db = self.FakeDB() + self.deallocate_called = None + + def deallocate_fixed_ip(self, context, address): + self.deallocate_called = address + + def test_remove_fixed_ip_from_instance(self): + manager = self.FakeNetworkManager() + manager.remove_fixed_ip_from_instance(None, 99, '10.0.0.1') + + self.assertEquals(manager.deallocate_called, '10.0.0.1') + + def test_remove_fixed_ip_from_instance_bad_input(self): + manager = self.FakeNetworkManager() + self.assertRaises(exception.FixedIpNotFoundForSpecificInstance, + manager.remove_fixed_ip_from_instance, + None, 99, 'bad input')