Merge ~ewanmellor/nova/lp609749.

This commit is contained in:
Ewan Mellor
2010-07-25 15:11:20 +01:00
4 changed files with 23 additions and 13 deletions

14
README
View File

@@ -6,15 +6,19 @@ The Choose Your Own Adventure README for Nova:
To monitor it from a distance: follow @novacc on twitter
To tame it for use in your own cloud: read http://docs.novacc.org/getting.started.html
To tame it for use in your own cloud: read http://nova.openstack.org/getting.started.html
To study its anatomy: read http://docs.novacc.org/architecture.html
To study its anatomy: read http://nova.openstack.org/architecture.html
To disect it in detail: visit http://github.com/nova/cc
To disect it in detail: visit http://code.launchpad.net/nova
To taunt it with its weaknesses: use http://github.com/nova/cc/issues
To taunt it with its weaknesses: use http://bugs.launchpad.net/nova
To watch it: http://hudson.openstack.org
To hack at it: read HACKING
To watch it: http://test.novacc.org/waterfall
To laugh at its PEP8 problems: http://hudson.openstack.org/job/nova-pep8/violations
To cry over its pylint problems: http://hudson.openstack.org/job/nova-pylint/violations

View File

@@ -205,13 +205,12 @@ class ProcessPool(object):
self._pool.release()
return rv
class SharedPool(ProcessPool):
_instance = None
def __new__(cls, *args, **kwargs):
if not cls._instance:
cls._instance = super(SharedPool, cls).__new__(
cls, *args, **kwargs)
return cls._instance
def SharedPool():
global _instance
if _instance is None:
_instance = ProcessPool()
return _instance
def simple_execute(cmd, **kwargs):
return SharedPool().simple_execute(cmd, **kwargs)

View File

@@ -137,7 +137,7 @@ class NetworkTestCase(test.TrialTestCase):
self.dnsmasq.release_ip(mac3, address3, hostname, net.bridge_name)
net = network.get_project_network("project0", "default")
rv = network.deallocate_ip(secondaddress)
self.dnsmasq.release_ip(mac, address, hostname, net.bridge_name)
self.dnsmasq.release_ip(mac, secondaddress, hostname, net.bridge_name)
def test_release_before_deallocate(self):
pass

View File

@@ -120,3 +120,10 @@ class ProcessTestCase(test.TrialTestCase):
pool2 = process.SharedPool()
self.assert_(id(pool1) == id(pool2))
def test_shared_pool_works_as_singleton(self):
d1 = process.simple_execute('sleep 1')
d2 = process.simple_execute('sleep 0.005')
# lp609749: would have failed with
# exceptions.AssertionError: Someone released me too many times:
# too many tokens!
return d1