Bug 1177910

Summary: Libguestfs fails to locate the qemu-kvm on POWER8(BE) host.
Product: Red Hat Enterprise Linux 7 Reporter: Hu Zhang <huzhan>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: medium    
Version: 7.1CC: leiwang, mbooth, ptoscano, rjones, wshi, yselkowi
Target Milestone: rc   
Target Release: ---   
Hardware: ppc64   
OS: Unspecified   
Whiteboard:
Fixed In Version: libguestfs-1.28.1-1.46.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 06:59:22 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 Hu Zhang 2014-12-31 09:31:58 UTC
Description of problem:
Libguestfs fails to locate the qemu-kvm on POWER8(BE) host. The qemu-kvm is located in /usr/libexec/qemu-kvm. However libguestfs directs to /usr/bin/qemu-system-ppc64. After add a symbolic link, it works well.

Version-Release number of selected component (if applicable):
libguestfs-1.28.1-1.15.el7.ppc64
qemu-kvm-rhev-2.1.2-14.el7.ppc64


How reproducible:
always

Steps to reproduce:
1. Prepare the libguestfs environment on a PPC64(BE) machine.
2. Connect to a guest image in guestfish.
        [host]# guestfish
        ><fs> set-trace 1
        ><fs> set-verbose 1
        ><fs> add &PathtoUsableImage
        ><fs> run
   Then it throws an error:
libguestfs: trace: launch
libguestfs: trace: version
libguestfs: trace: version = <struct guestfs_version *>
libguestfs: trace: get_backend
libguestfs: trace: get_backend = "direct"
libguestfs: launch: program=guestfish
libguestfs: launch: version=1.28.1rhel=7,release=1.15.el7,libvirt
libguestfs: launch: backend registered: unix
libguestfs: launch: backend registered: uml
libguestfs: launch: backend registered: libvirt
libguestfs: launch: backend registered: direct
libguestfs: launch: backend=direct
libguestfs: launch: tmpdir=/tmp/libguestfsBhPknh
libguestfs: launch: umask=0022
libguestfs: launch: euid=0
libguestfs: trace: get_backend_setting "force_tcg"
libguestfs: trace: get_backend_setting = NULL (error)
libguestfs: trace: get_cachedir
libguestfs: trace: get_cachedir = "/var/tmp"
libguestfs: [00000ms] begin building supermin appliance
libguestfs: [00000ms] run supermin
libguestfs: command: run: /usr/bin/supermin5
libguestfs: command: run: \ --build
libguestfs: command: run: \ --verbose
libguestfs: command: run: \ --if-newer
libguestfs: command: run: \ --lock /var/tmp/.guestfs-0/lock
libguestfs: command: run: \ --copy-kernel
libguestfs: command: run: \ -f ext2
libguestfs: command: run: \ --host-cpu powerpc64
libguestfs: command: run: \ /usr/lib64/guestfs/supermin.d
libguestfs: command: run: \ -o /var/tmp/.guestfs-0/appliance.d
supermin: version: 5.1.10
supermin: rpm: detected RPM version 4.11
supermin: package handler: fedora/rpm
supermin: acquiring lock on /var/tmp/.guestfs-0/lock
supermin: if-newer: output does not need rebuilding
libguestfs: [00007ms] finished building supermin appliance
libguestfs: [00007ms] begin testing qemu features
libguestfs: [00008ms] finished testing qemu features
libguestfs: trace: get_backend_setting "gdb"
libguestfs: trace: get_backend_setting = NULL (error)
libguestfs: command: run: /usr/bin/qemu-system-ppc64
libguestfs: command: run: \ -display none
libguestfs: command: run: \ -help
/usr/bin/qemu-system-ppc64: No such file or directory
libguestfs: error: /usr/bin/qemu-system-ppc64 exited with error status 1, see debug messages above
libguestfs: command: run: /usr/bin/qemu-system-ppc64
libguestfs: command: run: \ -display none
libguestfs: command: run: \ -help
/usr/bin/qemu-system-ppc64: No such file or directory
libguestfs: error: /usr/bin/qemu-system-ppc64 exited with error status 1, see debug messages above
[00010ms] /usr/bin/qemu-system-ppc64 \
    -display none \
    -M pseries \
    -cpu host \
    -m 768 \
    -no-reboot \
    -rtc driftfix=slew \
    -no-kvm-pit-reinjection \
    -kernel /var/tmp/.guestfs-0/appliance.d/kernel \
    -initrd /var/tmp/.guestfs-0/appliance.d/initrd \
    -drive file=/home/huzhan/rhel7-ppc64le.qcow2,cache=writeback,id=hd0,if=none \
    -device virtio-blk-pci,drive=hd0 \
    -drive file=/var/tmp/.guestfs-0/appliance.d/root,snapshot=on,id=appliance,cache=unsafe,if=none \
    -device virtio-blk-pci,drive=appliance \
    -device virtio-serial-pci \
    -serial stdio \
    -device sga \
    -chardev socket,path=/tmp/libguestfsBhPknh/guestfsd.sock,id=channel0 \
    -device virtserialport,chardev=channel0,name=org.libguestfs.channel.0 \
    -append 'panic=1 console=hvc0 console=ttyS0 udevtimeout=6000 udev.event-timeout=6000 no_timer_check acpi=off printk.time=1 cgroup_disable=memory root=/dev/vdb selinux=0 guestfs_verbose=1 TERM=xterm-256color'
/usr/bin/qemu-system-ppc64: No such file or directory
libguestfs: error: guestfs_launch failed, see earlier error messages
libguestfs: trace: launch = -1 (error)

3. Create a symbolic and execute "run" again in guestfish.
    [host]# ln -s /usr/libexec/qemu-kvm /usr/bin/qemu-system-ppc64
    ><fs> run
    No error pops up.

Actual results:
In step 2: failed to run the added guest image in guestfish. It throws out an error:
/usr/bin/qemu-system-ppc64: No such file or directory
libguestfs: error: /usr/bin/qemu-system-ppc64 exited with error status 1, see debug messages above

Expected results:
On ppc64, libguestfs should direct qemu-kvm to /usr/libexec/qemu-kvm rather than /usr/bin/qemu-system-ppc64.


Additional info:

Comment 2 Pino Toscano 2015-01-06 09:41:19 UTC
(In reply to Hu Zhang from comment #0)
> After add a symbolic link, it works well.

Side note: you don't need to manually create symlinks, just set the environment variable
  QEMU_HV=/usr/libexec/qemu-kvm
so libguestfs uses that as hypervisor.

Comment 3 Pino Toscano 2015-01-06 10:24:02 UTC
(In reply to Pino Toscano from comment #2)
> (In reply to Hu Zhang from comment #0)
> > After add a symbolic link, it works well.
> 
> Side note: you don't need to manually create symlinks, just set the
> environment variable
>   QEMU_HV=/usr/libexec/qemu-kvm
> so libguestfs uses that as hypervisor.

Sorry, the right environment variable name is:
  LIBGUESTFS_HV=/usr/libexec/qemu-kvm
(thanks Rich for the notice)

Sometimes doing two things at once is not a good idea...

Comment 5 Richard W.M. Jones 2015-01-19 08:18:49 UTC
Yes, it looks like that workaround was added for:

https://bugzilla.redhat.com/show_bug.cgi?id=1125575#c18

but this is wrong (and indeed I knew it was wrong when I added it).

I can drop that, assuming that bug 1125575 is fixed.

dev-acking this bug, but it's way too late for RHEL 7.1.

Comment 8 Richard W.M. Jones 2015-04-28 13:06:23 UTC
Actually this cannot be fixed until there is a qemu-kvm for ppc64
available.  It's not available in brew yet.

Comment 9 Richard W.M. Jones 2015-05-11 12:31:17 UTC
An update to this is that libvirt-daemon-kvm on ppc64 no longer
depends on qemu-kvm.

See:
http://post-office.corp.redhat.com/archives/rhvirt-patches/2015-May/thread.html#00171

I'm able to drop the first part of the workaround, but fundamentally
libguestfs still requires a qemu binary in brew in order to build and so
I cannot drop the second part of the workaround yet.

Comment 17 Richard W.M. Jones 2015-07-09 09:15:11 UTC
The following packages work for me, so I'm declaring this bug
as fixed:

libguestfs-1.28.1-1.46.el7.ppc64le
qemu-kvm-rhev-2.3.0-1.ael7b.ppc64le

Comment 18 Richard W.M. Jones 2015-07-09 09:16:16 UTC
Bleah, sorry, BIG endian, not little endian.  Do we really care
about big endian ppc64 machines any more ...?

Comment 19 Richard W.M. Jones 2015-07-09 12:31:53 UTC
On ppc64 (be) it's uninstallable with this error:

Error: Package: 1:virt-v2v-1.28.1-1.46.el7.ppc64 (libguestfs-RHEL-7.2-preview)
           Requires: qemu-kvm >= 1.5.3-92.el7
Error: Package: 1:libguestfs-1.28.1-1.46.el7.ppc64 (libguestfs-RHEL-7.2-preview)
           Requires: qemu-kvm-rhev

I was able to fix this by downloading and installing the qemu-kvm-rhev,
gperftools and SLOF packages directly from brew.

libguestfs-test-tool works (albeit without KVM).  So I'm going
to declare this bug as being fixed in:

libguestfs-1.28.1-1.46.el7.ppc64
qemu-kvm-rhev-2.3.0-9.el7.ppc64

Comment 21 Hu Zhang 2015-09-11 11:00:07 UTC
Verified with the packages:


Verify steps:
1. # libguestfs-test-tool
...
guestfsd: main_loop: proc 282 (internal_autosync) took 0.07 seconds
libguestfs: calling virDomainDestroy "guestfs-qtfxhz6pcnuwxgkw" flags=VIR_DOMAIN_DESTROY_GRACEFUL
libguestfs: closing guestfs handle 0x1002b3effd0 (state 0)
libguestfs: command: run: rm
libguestfs: command: run: \ -rf /tmp/libguestfsVbYFtN
===== TEST FINISHED OK =====

2. # yum remove libguestfs
...
Dependencies Resolved

==================================================================================================================
 Package                 Arch       Version                 Repository                                       Size
==================================================================================================================
Removing:
 libguestfs              ppc64      1:1.28.1-1.52.el7       @/libguestfs-1.28.1-1.52.el7.ppc64              3.8 M
Removing for dependencies:
 libguestfs-devel        ppc64      1:1.28.1-1.52.el7       @/libguestfs-devel-1.28.1-1.52.el7.ppc64        1.1 M
 libguestfs-tools-c      ppc64      1:1.28.1-1.52.el7       @/libguestfs-tools-c-1.28.1-1.52.el7.ppc64       13 M
 perl-Sys-Guestfs        ppc64      1:1.28.1-1.52.el7       @/perl-Sys-Guestfs-1.28.1-1.52.el7.ppc64        1.3 M
 virt-v2v                ppc64      1:1.28.1-1.52.el7       @/virt-v2v-1.28.1-1.52.el7.ppc64                 15 M

Transaction Summary
==================================================================================================================
Remove  1 Package (+4 Dependent packages)
...
Removed:
  libguestfs.ppc64 1:1.28.1-1.52.el7                                                                              

Dependency Removed:
  libguestfs-devel.ppc64 1:1.28.1-1.52.el7               libguestfs-tools-c.ppc64 1:1.28.1-1.52.el7              
  perl-Sys-Guestfs.ppc64 1:1.28.1-1.52.el7               virt-v2v.ppc64 1:1.28.1-1.52.el7                        

Complete!


So bug is verified.

Comment 22 Hu Zhang 2015-09-11 11:01:43 UTC
(In reply to Hu Zhang from comment #21)
> Verified with the packages:
libguestfs-1.28.1-1.52.el7.ppc64
qemu-kvm-rhev-2.3.0-22.el7.ppc64
> 
> 
> Verify steps:
> 1. # libguestfs-test-tool
> ...

Comment 24 errata-xmlrpc 2015-11-19 06:59:22 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, 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://rhn.redhat.com/errata/RHBA-2015-2183.html