RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2025944 - Compile libguestfs with ./configure --enable-appliance-format-auto to allow for qcow2-format fixed appliances
Summary: Compile libguestfs with ./configure --enable-appliance-format-auto to allow f...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: libguestfs
Version: 9.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Virtualization Maintenance
QA Contact: YongkuiGuo
URL:
Whiteboard:
: 2024152 (view as bug list)
Depends On: 1967166
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-11-23 12:55 UTC by Richard W.M. Jones
Modified: 2022-05-17 12:38 UTC (History)
8 users (show)

Fixed In Version: libguestfs-1.46.0-5.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1967166
Environment:
Last Closed: 2022-05-17 12:28:38 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-103663 0 None None None 2021-11-23 12:56:37 UTC
Red Hat Product Errata RHBA-2022:2317 0 None None None 2022-05-17 12:28:58 UTC

Description Richard W.M. Jones 2021-11-23 12:55:00 UTC
+++ This bug was initially created as a clone of Bug #1967166 +++

Description of problem:
Kubevirt plans to integrate libguestfs. The build setup uses bazel to build the container images, and this requires a fixed appliance. The appliance is extracted and copy into the container image layer. The root filesystem is a sparse file, and it makes the image size very large 5.59GB. A better option would be to use qcow2 format for the root. However, the current libguestfs explicitly set raw for the root. It will be very useful to have a way to be able to use qcow2 format for the root filesystem 


Version-Release number of selected component (if applicable):
libguestfs 1.44


How reproducible:
Always

Steps to Reproduce:
1. Extract the libguestfs appliance 
2. Build a container image with the extracted appliance
3. Verify the image size

Additional info:
The original problem can be found at https://github.com/kubevirt/kubevirt/pull/5402

--- Additional comment from Richard W.M. Jones on 2021-06-03 09:30:48 UTC ---

The request here is to use the build option:

  ./configure --enable-appliance-format-auto

This changes the way libguestfs opens the appliance by not forcing the
root disk to be in raw format.  The exact changes are:

https://github.com/libguestfs/libguestfs/blob/e68a844eb406f0b32cc2c4e60ca66bc1a7f94bdc/lib/launch-direct.c#L641

https://github.com/libguestfs/libguestfs/blob/e68a844eb406f0b32cc2c4e60ca66bc1a7f94bdc/lib/launch-libvirt.c#L497

Because we don't force raw format, this makes it possible to construct
a qcow2-based fixed appliance, which works around the problems that
containers have preserving sparseness.  For libguestfs in Fedora we
will of course continue to use a supermin-built appliance in raw format.

I wanted to see if this would have any overhead on the ordinary (raw) case.
On my own system, without the option:

$ ./run hyperfine -w 3 'guestfish -a /dev/null run'
Benchmark #1: guestfish -a /dev/null run
  Time (mean ± σ):      1.601 s ±  0.015 s    [User: 18.3 ms, System: 19.6 ms]
  Range (min … max):    1.580 s …  1.625 s    10 runs

With the option:

$ ./run hyperfine -w 3 'guestfish -a /dev/null run'
Benchmark #1: guestfish -a /dev/null run
  Time (mean ± σ):      1.596 s ±  0.023 s    [User: 16.5 ms, System: 21.3 ms]
  Range (min … max):    1.570 s …  1.647 s    10 runs

This is well within error bars so I'm not worried from that point of view.

Comment 1 Richard W.M. Jones 2021-11-23 12:55:34 UTC
*** Bug 2024152 has been marked as a duplicate of this bug. ***

Comment 2 Richard W.M. Jones 2021-11-23 12:59:36 UTC
Reproducer:

$ cd /var/tmp
$ libguestfs-make-fixed-appliance appliance
$ ls -l appliance
total 304916
-rw-r--r--. 1 rjones rjones    6039040 Nov 23 12:32 initrd
-rwxr-xr-x. 1 rjones rjones   10971128 Nov 23 12:32 kernel
-rw-r--r--. 1 rjones rjones        978 Nov 23 12:32 README.fixed
-rw-r--r--. 1 rjones rjones 4294967296 Nov 23 12:32 root

The following command should work (as it's using the raw-format root appliance).
This is not the reproducer, just a sanity check that libguestfs + appliance is working:

$ LIBGUESTFS_PATH=$PWD/appliance libguestfs-test-tool

The following commands convert the root appliance to qcow2 format and repeat the test:

$ qemu-img convert -f raw appliance/root.raw -O qcow2 appliance/root
$ file appliance/root
appliance/root: QEMU QCOW2 Image (v3), 4294967296 bytes

$ LIBGUESTFS_PATH=$PWD/appliance libguestfs-test-tool

That command will fail when trying to mount the root filesystem, just after
loading modules.

Comment 5 YongkuiGuo 2021-11-24 04:09:06 UTC
Verified with package:
libguestfs-1.46.0-5.el9.x86_64

Steps:

1. On rhel9 host
$ cd /var/tmp
$ libguestfs-make-fixed-appliance appliance
$ ls -l appliance
total 305836
-rw-r--r--. 1 yoguo yoguo    6039040 Nov 23 22:59 initrd
-rwxr-xr-x. 1 yoguo yoguo   10972216 Nov 23 22:59 kernel
-rw-rw-r--. 1 yoguo yoguo        978 Nov 23 22:59 README.fixed
-rw-r--r--. 1 yoguo yoguo 4294967296 Nov 23 22:59 root

$ LIBGUESTFS_PATH=$PWD/appliance libguestfs-test-tool
...
===== TEST FINISHED OK =====

$ mv appliance/root  appliance/root.raw
$ qemu-img convert -f raw appliance/root.raw -O qcow2 appliance/root
$ file appliance/root
appliance/root: QEMU QCOW2 Image (v3), 4294967296 bytes
$ LIBGUESTFS_PATH=$PWD/appliance libguestfs-test-tool
...
libguestfs: command: run: qemu-img
libguestfs: command: run: \ info
libguestfs: command: run: \ -U
libguestfs: command: run: \ --output json
libguestfs: command: run: \ /var/tmp/appliance/root
libguestfs: parse_json: qemu-img info JSON output:\n{\n    "virtual-size": 4294967296,\n    "filename": "/var/tmp/appliance/root",\n    "cluster-size": 65536,\n    "format": "qcow2",\n    "actual-size": 299962368,\n    "format-specific": {\n        "type": "qcow2",\n        "data": {\n            "compat": "1.1",\n            "compression-type": "zlib",\n            "lazy-refcounts": false,\n            "refcount-bits": 16,\n            "corrupt": false,\n            "extended-l2": false\n        }\n    },\n    "dirty-flag": false\n}\n\n
libguestfs: command: run: qemu-img
libguestfs: command: run: \ create
libguestfs: command: run: \ -f qcow2
libguestfs: command: run: \ -o backing_file=/var/tmp/appliance/root,backing_fmt=qcow2
libguestfs: command: run: \ /tmp/libguestfsJQ1mE2/overlay2.qcow2
Formatting '/tmp/libguestfsJQ1mE2/overlay2.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=4294967296 backing_file=/var/tmp/appliance/root backing_fmt=qcow2 lazy_refcounts=off refcount_bits=16
...
===== TEST FINISHED OK =====

Comment 8 errata-xmlrpc 2022-05-17 12:28:38 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (new packages: libguestfs), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:2317


Note You need to log in before you can comment on or make changes to this bug.