summaryrefslogtreecommitdiff
path: root/nova/virt/images.py
diff options
context:
space:
mode:
authorSean Dague <sean@dague.net>2016-12-08 10:09:06 -0500
committerSean Dague <sean@dague.net>2016-12-08 10:41:31 -0500
commitb78b1f8ce3aa407307a6adc5c60de1e960547897 (patch)
tree727bea75ca5c7ceda805a9b3f119004cf6fff936 /nova/virt/images.py
parentca8d5ff533c1900eaf05c860d446ecccc916d20c (diff)
downloadnova-b78b1f8ce3aa407307a6adc5c60de1e960547897.tar.gz
Bump prlimit cpu time for qemu from 2 to 8
We've got user reported bugs that when opperating with slow NFS backends with large (30+ GB) disk files, the prlimit of cpu_time 2 is guessed to be the issue at hand because if folks hot patch a qemu-img that runs before the prlimitted one, the prlimitted one succeeds. This increases the allowed cpu timeout, as well as tweaking the error message so that we return something more prescriptive when the qemu-img command fails with prlimit abort. The original bug (#1449062) the main mitigation concern here was a carefully crafted image that gets qemu-img to generate > 1G of json, and hence could be a node attack vector. cpu_time was never mentioned, and I think was added originally as a belt and suspenders addition. As such, bumping it to 8 seconds shouldn't impact our protection in any real way. Change-Id: I1f4549b787fd3b458e2c48a90bf80025987f08c4 Closes-Bug: #1646181
Diffstat (limited to 'nova/virt/images.py')
-rw-r--r--nova/virt/images.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/nova/virt/images.py b/nova/virt/images.py
index 33b2470059..fc4db6275e 100644
--- a/nova/virt/images.py
+++ b/nova/virt/images.py
@@ -39,7 +39,7 @@ CONF = nova.conf.CONF
IMAGE_API = image.API()
QEMU_IMG_LIMITS = processutils.ProcessLimits(
- cpu_time=2,
+ cpu_time=8,
address_space=1 * units.Gi)
@@ -62,8 +62,13 @@ def qemu_img_info(path, format=None):
cmd = cmd + ('-f', format)
out, err = utils.execute(*cmd, prlimit=QEMU_IMG_LIMITS)
except processutils.ProcessExecutionError as exp:
- msg = (_("qemu-img failed to execute on %(path)s : %(exp)s") %
- {'path': path, 'exp': exp})
+ # this means we hit prlimits, make the exception more specific
+ if exp.exit_code == -9:
+ msg = (_("qemu-img aborted by prlimits when inspecting "
+ "%(path)s : %(exp)s") % {'path': path, 'exp': exp})
+ else:
+ msg = (_("qemu-img failed to execute on %(path)s : %(exp)s") %
+ {'path': path, 'exp': exp})
raise exception.InvalidDiskInfo(reason=msg)
if not out: