summaryrefslogtreecommitdiff
path: root/nova/privsep
diff options
context:
space:
mode:
authorStephen Finucane <sfinucan@redhat.com>2020-02-27 11:47:41 +0000
committerStephen Finucane <stephenfin@redhat.com>2020-04-01 15:29:02 +0100
commitbd9bea5690e14b252bd13921268bf2e976351c2e (patch)
tree2fa0610ba16c70cf1f1ca2ed3b0429ce2c4804f7 /nova/privsep
parentdce9bc03c4753b8acd5ce722c1adcfee7540af0e (diff)
downloadnova-bd9bea5690e14b252bd13921268bf2e976351c2e.tar.gz
libvirt: Remove QEMU_VERSION_REQ_SHARED
The updated minimum required libvirt (4.0.0) and QEMU (2.11) for "Ussuri" satisfy the version requirements; this was done in Change-Id: Ia18e9be4d (22c1916b49 — libvirt: Bump MIN_{LIBVIRT,QEMU}_VERSION for "Ussuri", 2019-11-19). Drop the version constant QEMU_VERSION_REQ_SHARED and now-needless compatibility code; adjust/remove tests. Change-Id: If878a023c69f25a9ea45b7de2ff9eb1976aaeb8c Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
Diffstat (limited to 'nova/privsep')
-rw-r--r--nova/privsep/qemu.py21
1 files changed, 7 insertions, 14 deletions
diff --git a/nova/privsep/qemu.py b/nova/privsep/qemu.py
index 55bdfe2a77..2b2acfd3e8 100644
--- a/nova/privsep/qemu.py
+++ b/nova/privsep/qemu.py
@@ -16,7 +16,6 @@
Helpers for qemu tasks.
"""
-import operator
import os
from oslo_concurrency import processutils
@@ -33,8 +32,6 @@ QEMU_IMG_LIMITS = processutils.ProcessLimits(
cpu_time=30,
address_space=1 * units.Gi)
-QEMU_VERSION_REQ_SHARED = 2010000
-
@nova.privsep.sys_admin_pctxt.entrypoint
def convert_image(source, dest, in_format, out_format, instances_path,
@@ -85,20 +82,17 @@ def unprivileged_convert_image(source, dest, in_format, out_format,
@nova.privsep.sys_admin_pctxt.entrypoint
-def privileged_qemu_img_info(path, format=None, qemu_version=None,
- output_format=None):
+def privileged_qemu_img_info(path, format=None, output_format=None):
"""Return an oject containing the parsed output from qemu-img info
This is a privileged call to qemu-img info using the sys_admin_pctxt
entrypoint allowing host block devices etc to be accessed.
"""
return unprivileged_qemu_img_info(
- path, format=format, qemu_version=qemu_version,
- output_format=output_format)
+ path, format=format, output_format=output_format)
-def unprivileged_qemu_img_info(path, format=None, qemu_version=None,
- output_format=None):
+def unprivileged_qemu_img_info(path, format=None, output_format=None):
"""Return an object containing the parsed output from qemu-img info."""
try:
# The following check is about ploop images that reside within
@@ -107,15 +101,14 @@ def unprivileged_qemu_img_info(path, format=None, qemu_version=None,
os.path.exists(os.path.join(path, "DiskDescriptor.xml"))):
path = os.path.join(path, "root.hds")
- cmd = ('env', 'LC_ALL=C', 'LANG=C', 'qemu-img', 'info', path)
+ cmd = (
+ 'env', 'LC_ALL=C', 'LANG=C', 'qemu-img', 'info', path,
+ '--force-share',
+ )
if format is not None:
cmd = cmd + ('-f', format)
if output_format is not None:
cmd = cmd + ("--output=%s" % (output_format),)
- # Check to see if the qemu version is >= 2.10 because if so, we need
- # to add the --force-share flag.
- if qemu_version and operator.ge(qemu_version, QEMU_VERSION_REQ_SHARED):
- cmd = cmd + ('--force-share',)
out, err = processutils.execute(*cmd, prlimit=QEMU_IMG_LIMITS)
except processutils.ProcessExecutionError as exp:
if exp.exit_code == -9: