Merged with Trunk
This commit is contained in:
2
Authors
2
Authors
@@ -1,4 +1,5 @@
|
|||||||
Alex Meade <alex.meade@rackspace.com>
|
Alex Meade <alex.meade@rackspace.com>
|
||||||
|
Alexander Sakhnov <asakhnov@mirantis.com>
|
||||||
Andrey Brindeyev <abrindeyev@griddynamics.com>
|
Andrey Brindeyev <abrindeyev@griddynamics.com>
|
||||||
Andy Smith <code@term.ie>
|
Andy Smith <code@term.ie>
|
||||||
Andy Southgate <andy.southgate@citrix.com>
|
Andy Southgate <andy.southgate@citrix.com>
|
||||||
@@ -64,6 +65,7 @@ Masanori Itoh <itoumsn@nttdata.co.jp>
|
|||||||
Matt Dietz <matt.dietz@rackspace.com>
|
Matt Dietz <matt.dietz@rackspace.com>
|
||||||
Michael Gundlach <michael.gundlach@rackspace.com>
|
Michael Gundlach <michael.gundlach@rackspace.com>
|
||||||
Mike Scherbakov <mihgen@gmail.com>
|
Mike Scherbakov <mihgen@gmail.com>
|
||||||
|
Mohammed Naser <mnaser@vexxhost.com>
|
||||||
Monsyne Dragon <mdragon@rackspace.com>
|
Monsyne Dragon <mdragon@rackspace.com>
|
||||||
Monty Taylor <mordred@inaugust.com>
|
Monty Taylor <mordred@inaugust.com>
|
||||||
MORITA Kazutaka <morita.kazutaka@gmail.com>
|
MORITA Kazutaka <morita.kazutaka@gmail.com>
|
||||||
|
|||||||
@@ -17,7 +17,9 @@ import uuid
|
|||||||
|
|
||||||
from nova import flags
|
from nova import flags
|
||||||
from nova import utils
|
from nova import utils
|
||||||
|
from nova import log as logging
|
||||||
|
|
||||||
|
LOG = logging.getLogger('nova.exception')
|
||||||
|
|
||||||
FLAGS = flags.FLAGS
|
FLAGS = flags.FLAGS
|
||||||
|
|
||||||
@@ -37,6 +39,12 @@ class BadPriorityException(Exception):
|
|||||||
pass
|
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):
|
def notify(publisher_id, event_type, priority, payload):
|
||||||
"""
|
"""
|
||||||
Sends a notification using the specified driver
|
Sends a notification using the specified driver
|
||||||
@@ -79,4 +87,8 @@ def notify(publisher_id, event_type, priority, payload):
|
|||||||
priority=priority,
|
priority=priority,
|
||||||
payload=payload,
|
payload=payload,
|
||||||
timestamp=str(utils.utcnow()))
|
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()))
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ class AdapterConsumer(Consumer):
|
|||||||
return
|
return
|
||||||
self.pool.spawn_n(self._process_data, msg_id, ctxt, method, args)
|
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):
|
def _process_data(self, msg_id, ctxt, method, args):
|
||||||
"""Thread that maigcally looks for a method on the proxy
|
"""Thread that maigcally looks for a method on the proxy
|
||||||
object and calls it.
|
object and calls it.
|
||||||
@@ -279,7 +279,7 @@ class FanoutAdapterConsumer(AdapterConsumer):
|
|||||||
# them when done, so they're not left around on restart.
|
# them when done, so they're not left around on restart.
|
||||||
# Also, we're the only one that should be consuming. exclusive
|
# Also, we're the only one that should be consuming. exclusive
|
||||||
# implies auto_delete, so we'll just set that..
|
# implies auto_delete, so we'll just set that..
|
||||||
self.exclusive = True
|
self.exclusive = False
|
||||||
LOG.info(_('Created "%(exchange)s" fanout exchange '
|
LOG.info(_('Created "%(exchange)s" fanout exchange '
|
||||||
'with "%(key)s" routing key'),
|
'with "%(key)s" routing key'),
|
||||||
dict(exchange=self.exchange, key=self.routing_key))
|
dict(exchange=self.exchange, key=self.routing_key))
|
||||||
|
|||||||
@@ -359,3 +359,35 @@ class VlanNetworkTestCase(test.TestCase):
|
|||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
|
|
||||||
self.network.validate_networks(None, requested_networks)
|
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')
|
||||||
|
|||||||
Reference in New Issue
Block a user