diff --git a/.zuul.yaml b/.zuul.yaml index cbbe37896b..9e1a61f0bb 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -242,6 +242,13 @@ $GLANCE_API_CONF: DEFAULT: enabled_import_methods: "[\"copy-image\", \"glance-direct\"]" + wsgi: + python_interpreter: /usr/bin/python3 + $GLANCE_IMAGE_IMPORT_CONF: + image_import_opts: + image_import_plugins: "['image_conversion']" + image_conversion: + output_format: raw - project: templates: diff --git a/glance/async_/flows/plugins/image_conversion.py b/glance/async_/flows/plugins/image_conversion.py index 3bfbc4a42e..a5165b0abf 100644 --- a/glance/async_/flows/plugins/image_conversion.py +++ b/glance/async_/flows/plugins/image_conversion.py @@ -70,6 +70,7 @@ class _ConvertImage(task.Task): self.image_repo = image_repo self.image_id = image_id self.dest_path = "" + self.python = CONF.wsgi.python_interpreter super(_ConvertImage, self).__init__( name='%s-Convert_Image-%s' % (task_type, task_id)) @@ -88,6 +89,7 @@ class _ConvertImage(task.Task): "--output=json", src_path, prlimit=utils.QEMU_IMG_PROC_LIMITS, + python_exec=self.python, log_errors=putils.LOG_ALL_ERRORS,) except OSError as exc: with excutils.save_and_reraise_exception(): diff --git a/glance/common/config.py b/glance/common/config.py index cc5e45ef94..2093117ad6 100644 --- a/glance/common/config.py +++ b/glance/common/config.py @@ -19,6 +19,7 @@ Routines for configuring Glance import logging import os +import sys from oslo_config import cfg from oslo_middleware import cors @@ -578,6 +579,14 @@ too large, you *may* have increased memory footprint per worker and/or you may overwhelm other system resources such as disk or outbound network bandwidth. If this is too small, image import requests will have to wait until a thread becomes available to begin processing.""")), + cfg.StrOpt('python_interpreter', + default=sys.executable, + help=_(""" +Path to the python interpreter to use when spawning external +processes. By default this is sys.executable, which should be the +same interpreter running Glance itself. However, in some situations +(i.e. uwsgi) this may not actually point to a python interpreter +itself.""")), ]