From 639e0ed20506e42434607b635befee05edb7a7ca Mon Sep 17 00:00:00 2001 From: Kanagaraj Manickam Date: Fri, 27 Mar 2015 11:03:29 +0530 Subject: [PATCH] oslo-incubator sync Syncs heat with oslo-incubator project. Change-Id: I52c8b543294c53ab99b78d1514e9150785d066d0 --- heat/openstack/common/eventlet_backdoor.py | 2 +- heat/openstack/common/middleware/request_id.py | 2 +- heat/openstack/common/service.py | 16 ++++------------ heat/openstack/common/versionutils.py | 13 +++++++++++-- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/heat/openstack/common/eventlet_backdoor.py b/heat/openstack/common/eventlet_backdoor.py index 08a8a3eef..c321690f1 100644 --- a/heat/openstack/common/eventlet_backdoor.py +++ b/heat/openstack/common/eventlet_backdoor.py @@ -50,7 +50,7 @@ LOG = logging.getLogger(__name__) def list_opts(): - """Entry point for oslo.config-generator. + """Entry point for oslo-config-generator. """ return [(None, copy.deepcopy(eventlet_backdoor_opts))] diff --git a/heat/openstack/common/middleware/request_id.py b/heat/openstack/common/middleware/request_id.py index 3ae3e2702..07ea8cca5 100644 --- a/heat/openstack/common/middleware/request_id.py +++ b/heat/openstack/common/middleware/request_id.py @@ -22,6 +22,6 @@ HTTP_RESP_HEADER_REQUEST_ID = 'x-openstack-request-id' @versionutils.deprecated(as_of=versionutils.deprecated.KILO, - in_favor_of='oslo.middleware.RequestId') + in_favor_of='oslo_middleware.RequestId') class RequestIdMiddleware(request_id.RequestId): pass diff --git a/heat/openstack/common/service.py b/heat/openstack/common/service.py index 2bc1c40c1..47cef7415 100644 --- a/heat/openstack/common/service.py +++ b/heat/openstack/common/service.py @@ -199,16 +199,12 @@ class ServiceWrapper(object): class ProcessLauncher(object): - def __init__(self, wait_interval=0.01): - """Constructor. + def __init__(self): + """Constructor.""" - :param wait_interval: The interval to sleep for between checks - of child process exit. - """ self.children = {} self.sigcaught = None self.running = True - self.wait_interval = wait_interval rfd, self.writepipe = os.pipe() self.readpipe = eventlet.greenio.GreenPipe(rfd, 'r') self.handle_signal() @@ -333,8 +329,8 @@ class ProcessLauncher(object): def _wait_child(self): try: - # Don't block if no child processes have exited - pid, status = os.waitpid(0, os.WNOHANG) + # Block while any of child processes have exited + pid, status = os.waitpid(0, 0) if not pid: return None except OSError as exc: @@ -363,10 +359,6 @@ class ProcessLauncher(object): while self.running: wrap = self._wait_child() 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 while self.running and len(wrap.children) < wrap.workers: self._start_child(wrap) diff --git a/heat/openstack/common/versionutils.py b/heat/openstack/common/versionutils.py index 17522d01c..48888ee69 100644 --- a/heat/openstack/common/versionutils.py +++ b/heat/openstack/common/versionutils.py @@ -17,6 +17,7 @@ Helpers for comparing version strings. """ +import copy import functools import inspect import logging @@ -32,13 +33,19 @@ LOG = logging.getLogger(__name__) CONF = cfg.CONF -opts = [ +deprecated_opts = [ cfg.BoolOpt('fatal_deprecations', default=False, 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): """A decorator to mark callables as deprecated. @@ -83,6 +90,7 @@ class deprecated(object): ICEHOUSE = 'I' JUNO = 'J' KILO = 'K' + LIBERTY = 'L' _RELEASES = { # NOTE(morganfainberg): Bexar is used for unit test purposes, it is @@ -94,6 +102,7 @@ class deprecated(object): 'I': 'Icehouse', 'J': 'Juno', 'K': 'Kilo', + 'L': 'Liberty', } _deprecated_msg_with_alternative = _( @@ -230,7 +239,7 @@ def report_deprecated_feature(logger, msg, *args, **kwargs): fatal deprecations. """ stdmsg = _("Deprecated: %s") % msg - CONF.register_opts(opts) + CONF.register_opts(deprecated_opts) if CONF.fatal_deprecations: logger.critical(stdmsg, *args, **kwargs) raise DeprecatedConfig(msg=stdmsg)