From 9175822ffeb89268afc6db7900f8b45d738e108c Mon Sep 17 00:00:00 2001 From: Lorin Hochstein Date: Wed, 9 Nov 2011 14:00:55 -0500 Subject: [PATCH] Workaround for eventlet bug with unit tests in RHEL6.1. This adds a patch to fix the broken eventlet code that's installed in the virtualenv. Fixes bug 884915 Change-Id: I6dbf755abbc5a52208de3dd892257ce39686d396 --- contrib/redhat-eventlet.patch | 16 ++++++++++++++++ tools/install_venv.py | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 contrib/redhat-eventlet.patch diff --git a/contrib/redhat-eventlet.patch b/contrib/redhat-eventlet.patch new file mode 100644 index 000000000000..cf2ff53d5107 --- /dev/null +++ b/contrib/redhat-eventlet.patch @@ -0,0 +1,16 @@ +--- .nova-venv/lib/python2.6/site-packages/eventlet/green/subprocess.py.orig +2011-05-25 +23:31:34.597271402 +0000 ++++ .nova-venv/lib/python2.6/site-packages/eventlet/green/subprocess.py +2011-05-25 +23:33:24.055602468 +0000 +@@ -32,7 +32,7 @@ + setattr(self, attr, wrapped_pipe) + __init__.__doc__ = subprocess_orig.Popen.__init__.__doc__ + +- def wait(self, check_interval=0.01): ++ def wait(self, check_interval=0.01, timeout=None): + # Instead of a blocking OS call, this version of wait() uses logic + # borrowed from the eventlet 0.2 processes.Process.wait() method. + try: + diff --git a/tools/install_venv.py b/tools/install_venv.py index 578908a7ec0b..166801e829ec 100644 --- a/tools/install_venv.py +++ b/tools/install_venv.py @@ -90,6 +90,13 @@ class Distro(object): def install_m2crypto(self): pip_install('M2Crypto') + def post_process(self): + """Any distribution-specific post-processing gets done here. + + In particular, this is useful for applying patches to code inside + the venv.""" + pass + class Fedora(Distro): """This covers all Fedora-based distributions. @@ -120,6 +127,26 @@ class Fedora(Distro): if not self.check_pkg('m2crypto'): self.yum_install('m2crypto') + def post_process(self): + """Workaround for a bug in eventlet. + + This currently affects RHEL6.1, but the fix can safely be + applied to all RHEL and Fedora distributions. + + This can be removed when the fix is applied upstream + + Nova: https://bugs.launchpad.net/nova/+bug/884915 + Upstream: https://bitbucket.org/which_linden/eventlet/issue/89""" + + # Install "patch" program if it's not there + if not self.check_pkg('patch'): + self.yum_install('patch') + + # Apply the eventlet patch + run_command(['patch', + '.nova-venv/lib/python2.6/site-packages/eventlet/green/subprocess.py', + 'contrib/redhat-eventlet.patch']) + def get_distro(): if os.path.exists('/etc/fedora-release') or \ @@ -177,6 +204,10 @@ def install_dependencies(venv=VENV): f.write("%s\n" % ROOT) +def post_process(): + get_distro().post_process() + + def print_help(): help = """ Nova development environment setup is complete. @@ -214,6 +245,7 @@ def main(argv): check_dependencies() create_virtualenv(no_site_packages=options.no_site_packages) install_dependencies() + post_process() print_help() if __name__ == '__main__':