Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 2044911

Summary: virt-p2v conversion hangs with RHEL9 virt-v2v
Product: Red Hat Enterprise Linux 9 Reporter: tingting zheng <tzheng>
Component: virt-v2vAssignee: Virtualization Maintenance <virt-maint>
Status: CLOSED ERRATA QA Contact: tingting zheng <tzheng>
Severity: medium Docs Contact:
Priority: medium    
Version: 9.0CC: juzhou, lersek, mxie, rjones, tyan, tzheng, vwu, xiaodwan
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: virt-v2v-1.45.97-3.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-05-17 13:42:09 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description tingting zheng 2022-01-25 10:46:58 UTC
Description of problem:
RHEL 7 virt-p2v conversion hangs with RHEL9 virt-v2v.

Version-Release number of selected component (if applicable):
Virt-p2v-1.40.2-1.el7.iso
libvirt-8.0.0-1.el9.x86_64
libguestfs-1.46.1-2.el9.x86_64
qemu-kvm-6.2.0-4.el9.x86_64
virt-v2v-1.45.97-2.el9.x86_64
virtio-win-1.9.19-5.el9_b.noarch
nbdkit-1.28.4-2.el9.x86_64
libnbd-1.10.3-1.el9.x86_64


How reproducible:
100%

Steps to Reproduce:
1.Launch RHEL7 virt-p2v client, connect to RHEL9 server.
2.Use virt-p2v to convert.

Actual results:
The conversion hangs after coping disk.

Expected results:
The conversion can be finished successfully.

Additional info:
logs:http://fileshare.englab.nay.redhat.com/pub/section3/libvirtmanual/tzheng/virt-p2v-20220124-6e0cxsb6/

Comment 1 tingting zheng 2022-01-25 10:49:26 UTC
Comments from Richard.
Looking at the log and referring to:

https://libguestfs.org/virt-p2v.1.html#how-virt-p2v-works

we can see that port 34337 is set up as the ssh reverse forwarding
port (ie. on localhost from the point of view of virt-v2v, connected
to qemu-nbd on the virt-p2v host).

We successfully set up nbdkit-nbd-plugin to forward in0 to this port.
(This is different from how old virt-v2v worked - it would have
created a qcow2 file backed by nbd:localhost:34337).

Everything seems to go fine during conversion.

However when we start copying we make several connections to in0 and I
suspect what is happening is that nbdkit-nbd-plugin makes several
connections to qemu-nbd.  However qemu-nbd only permits a single
connection by default and so the extra connections will deadlock.

We cannot change virt-p2v (because RHEL 7), but we can patch virt-v2v.
In this case nbdkit-nbd-plugin has a shared=true option which makes it
share a single connection to the proxied nbd server (ie. qemu-nbd).

So my guess is that the following patch will fix it:

diff --git a/input/input_libvirt.ml b/input/input_libvirt.ml
index 33f61086ec..42050c157b 100644
--- a/input/input_libvirt.ml
+++ b/input/input_libvirt.ml
@@ -76,6 +76,7 @@ and libvirt_servers dir disks =
          Nbdkit.add_filter cmd "cow";
          Nbdkit.add_arg cmd "hostname" hostname;
          Nbdkit.add_arg cmd "port" (string_of_int port);
+         Nbdkit.add_arg cmd "shared" "true";
          let _, pid = Nbdkit.run_unix ~socket cmd in

          (* --exit-with-parent should ensure nbdkit is cleaned

Comment 2 Richard W.M. Jones 2022-01-25 11:28:04 UTC
Patch posted:
https://listman.redhat.com/archives/libguestfs/2022-January/msg00167.html

Comment 3 Richard W.M. Jones 2022-01-25 11:31:52 UTC
Tingting tested this and confirmed the fix works.

Comment 4 tingting zheng 2022-01-25 12:29:24 UTC
Tested the build and set Verified:Tested for this bug.

Comment 5 Richard W.M. Jones 2022-01-26 13:00:57 UTC
Fixed upstream in:
https://github.com/libguestfs/virt-v2v/commit/20019b5cadc1434ac09842e2045a7d5635561835

Comment 8 tingting zheng 2022-01-27 07:20:08 UTC
Tested the bug with:
Virt-p2v-1.40.2-1.el7.iso
libguestfs-1.46.1-2.el9.x86_64
virt-v2v-1.45.97-3.el9.x86_64
nbdkit-1.28.5-1.el9.x86_64
libvirt-8.0.0-2.el9.x86_64
qemu-kvm-6.2.0-5.el9.x86_64

1.Launch RHEL7 virt-p2v client, connect to RHEL9 server.
2.Use virt-p2v to start conversion to local kvm and RHV, the conversion can be finished successfully.

Refer to the above comments, move the bug to VERIFIED.

Comment 10 errata-xmlrpc 2022-05-17 13:42:09 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: virt-v2v), 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/RHEA-2022:2566