oslo-incubator sync

Syncs heat with oslo-incubator project.

Change-Id: I52c8b543294c53ab99b78d1514e9150785d066d0
This commit is contained in:
Kanagaraj Manickam
2015-03-27 11:03:29 +05:30
parent 7ae372104e
commit 639e0ed205
4 changed files with 17 additions and 16 deletions

View File

@@ -50,7 +50,7 @@ LOG = logging.getLogger(__name__)
def list_opts(): def list_opts():
"""Entry point for oslo.config-generator. """Entry point for oslo-config-generator.
""" """
return [(None, copy.deepcopy(eventlet_backdoor_opts))] return [(None, copy.deepcopy(eventlet_backdoor_opts))]

View File

@@ -22,6 +22,6 @@ HTTP_RESP_HEADER_REQUEST_ID = 'x-openstack-request-id'
@versionutils.deprecated(as_of=versionutils.deprecated.KILO, @versionutils.deprecated(as_of=versionutils.deprecated.KILO,
in_favor_of='oslo.middleware.RequestId') in_favor_of='oslo_middleware.RequestId')
class RequestIdMiddleware(request_id.RequestId): class RequestIdMiddleware(request_id.RequestId):
pass pass

View File

@@ -199,16 +199,12 @@ class ServiceWrapper(object):
class ProcessLauncher(object): class ProcessLauncher(object):
def __init__(self, wait_interval=0.01): def __init__(self):
"""Constructor. """Constructor."""
:param wait_interval: The interval to sleep for between checks
of child process exit.
"""
self.children = {} self.children = {}
self.sigcaught = None self.sigcaught = None
self.running = True self.running = True
self.wait_interval = wait_interval
rfd, self.writepipe = os.pipe() rfd, self.writepipe = os.pipe()
self.readpipe = eventlet.greenio.GreenPipe(rfd, 'r') self.readpipe = eventlet.greenio.GreenPipe(rfd, 'r')
self.handle_signal() self.handle_signal()
@@ -333,8 +329,8 @@ class ProcessLauncher(object):
def _wait_child(self): def _wait_child(self):
try: try:
# Don't block if no child processes have exited # Block while any of child processes have exited
pid, status = os.waitpid(0, os.WNOHANG) pid, status = os.waitpid(0, 0)
if not pid: if not pid:
return None return None
except OSError as exc: except OSError as exc:
@@ -363,10 +359,6 @@ class ProcessLauncher(object):
while self.running: while self.running:
wrap = self._wait_child() wrap = self._wait_child()
if not wrap: if not wrap:
# Yield to other threads if no children have exited
# Sleep for a short time to avoid excessive CPU usage
# (see bug #1095346)
eventlet.greenthread.sleep(self.wait_interval)
continue continue
while self.running and len(wrap.children) < wrap.workers: while self.running and len(wrap.children) < wrap.workers:
self._start_child(wrap) self._start_child(wrap)

View File

@@ -17,6 +17,7 @@
Helpers for comparing version strings. Helpers for comparing version strings.
""" """
import copy
import functools import functools
import inspect import inspect
import logging import logging
@@ -32,13 +33,19 @@ LOG = logging.getLogger(__name__)
CONF = cfg.CONF CONF = cfg.CONF
opts = [ deprecated_opts = [
cfg.BoolOpt('fatal_deprecations', cfg.BoolOpt('fatal_deprecations',
default=False, default=False,
help='Enables or disables fatal status of deprecations.'), help='Enables or disables fatal status of deprecations.'),
] ]
def list_opts():
"""Entry point for oslo.config-generator.
"""
return [(None, copy.deepcopy(deprecated_opts))]
class deprecated(object): class deprecated(object):
"""A decorator to mark callables as deprecated. """A decorator to mark callables as deprecated.
@@ -83,6 +90,7 @@ class deprecated(object):
ICEHOUSE = 'I' ICEHOUSE = 'I'
JUNO = 'J' JUNO = 'J'
KILO = 'K' KILO = 'K'
LIBERTY = 'L'
_RELEASES = { _RELEASES = {
# NOTE(morganfainberg): Bexar is used for unit test purposes, it is # NOTE(morganfainberg): Bexar is used for unit test purposes, it is
@@ -94,6 +102,7 @@ class deprecated(object):
'I': 'Icehouse', 'I': 'Icehouse',
'J': 'Juno', 'J': 'Juno',
'K': 'Kilo', 'K': 'Kilo',
'L': 'Liberty',
} }
_deprecated_msg_with_alternative = _( _deprecated_msg_with_alternative = _(
@@ -230,7 +239,7 @@ def report_deprecated_feature(logger, msg, *args, **kwargs):
fatal deprecations. fatal deprecations.
""" """
stdmsg = _("Deprecated: %s") % msg stdmsg = _("Deprecated: %s") % msg
CONF.register_opts(opts) CONF.register_opts(deprecated_opts)
if CONF.fatal_deprecations: if CONF.fatal_deprecations:
logger.critical(stdmsg, *args, **kwargs) logger.critical(stdmsg, *args, **kwargs)
raise DeprecatedConfig(msg=stdmsg) raise DeprecatedConfig(msg=stdmsg)