pungi/0002-Add-buildinstall_use_guestmount-boolean-option.patch
2018-01-16 09:30:36 +01:00

66 lines
2.7 KiB
Diff

From 91ce7c7169b9313c94e9f72b2d9374851747f424 Mon Sep 17 00:00:00 2001
From: Jan Kaluza <jkaluza@redhat.com>
Date: Tue, 16 Jan 2018 09:13:55 +0100
Subject: [PATCH 2/2] Add buildinstall_use_guestmount boolean option
Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
---
pungi/checks.py | 1 +
pungi/phases/buildinstall.py | 4 +++-
pungi/wrappers/iso.py | 5 +++--
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/pungi/checks.py b/pungi/checks.py
index 9fc40b8..5438204 100644
--- a/pungi/checks.py
+++ b/pungi/checks.py
@@ -708,6 +708,7 @@ def make_schema():
},
"buildinstall_topdir": {"type": "string"},
"buildinstall_kickstart": {"$ref": "#/definitions/str_or_scm_dict"},
+ "buildinstall_use_guestmount": {"type": "boolean", "default": True},
"global_ksurl": {"type": "string"},
"global_version": {"type": "string"},
diff --git a/pungi/phases/buildinstall.py b/pungi/phases/buildinstall.py
index bbc06ae..e2c8d79 100644
--- a/pungi/phases/buildinstall.py
+++ b/pungi/phases/buildinstall.py
@@ -305,7 +305,9 @@ def tweak_buildinstall(compose, src, dst, arch, variant, label, volid, kickstart
if not os.path.isfile(image):
continue
- with iso.mount(image, logger=compose._logger) as mount_tmp_dir:
+ with iso.mount(image, logger=compose._logger,
+ use_guestmount=compose.conf.get("buildinstall_use_guestmount")
+ ) as mount_tmp_dir:
for config in BOOT_CONFIGS:
config_path = os.path.join(tmp_dir, config)
config_in_image = os.path.join(mount_tmp_dir, config)
diff --git a/pungi/wrappers/iso.py b/pungi/wrappers/iso.py
index 9ed3f24..9bca337 100644
--- a/pungi/wrappers/iso.py
+++ b/pungi/wrappers/iso.py
@@ -379,7 +379,7 @@ def graft_point_sort_key(x):
@contextlib.contextmanager
-def mount(image, logger=None):
+def mount(image, logger=None, use_guestmount=True):
"""Mount an image and make sure it's unmounted.
The yielded path will only be valid in the with block and is removed once
@@ -387,7 +387,8 @@ def mount(image, logger=None):
"""
with util.temp_dir(prefix='iso-mount-') as mount_dir:
ret, __ = run(["which", "guestmount"], can_fail=True)
- guestmount_available = not bool(ret) # return code 0 means that guestmount is available
+ # return code 0 means that guestmount is available
+ guestmount_available = use_guestmount and not bool(ret)
if guestmount_available:
# use guestmount to mount the image, which doesn't require root privileges
# LIBGUESTFS_BACKEND=direct: running qemu directly without libvirt
--
2.13.6