From f3ebdd56c5d598f1fe2537e390e41e0866a3846e Mon Sep 17 00:00:00 2001 From: Marc Methot Date: Tue, 21 Jan 2020 14:41:23 -0500 Subject: [PATCH] Configurable timeout of the QEMU img conversion Instead of having a hardcoded value the conversion prlimits are now operator configurable. These settings have always been arbitrary as it depends on the environment. Change-Id: I462cecc3152bf838b7d42d5abc3ca31610567e5e Closes-Bug: #1705340 --- cinder/image/image_utils.py | 10 ++++++++-- ...igurable-img-conversion-param-1e7b545ae816dfe8.yaml | 7 +++++++ 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/add-configurable-img-conversion-param-1e7b545ae816dfe8.yaml diff --git a/cinder/image/image_utils.py b/cinder/image/image_utils.py index 83e8d57fc3e..f3e4635b62d 100644 --- a/cinder/image/image_utils.py +++ b/cinder/image/image_utils.py @@ -63,14 +63,20 @@ image_opts = [ default=True, help='When possible, compress images uploaded ' 'to the image service'), + cfg.IntOpt('image_conversion_cpu_limit', + default=60, + help='CPU time limit in seconds to convert the image'), + cfg.IntOpt('image_conversion_address_space_limit', + default=1, + help='Address space limit in gigabytes to convert the image'), ] CONF = cfg.CONF CONF.register_opts(image_opts) QEMU_IMG_LIMITS = processutils.ProcessLimits( - cpu_time=30, - address_space=1 * units.Gi) + cpu_time=CONF.image_conversion_cpu_limit, + address_space=CONF.image_conversion_address_space_limit * units.Gi) QEMU_IMG_FORMAT_MAP = { diff --git a/releasenotes/notes/add-configurable-img-conversion-param-1e7b545ae816dfe8.yaml b/releasenotes/notes/add-configurable-img-conversion-param-1e7b545ae816dfe8.yaml new file mode 100644 index 00000000000..dc2be518110 --- /dev/null +++ b/releasenotes/notes/add-configurable-img-conversion-param-1e7b545ae816dfe8.yaml @@ -0,0 +1,7 @@ +--- +features: + - | + Added the ``image_conversion_cpu_limit`` and + ``image_conversion_address_space_limit`` as configurable parameters. This + adds configurability to the image conversion process to prevent the process + from timing out when converting larger images.