Fix max concurrent builds's unlimited semaphore
When booting an instance with the config paramter max_concurrent_builds set to 0, a TypeError is logged in the compute log. This doesn't prevent the instance from booting, but could be confusing to someone debugging a different issue. This patch fixes this issue by fixing the method signature of the __exit__ method of compute utils's UnlimitedSemaphore. UnlimitedSemaphore was bypassed entirely in unit tests because the default value for max_concurrent_builds is 10. Closes-bug: 1520633 Change-Id: I15825eb3fb1bccb12f4a9148809495ce3e83e3c8
This commit is contained in:
@@ -528,7 +528,7 @@ class UnlimitedSemaphore(object):
|
|||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def __exit__(self):
|
def __exit__(self, exc_type, exc_val, exc_tb):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|||||||
@@ -3208,8 +3208,16 @@ class ComputeManagerBuildInstanceTestCase(test.NoDBTestCase):
|
|||||||
mock_hooks.setdefault().run_post.assert_called_once_with(
|
mock_hooks.setdefault().run_post.assert_called_once_with(
|
||||||
'build_instance', result, mock.ANY, mock.ANY, f=None)
|
'build_instance', result, mock.ANY, mock.ANY, f=None)
|
||||||
|
|
||||||
|
def test_build_and_run_instance_called_with_proper_args(self):
|
||||||
|
self._test_build_and_run_instance()
|
||||||
|
|
||||||
|
def test_build_and_run_instance_with_unlimited_max_concurrent_builds(self):
|
||||||
|
self.flags(max_concurrent_builds=0)
|
||||||
|
self.compute = importutils.import_object(CONF.compute_manager)
|
||||||
|
self._test_build_and_run_instance()
|
||||||
|
|
||||||
@mock.patch('nova.hooks._HOOKS')
|
@mock.patch('nova.hooks._HOOKS')
|
||||||
def test_build_and_run_instance_called_with_proper_args(self, mock_hooks):
|
def _test_build_and_run_instance(self, mock_hooks):
|
||||||
self.mox.StubOutWithMock(self.compute, '_build_and_run_instance')
|
self.mox.StubOutWithMock(self.compute, '_build_and_run_instance')
|
||||||
self._do_build_instance_update()
|
self._do_build_instance_update()
|
||||||
self.compute._build_and_run_instance(self.context, self.instance,
|
self.compute._build_and_run_instance(self.context, self.instance,
|
||||||
|
|||||||
Reference in New Issue
Block a user