From 930c2f1a42fce7d173cd2f3075ff10c0601e4516 Mon Sep 17 00:00:00 2001 From: Jan Kaluza Date: Tue, 16 Jan 2018 09:13:55 +0100 Subject: [PATCH] Add buildinstall_use_guestmount boolean option Signed-off-by: Jan Kaluza --- 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 473a470a..faf18a24 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 001b78bc..2d7d3cba 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 c88473ba..0b8afa2a 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