Bug 1392228

Summary: libguestfs virt-v2v cannot find dracut when migrating fedora 23 or newer OVA
Product: Red Hat Enterprise Linux 7 Reporter: Derek Atkins <warlord>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: unspecified    
Version: 7.2CC: ptoscano, warlord
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-06 22:55:34 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:
Attachments:
Description Flags
Full log output of virt-v2v none

Description Derek Atkins 2016-11-06 14:35:14 UTC
Description of problem:

I was trying to migrate a Fedora-23 VM in OVA format into oVirt 4.0.4 on EL7.2 and received an error (see below).

This bug was reported on the libguestfs list in January, 2016 [0] and was apparently fixed upstream shortly thereafter [1].  However the version of libguestfs in 7.2 does not contain this almost-year-old fix

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

libguestfs-1.28.1-1.55.el7.centos.4.x86_64

How reproducible:

100%


Steps to Reproduce:
1. Get a Fedora-23 VM in OVA format
2. in the Ovirt console [Virtual Machines] -> Import
3. Select OVA and select the file
4. attempt the import
5. Look at the vdsm logs to see the error

Actual results:

Thread-88166::ERROR::2016-11-05 16:36:09,219::v2v::674::root::(_run) Job u'cdb1e
eb7-63f3-46e8-abd5-5292dcc8809a' failed
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/vdsm/v2v.py", line 669, in _run
    self._import()
  File "/usr/lib/python2.7/site-packages/vdsm/v2v.py", line 696, in _import
    self._proc.stderr.read(1024)))
V2VProcessError: Job u'cdb1eeb7-63f3-46e8-abd5-5292dcc8809a' process failed exit
-code: 1, stderr: virt-v2v: error: unable to rebuild initrd 
(/boot/initramfs-4.2.6-301.fc23.x86_64.img) because mkinitrd or dracut was 
not found in the guest

If reporting bugs, run virt-v2v with debugging enabled and include the 
complete output:

  virt-v2v -v -x [...]


Expected results:

Fedora 23 (and 24) VMs should import.

Additional info:

[0] https://www.redhat.com/archives/libguestfs/2016-January/msg00138.html
[1] https://github.com/libguestfs/libguestfs/commit/569ad259b4726fbdabf380bdca34da00ca262e1e

This was apparently fixed in libguestfs 1.33.7 on January 28, 2016 (if I'm reading the github page correctly).  Could this patch be backported to 7.2?

Comment 1 Richard W.M. Jones 2016-11-06 19:04:14 UTC
Can you run virt-v2v with the -v -x options?  It should be
sufficient to do:

  virt-v2v -v -x -i ova fedora.ova -o null

Capture the complete output and attach it to this bug.

Comment 2 Derek Atkins 2016-11-06 21:45:18 UTC
Hi,

I'm trying but it's failing on an authentication error.  Running the virt-v2v command as root as you suggest and I get:

[snip]
libguestfs: [00000ms] connect to libvirt
libguestfs: opening libvirt handle: URI = qemu:///system, auth = default+wrapper, flags = 0
libvirt needs authentication to connect to libvirt URI qemu:///system
(see also: http://libvirt.org/auth.html http://libvirt.org/uri.html)
Please enter your authentication name: admin@internal
Please enter your password: 
libvirt: XML-RPC error : authentication failed: authentication failed
libguestfs: trace: launch = -1 (error)
virt-v2v: error: libguestfs error: could not connect to libvirt (URI = 
qemu:///system): authentication failed: authentication failed [code=45 
domain=7]

If reporting bugs, run virt-v2v with debugging enabled and include the 
complete output:

  virt-v2v -v -x [...]
libguestfs: trace: close
libguestfs: closing guestfs handle 0x21df660 (state 0)
libguestfs: command: run: rm
libguestfs: command: run: \ -rf /tmp/libguestfsGjKsKJ


I've tried admin, admin@internal, and 'root', but nothing has been accepted.  I'm not sure what authentication credentials it's looking for?

Comment 3 Derek Atkins 2016-11-06 22:49:32 UTC
After searching a bit I determined the issue is the virt-v2v backend.  If I set it to "direct" then I get past this authentication issue .. but it doesn't like the target, -o null, complaining about the output format.  So I added -of raw, resulting in:

LIBGUESTFS_BACKEND=direct virt-v2v -v -x -i ova file.ova -of raw -o null

This "succeeded" in getting me a complete run, but of course it still complains that it cannot find dracut:

libguestfs: trace: is_file = 0
virt-v2v: error: unable to rebuild initrd 
(/boot/initramfs-4.2.6-301.fc23.x86_64.img) because mkinitrd or dracut was 
not found in the guest

If reporting bugs, run virt-v2v with debugging enabled and include the 
complete output:

  virt-v2v -v -x [...]

See the full log (which I'll attach shortly)

Comment 4 Derek Atkins 2016-11-06 22:50:30 UTC
Created attachment 1217837 [details]
Full log output of virt-v2v

Here's the log I got (see my previous comment)

Comment 5 Richard W.M. Jones 2016-11-06 22:55:34 UTC
So this is indeed fixed by the following upstream commit:

https://github.com/libguestfs/libguestfs/commit/569ad259b4726fbdabf380bdca34da00ca262e1e

commit 569ad259b4726fbdabf380bdca34da00ca262e1e
Author: Richard W.M. Jones <rjones>
Date:   Thu Jan 28 13:55:20 2016 +0000

    v2v: linux: Find dracut if it is located in /usr/bin.
    
    In Fedora 23, dracut moved to /usr/bin.  However we only looked for
    /sbin/dracut, so we didn't find it.  You would have seen a failure
    like this:
    
      virt-v2v: error: unable to rebuild initrd
      (/boot/initramfs-4.2.3-300.fc23.x86_64.img) because mkinitrd or dracut was
      not found in the guest
    
    Look for dracut in /usr/bin as well.
    
    Thanks: Arnaud Bougeard.


... as indeed you noted in the description.

I suggest trying the RHEL 7.3 version which should contain this fix.

https://people.redhat.com/~rjones/libguestfs-RHEL-7.3-preview/

Comment 6 Derek Atkins 2016-11-07 01:14:52 UTC
Thanks.  I can confirm that once I updated the packages from your repo the command-line virt-v2v succeeds.  Of course, I suspect I'll need to restart oVirt on this host, now....