summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Griffith <john.griffith8@gmail.com>2016-11-15 09:26:14 -0700
committerJohn Griffith <john.griffith8@gmail.com>2016-11-15 09:36:57 -0700
commit4295ff0a64f781c3546f6c6e0816dbb8100133cb (patch)
treea73b6298f3427d8e852ce6586dce441c732440ee
parent859ce1f218c253e3927d1026eb9a75aee861109f (diff)
downloadcinder-stable/liberty.tar.gz
Check oslo.concurrency supports prlimitsliberty-eol7.0.3stable/liberty
Bug #1449062 was fixed and backported to Liberty by adding qemu limits settings to oslo putils execute call. The problem is that min requirement for Liberty is oslo.concurrency 2.30 and this feature requires oslo.concurrency 2.6.1. oslo.concurrency isn't pinned but this could cause some issues if folks are on the older version. We should just add a simple try/except block around this so it doesn't break people that are running older versions of oslo.concurrency. Change-Id: I9e3965980f28fc0760b81a6e2d60db33a794cca3 Closes-Bug: #1641992
-rw-r--r--cinder/image/image_utils.py25
1 files changed, 19 insertions, 6 deletions
diff --git a/cinder/image/image_utils.py b/cinder/image/image_utils.py
index c82d3734d..b4f64637d 100644
--- a/cinder/image/image_utils.py
+++ b/cinder/image/image_utils.py
@@ -38,7 +38,7 @@ from oslo_utils import timeutils
from oslo_utils import units
from cinder import exception
-from cinder.i18n import _, _LI, _LW
+from cinder.i18n import _, _LE, _LI, _LW
from cinder.openstack.common import imageutils
from cinder import utils
from cinder.volume import throttling
@@ -54,9 +54,17 @@ image_helper_opts = [cfg.StrOpt('image_conversion_dir',
CONF = cfg.CONF
CONF.register_opts(image_helper_opts)
-QEMU_IMG_LIMITS = processutils.ProcessLimits(
- cpu_time=2,
- address_space=1 * units.Gi)
+QEMU_IMG_LIMITS = None
+
+try:
+ QEMU_IMG_LIMITS = processutils.ProcessLimits(
+ cpu_time=2,
+ address_space=1 * units.Gi)
+except Exception:
+ LOG.error(_LE('Use of process limits requires oslo.concurrency '
+ 'version >=2.6.1 but the installed version is '
+ 'older than that. Please upgrade oslo.concurrency '
+ 'to address vulnerability CVE-2015-5162.'))
def qemu_img_info(path, run_as_root=True):
@@ -64,8 +72,13 @@ def qemu_img_info(path, run_as_root=True):
cmd = ('env', 'LC_ALL=C', 'qemu-img', 'info', path)
if os.name == 'nt':
cmd = cmd[2:]
- out, _err = utils.execute(*cmd, run_as_root=run_as_root,
- prlimit=QEMU_IMG_LIMITS)
+
+ if QEMU_IMG_LIMITS:
+ out, _err = utils.execute(*cmd, run_as_root=run_as_root,
+ prlimit=QEMU_IMG_LIMITS)
+ else:
+ out, _err = utils.execute(*cmd, run_as_root=run_as_root)
+
return imageutils.QemuImgInfo(out)