Fix sloppy initialization of the new disk ops semaphore.
Some tests weren't calling init_host, so the semaphore was None. This caused the smoke to come out of nova's tests in ways that would be less confusing if they'd failed during the testing of the implementing patch. Instead, set the semaphore to being unbounded, and then override that later if the user has in fact specified a limit. This relies on init_host being called very early, but that should be true already. Change-Id: If144be253f78b14cef60200a46aefc02c0e19ced Closes-Bug: #1806123
This commit is contained in:
parent
288c537fcd
commit
1e8c2c0dcb
nova/compute
@ -1192,14 +1192,12 @@ class ComputeManager(manager.Manager):
|
||||
|
||||
nova.conf.neutron.register_dynamic_opts(CONF)
|
||||
|
||||
# one-time initialization
|
||||
# Override the number of concurrent disk operations allowed if the
|
||||
# user has specified a limit.
|
||||
if CONF.compute.max_concurrent_disk_ops != 0:
|
||||
compute_utils.disk_ops_semaphore = \
|
||||
eventlet.semaphore.BoundedSemaphore(
|
||||
CONF.compute.max_concurrent_disk_ops)
|
||||
else:
|
||||
compute_utils.disk_ops_semaphore = \
|
||||
compute_utils.UnlimitedSemaphore()
|
||||
|
||||
self.driver.init_host(host=self.host)
|
||||
context = nova.context.get_admin_context()
|
||||
|
@ -54,11 +54,6 @@ from nova.virt import driver
|
||||
CONF = nova.conf.CONF
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
# This semaphore is used to enforce a limit on disk-IO-intensive operations
|
||||
# (image downloads, image conversions) at any given time.
|
||||
# It is initialized at ComputeManager.init_host()
|
||||
disk_ops_semaphore = None
|
||||
|
||||
|
||||
def exception_to_dict(fault, message=None):
|
||||
"""Converts exceptions to a dict for use in notifications."""
|
||||
@ -1176,6 +1171,12 @@ class UnlimitedSemaphore(object):
|
||||
return 0
|
||||
|
||||
|
||||
# This semaphore is used to enforce a limit on disk-IO-intensive operations
|
||||
# (image downloads, image conversions) at any given time.
|
||||
# It is initialized at ComputeManager.init_host()
|
||||
disk_ops_semaphore = UnlimitedSemaphore()
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
def notify_about_instance_delete(notifier, context, instance,
|
||||
delete_type='delete',
|
||||
|
Loading…
x
Reference in New Issue
Block a user