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 2047660 - Add '--compressed' support in modular v2v
Summary: Add '--compressed' support in modular v2v
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: virt-v2v
Version: 9.1
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: rc
: ---
Assignee: Richard W.M. Jones
QA Contact: Vera
URL:
Whiteboard:
Depends On: 2059288
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-01-28 08:55 UTC by Xiaodai Wang
Modified: 2022-11-15 10:23 UTC (History)
7 users (show)

Fixed In Version: virt-v2v-2.0.7-1.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-11-15 09:55:51 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-110184 0 None None None 2022-01-28 09:02:38 UTC
Red Hat Product Errata RHSA-2022:7968 0 None None None 2022-11-15 09:56:22 UTC

Internal Links: 2107503

Description Xiaodai Wang 2022-01-28 08:55:25 UTC
Description of problem:
Add '--compressed' support in modular v2v

Version-Release number of selected component (if applicable):
virt-v2v-1.45.97-3.el9.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Run virt-v2v with --compressed option.
# virt-v2v -i libvirt -ic qemu:///system avocado-vt-vm1 -o libvirt -os default --compressed -on avocado-vt-vm1_compress


Actual results:
The command will generate error 'virt-v2v: error: no -oo (output options) are allowed here'.

Expected results:


Additional info:

Comment 1 Richard W.M. Jones 2022-01-28 08:58:19 UTC
This was dropped when I modularised virt-v2v, and I intended to add it
back but forgot.  Should be an easy change.

https://github.com/libguestfs/virt-v2v/blob/68af35d48ca845133ede948d36ee351d171e3de8/TODO#L14

Comment 2 Richard W.M. Jones 2022-01-28 11:17:22 UTC
This isn't quite as easy as I thought it would be.  I had to ask a question
about how the compress filter works in qemu:

https://lists.nongnu.org/archive/html/qemu-devel/2022-01/msg06108.html

Comment 3 Richard W.M. Jones 2022-02-01 09:01:41 UTC
This looked like it was going to be an easy fix but it revealed
problems in nbdcopy which will take more effort to fix.  This is
RHEL 9.1 material.

See this thread for background:
https://listman.redhat.com/archives/libguestfs/2022-January/thread.html#00213

Comment 4 Laszlo Ersek 2022-04-18 14:05:59 UTC
(In reply to Richard W.M. Jones from comment #3)
> This looked like it was going to be an easy fix but it revealed
> problems in nbdcopy which will take more effort to fix.  This is
> RHEL 9.1 material.
> 
> See this thread for background:
> https://listman.redhat.com/archives/libguestfs/2022-January/thread.html#00213

Hi Rich, the link doesn't work; can you please summarize, or provide a new link? Thanks!

Comment 5 Richard W.M. Jones 2022-04-19 14:11:53 UTC
I *think* it's this thread:

https://listman.redhat.com/archives/libguestfs/2022-January/027901.html

We can create a compressed qcow2 server and write to it using:

$ qemu-nbd --image-opts driver=compress,file.driver=qcow2,file.file.driver=file,file.file.filename=new.qcow2

qemu-nbd (correctly) advertises and requires you to write in whole cluster-size
(IIRC?) blocks because of the way that cluster-level qcow2 compression works.
nbdcopy however ignores this size requirement, and fixing that is hard work.

Comment 7 Richard W.M. Jones 2022-05-19 07:43:20 UTC
Putting this on the backlog as it's non-trivial to fix.

Comment 8 Richard W.M. Jones 2022-07-01 11:03:13 UTC
Patch posted:
https://listman.redhat.com/archives/libguestfs/2022-July/029390.html

Note this will require an updated libnbd, hence make this bug depend on
bug 2059288.

Comment 10 Vera 2022-07-15 06:43:04 UTC
Verified with the versions:
qemu-guest-agent-7.0.0-8.el9.x86_64
libnbd-1.12.5-1.el9.x86_64
virt-v2v-2.0.7-1.el9.x86_64

Steps:
1. Convert a VM via virt-v2v with -oo compressed option.
# virsh list --all |grep rhel9.1
 -    esx7.0-rhel9.1-x86_64                      shut off

#  virt-v2v -i libvirt -ic qemu:///system esx7.0-rhel9.1-x86_64   -o libvirt -os default -oo compressed -on  esx7.0-rhel9.1-x86_64-compress -of qcow2
[   0.0] Setting up the source: -ic qemu:///system -i libvirt esx7.0-rhel9.1-x86_64
[   1.2] Opening the source
[   5.7] Inspecting the source
[  12.8] Checking for sufficient free disk space in the guest
[  12.8] Converting Red Hat Enterprise Linux 9.1 Beta (Plow) to run on KVM
virt-v2v: This guest has virtio drivers installed.
[ 119.4] Mapping filesystem data to avoid copying unused and blank areas
[ 120.7] Closing the overlay
[ 121.0] Assigning disks to buses
[ 121.0] Checking if the guest needs BIOS or UEFI to boot
[ 121.0] Setting up the destination: -o libvirt -os default
[ 122.2] Copying disk 1/1
█ 100% [****************************************]
[ 195.0] Creating output metadata
[ 195.0] Finishing off

2. Check compressed VM and start VM to check the checkpoints.

# virsh list --all |grep rhel9.1
 7    esx7.0-rhel9.1-x86_64-compress             running
 -    esx7.0-rhel9.1-x86_64                      shut off



rjones, I also tried on the VM with nvme-disk that was converted from ESXi. But it failed to start due to CPU incompatible.

# virsh list --all |grep nvme
 -    esx6.7-rhel8.6-nvme-disk                   shut off

# virt-v2v -i libvirt -ic qemu:///system esx6.7-rhel8.6-nvme-disk  -o libvirt -os default -oo compressed -on  esx6.7-rhel8.6-nvme-disk-compress -of qcow2
[   0.2] Setting up the source: -ic qemu:///system -i libvirt esx6.7-rhel8.6-nvme-disk
[   1.3] Opening the source
[   5.8] Inspecting the source
[  15.2] Checking for sufficient free disk space in the guest
[  15.2] Converting Red Hat Enterprise Linux 8.6 Beta (Ootpa) to run on KVM
virt-v2v: This guest has virtio drivers installed.
[ 122.1] Mapping filesystem data to avoid copying unused and blank areas
[ 123.7] Closing the overlay
[ 124.0] Assigning disks to buses
[ 124.0] Checking if the guest needs BIOS or UEFI to boot
[ 124.0] Setting up the destination: -o libvirt -os default
[ 125.2] Copying disk 1/1
█ 100% [****************************************]
[ 221.4] Creating output metadata
[ 221.4] Finishing off

# virsh list --all |grep nvme
 -    esx6.7-rhel8.6-nvme-disk                   shut off
 -    esx6.7-rhel8.6-nvme-disk-compress          shut off

# virsh start esx6.7-rhel8.6-nvme-disk-compress
error: Failed to start domain 'esx6.7-rhel8.6-nvme-disk-compress'
error: the CPU is incompatible with host CPU: Host CPU does not provide required features: svm


The diff of dumpxml between original and compressed one:

  <cpu mode='custom' match='exact' check='none'>
    <model fallback='forbid'>qemu64</model>
  </cpu>
......

  <cpu mode='custom' match='minimum' check='partial'>
    <model fallback='allow'>qemu64</model>
  </cpu>


Do I need to file a new bug against this issue?

Comment 11 Laszlo Ersek 2022-07-15 08:36:59 UTC
Hi Vera,

(In reply to Vera from comment #10)
> rjones, I also tried on the VM with nvme-disk that was converted from ESXi.
> But it failed to start due to CPU incompatible.
> 
> # virsh list --all |grep nvme
>  -    esx6.7-rhel8.6-nvme-disk                   shut off
> 
> # virt-v2v -i libvirt -ic qemu:///system esx6.7-rhel8.6-nvme-disk  -o
> libvirt -os default -oo compressed -on  esx6.7-rhel8.6-nvme-disk-compress
> -of qcow2
> [   0.2] Setting up the source: -ic qemu:///system -i libvirt
> esx6.7-rhel8.6-nvme-disk
> [   1.3] Opening the source
> [   5.8] Inspecting the source
> [  15.2] Checking for sufficient free disk space in the guest
> [  15.2] Converting Red Hat Enterprise Linux 8.6 Beta (Ootpa) to run on KVM
> virt-v2v: This guest has virtio drivers installed.
> [ 122.1] Mapping filesystem data to avoid copying unused and blank areas
> [ 123.7] Closing the overlay
> [ 124.0] Assigning disks to buses
> [ 124.0] Checking if the guest needs BIOS or UEFI to boot
> [ 124.0] Setting up the destination: -o libvirt -os default
> [ 125.2] Copying disk 1/1
> █ 100% [****************************************]
> [ 221.4] Creating output metadata
> [ 221.4] Finishing off
> 
> # virsh list --all |grep nvme
>  -    esx6.7-rhel8.6-nvme-disk                   shut off
>  -    esx6.7-rhel8.6-nvme-disk-compress          shut off
> 
> # virsh start esx6.7-rhel8.6-nvme-disk-compress
> error: Failed to start domain 'esx6.7-rhel8.6-nvme-disk-compress'
> error: the CPU is incompatible with host CPU: Host CPU does not provide
> required features: svm
> 
> 
> The diff of dumpxml between original and compressed one:
> 
>   <cpu mode='custom' match='exact' check='none'>
>     <model fallback='forbid'>qemu64</model>
>   </cpu>
> ......
> 
>   <cpu mode='custom' match='minimum' check='partial'>
>     <model fallback='allow'>qemu64</model>
>   </cpu>
> 
> 
> Do I need to file a new bug against this issue?

The CPU model question in virt-v2v is complicated. Recently we've had a related bug: BZ 2076013. Maybe we should extend the logic we added there.

The idea is that the "qemu64" CPU model is basically never right. For bug 2076013, we made a very surgical change -- we override it for RHEL9 guests only. Perhaps we should make the coverage more extensive (in this case, the guest is a RHEL8 OS). The comparison is tricky because here the problem is not *guest-OS* dependent.

I think that filing a new BZ would be useful. We should investigate there what the original <cpu> and the converted <cpu> elements mean precisely.

In case you file a new bug, please also include the output of "virsh capabilities" there, executed on the host in question.

Anyway I defer to Rich on whether we need a new bug for this. I don't think that we absolutely need to investigate this, as I'd never expect libvirt-to-libvirt conversion to be used in production.

Comment 12 Vera 2022-07-15 09:39:40 UTC
(In reply to Laszlo Ersek from comment #11)
> Hi Vera,
> 
> (In reply to Vera from comment #10)
> 
> The CPU model question in virt-v2v is complicated. Recently we've had a
> related bug: BZ 2076013. Maybe we should extend the logic we added there.
> 
> The idea is that the "qemu64" CPU model is basically never right. For bug
> 2076013, we made a very surgical change -- we override it for RHEL9 guests
> only. Perhaps we should make the coverage more extensive (in this case, the
> guest is a RHEL8 OS). The comparison is tricky because here the problem is
> not *guest-OS* dependent.
> 
> I think that filing a new BZ would be useful. We should investigate there
> what the original <cpu> and the converted <cpu> elements mean precisely.
> 
> In case you file a new bug, please also include the output of "virsh
> capabilities" there, executed on the host in question.
> 
> Anyway I defer to Rich on whether we need a new bug for this. I don't think
> that we absolutely need to investigate this, as I'd never expect
> libvirt-to-libvirt conversion to be used in production.

Thanks Laszlo. I just file a new bug Bug 2107503 against this issue.

And this bug will be marked as Verified if you can investigate on that new bug.

Comment 15 Vera 2022-08-03 11:14:29 UTC
Verified with the versions:
libguestfs-1.48.4-1.el9.x86_64
qemu-kvm-7.0.0-9.el9.x86_64
virt-v2v-2.0.7-4.el9.x86_64
libvirt-8.5.0-4.el9.x86_64

steps:
1. Convert ESX VM via virt-v2v with -oo compressed option to libvirt.

# virt-v2v -ic vpx://root.73.141/data/10.73.75.219/?no_verify=1  -it vddk -io vddk-libdir=/home/vddk7.0.3 -io vddk-thumbprint=1F:97:34:5F:B6:C2:BA:66:46:CB:1A:71:76:7D:6B:50:1E:03:00:EA  -ip /v2v-ops/esxpw esx6.7-rhel9.0-x86_64 -oo compressed -of qcow2
[   0.0] Setting up the source: -i libvirt -ic vpx://root.73.141/data/10.73.75.219/?no_verify=1 -it vddk esx6.7-rhel9.0-x86_64
[   1.9] Opening the source
[   7.2] Inspecting the source
[  13.4] Checking for sufficient free disk space in the guest
[  13.4] Converting Red Hat Enterprise Linux 9.0 Beta (Plow) to run on KVM
virt-v2v: The QEMU Guest Agent will be installed for this guest at first 
boot.
virt-v2v: This guest has virtio drivers installed.
[ 123.2] Mapping filesystem data to avoid copying unused and blank areas
[ 124.2] Closing the overlay
[ 124.4] Assigning disks to buses
[ 124.4] Checking if the guest needs BIOS or UEFI to boot
[ 124.4] Setting up the destination: -o libvirt
[ 126.1] Copying disk 1/1
█ 100% [****************************************]
[ 311.2] Creating output metadata
[ 311.2] Finishing off

2. Check compressed VM and start VM to check the checkpoints.

# virsh start esx6.7-rhel9.0-x86_64
Domain 'esx6.7-rhel9.0-x86_64' started

# virsh list |grep rhel9.0
 18   esx6.7-rhel9.0-x86_64   running

Moving to Verified.

Comment 16 Richard W.M. Jones 2022-08-03 11:32:12 UTC
It might be an idea to check that the output is really compressed.
You can do this using:

qemu-img check output.qcow2

(The output file should be in libvirt's default pool, probably
in /var/lib/libvirt/images/ )

For a compressed file you will see something like:

$ qemu-img check fedora-35.qcow2 
No errors were found on the image.
17518/98304 = 17.82% allocated, 78.74% fragmented, 73.75% compressed clusters
                                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^

For an uncompressed file you will see something like:

$ qemu-img check fedora-35.qcow2 
No errors were found on the image.
17518/98304 = 17.82% allocated, 0.00% fragmented, 0.00% compressed clusters
                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^

We expect that the number of compressed clusters will be larger than 0%
(exactly how big depends on the source guest).

Note that as guests as being used, the number of compressed clusters
is expected to decline.  This is because qemu cannot create new compressed
clusters for running guests.

Comment 17 Vera 2022-08-04 07:27:06 UTC
As rjones suggested, adding steps to check the compressed option really works.

Step3: check the number of compressed clusters.
# qemu-img check esx6.7-rhel9.0-x86_64-sda
No errors were found on the image.
73366/262144 = 27.99% allocated, 82.51% fragmented, 75.60% compressed clusters
Image end offset: 2799435776


Also tried on the one without -oo compressed:
# qemu-img check rhel9-luks-sda 
No errors were found on the image.
35888/163840 = 21.90% allocated, 16.02% fragmented, 0.00% compressed clusters
Image end offset: 2353594368

Comment 18 Richard W.M. Jones 2022-08-04 07:48:58 UTC
Looks good, thanks for testing this.

Comment 20 errata-xmlrpc 2022-11-15 09:55:51 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 (Low: virt-v2v security, bug fix, and enhancement update), 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/RHSA-2022:7968


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