Add buildinstall_use_guestmount boolean option
Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
This commit is contained in:
		
							parent
							
								
									68a1370036
								
							
						
					
					
						commit
						930c2f1a42
					
				| @ -708,6 +708,7 @@ def make_schema(): | |||||||
|             }, |             }, | ||||||
|             "buildinstall_topdir":  {"type": "string"}, |             "buildinstall_topdir":  {"type": "string"}, | ||||||
|             "buildinstall_kickstart": {"$ref": "#/definitions/str_or_scm_dict"}, |             "buildinstall_kickstart": {"$ref": "#/definitions/str_or_scm_dict"}, | ||||||
|  |             "buildinstall_use_guestmount": {"type": "boolean", "default": True}, | ||||||
| 
 | 
 | ||||||
|             "global_ksurl": {"type": "string"}, |             "global_ksurl": {"type": "string"}, | ||||||
|             "global_version": {"type": "string"}, |             "global_version": {"type": "string"}, | ||||||
|  | |||||||
| @ -305,7 +305,9 @@ def tweak_buildinstall(compose, src, dst, arch, variant, label, volid, kickstart | |||||||
|         if not os.path.isfile(image): |         if not os.path.isfile(image): | ||||||
|             continue |             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: |             for config in BOOT_CONFIGS: | ||||||
|                 config_path = os.path.join(tmp_dir, config) |                 config_path = os.path.join(tmp_dir, config) | ||||||
|                 config_in_image = os.path.join(mount_tmp_dir, config) |                 config_in_image = os.path.join(mount_tmp_dir, config) | ||||||
|  | |||||||
| @ -379,7 +379,7 @@ def graft_point_sort_key(x): | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @contextlib.contextmanager | @contextlib.contextmanager | ||||||
| def mount(image, logger=None): | def mount(image, logger=None, use_guestmount=True): | ||||||
|     """Mount an image and make sure it's unmounted. |     """Mount an image and make sure it's unmounted. | ||||||
| 
 | 
 | ||||||
|     The yielded path will only be valid in the with block and is removed once |     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: |     with util.temp_dir(prefix='iso-mount-') as mount_dir: | ||||||
|         ret, __ = run(["which", "guestmount"], can_fail=True) |         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: |         if guestmount_available: | ||||||
|             # use guestmount to mount the image, which doesn't require root privileges |             # use guestmount to mount the image, which doesn't require root privileges | ||||||
|             # LIBGUESTFS_BACKEND=direct: running qemu directly without libvirt |             # LIBGUESTFS_BACKEND=direct: running qemu directly without libvirt | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user