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.