Bug 1260753

Summary: 'virsh domcapabilities' fails for ppc64le
Product: Red Hat Enterprise Linux 7 Reporter: Andrea Bolognani <abologna>
Component: libvirtAssignee: Andrea Bolognani <abologna>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.2CC: abologna, dgibson, dyuan, dzheng, gsun, hannsj_uhl, jsuchane, knoel, mzhan, rbalakri, tlavigne
Target Milestone: rc   
Target Release: ---   
Hardware: ppc64le   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-1.2.17-10.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 06:52:55 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:
Bug Depends On:    
Bug Blocks: 1201513, 1277183, 1277184    

Description Andrea Bolognani 2015-09-07 15:41:26 UTC
Running plain 'virsh domcapabilities' results in an error:

  $ sudo virsh domcapabilities
    error: failed to get emulator capabilities
    error: invalid argument: unable to find any emulator to \
    serve 'ppc64le' architecture

This is similar to Bug 1210159. Basically, the QEMU capabilities
cache does contain an entry associating the ppc64 architecture to
the /usr/libexec/qemu-kvm binary, but no such association exist
for the ppc64le architecture.

The same happens when running 'virsh domcapabilities --arch ppc64le'
on an x86_64 host with the qemu-system-ppc package installed.

  libvirt-daemon-1.2.17-7.el7.ppc64le
  qemu-kvm-rhev-2.3.0-22.el7.ppc64le

Comment 2 Dan Zheng 2015-09-10 06:06:22 UTC
Reproduced using below packages already.
  libvirt-daemon-1.2.17-7.el7.ppc64le
  qemu-kvm-rhev-2.3.0-22.el7.ppc64le

Comment 3 Dan Zheng 2015-09-10 07:03:37 UTC
--virttype,--arch, --machine  options also fail with same error.

# virsh domcapabilities --virttype kvm
error: failed to get emulator capabilities
error: invalid argument: unable to find any emulator to serve 'ppc64le' architecture

# virsh domcapabilities --arch ppc64le
Same error as above.
# virsh domcapabilities --machine pseries-rhel7.2.0
Same error as above.

Comment 4 Andrea Bolognani 2015-09-15 11:55:57 UTC
I've proposed a patch upstream.

https://www.redhat.com/archives/libvir-list/2015-September/msg00471.html

Comment 5 Andrea Bolognani 2015-09-16 08:34:47 UTC
The issue has been fixed upstream.

commit eb36666d22d52ecf0a1755dd0a8a45de982e00fb
Author: Andrea Bolognani <abologna>
Date:   Tue Sep 15 15:58:09 2015 +0200

    qemu: Fix using guest architecture as lookup key
    
    When looking for a QEMU binary suitable for running ppc64le guests
    we have to take into account the fact that we use the QEMU target
    as key for the hash, so direct comparison is not good enough.
    
    Factor out the logic from virQEMUCapsFindBinaryForArch() to a new
    virQEMUCapsFindTarget() function and use that both when looking
    for QEMU binaries available on the system and when looking up
    QEMU capabilities later.
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1260753

v1.2.19-62-geb36666

Comment 8 Dan Zheng 2015-09-17 01:47:55 UTC
Test on packages below:
kernel-3.10.0-316.el7.ppc64le
qemu-kvm-rhev-2.3.0-23.el7.ppc64le
libvirt-1.2.17-8.el7+abologna+bz1260753.ppc64le

Below commands are executed:
All pass.

# virsh domcapabilities 
<domainCapabilities>
  <path>/usr/libexec/qemu-kvm</path>
  <domain>qemu</domain>
  <machine>pseries-rhel7.2.0</machine>
  <arch>ppc64le</arch>
  <vcpu max='255'/>
  <os supported='yes'>
    <loader supported='yes'>
      <enum name='type'>
        <value>rom</value>
        <value>pflash</value>
      </enum>
      <enum name='readonly'>
        <value>yes</value>
        <value>no</value>
      </enum>
    </loader>
  </os>
  <devices>
    <disk supported='yes'>
      <enum name='diskDevice'>
        <value>disk</value>
        <value>cdrom</value>
        <value>floppy</value>
        <value>lun</value>
      </enum>
      <enum name='bus'>
        <value>ide</value>
        <value>fdc</value>
        <value>scsi</value>
        <value>virtio</value>
        <value>usb</value>
      </enum>
    </disk>
    <hostdev supported='yes'>
      <enum name='mode'>
        <value>subsystem</value>
      </enum>
      <enum name='startupPolicy'>
        <value>default</value>
        <value>mandatory</value>
        <value>requisite</value>
        <value>optional</value>
      </enum>
      <enum name='subsysType'>
        <value>usb</value>
        <value>pci</value>
        <value>scsi</value>
      </enum>
      <enum name='capsType'/>
      <enum name='pciBackend'>
        <value>default</value>
        <value>vfio</value>
      </enum>
    </hostdev>
  </devices>
</domainCapabilities>

# virsh domcapabilities --virttype kvm	
# virsh domcapabilities	--emulatorbin /usr/libexec/qemu-kvm
# virsh domcapabilities --arch ppc64le	
# virsh domcapabilities --machine pseries-rhel7.2.0	

The above four commands' results are same with above output.

# virsh domcapabilities --emulatorbin /usr/libexec/qemu-kvm --arch ppc	    
  <path>/usr/libexec/qemu-kvm</path>
  <domain>qemu</domain>
  <machine>pseries-rhel7.2.0</machine>
  <arch>ppc</arch>

# virsh domcapabilities --emulatorbin /usr/libexec/qemu-kvm --arch ppcle	  
  <path>/usr/libexec/qemu-kvm</path>
  <domain>qemu</domain>
  <machine>pseries-rhel7.2.0</machine>
  <arch>ppcle</arch>

# virsh domcapabilities --emulatorbin /usr/libexec/qemu-kvm --arch ppc64le	 
  <path>/usr/libexec/qemu-kvm</path>
  <domain>qemu</domain>
  <machine>pseries-rhel7.2.0</machine>
  <arch>ppc64le</arch>

# virsh domcapabilities --emulatorbin /usr/libexec/qemu-kvm --arch ppc64	  
  <path>/usr/libexec/qemu-kvm</path>
  <domain>qemu</domain>
  <machine>pseries-rhel7.2.0</machine>
  <arch>ppc64</arch>
# virsh domcapabilities --emulatorbin /usr/libexec/qemu-kvm --arch ppcemb
  <machine>pseries-rhel7.2.0</machine>
  <arch>ppcemb</arch>

Comment 13 Dan Zheng 2015-09-24 01:42:02 UTC
Test on packages below:
kernel-3.10.0-316.el7.ppc64le
qemu-kvm-rhev-2.3.0-25.el7.ppc64le
libvirt-1.2.17-10.el7.ppc64le
Guest :Kernel 3.10.0-316.el7.ppc64le

Below commands are executed:
All pass.


# virsh domcapabilities
<domainCapabilities>
  <path>/usr/libexec/qemu-kvm</path>
  <domain>qemu</domain>
  <machine>pseries-rhel7.2.0</machine>
  <arch>ppc64le</arch>
  <vcpu max='255'/>
  <os supported='yes'>
    <loader supported='yes'>
      <enum name='type'>
        <value>rom</value>
        <value>pflash</value>
      </enum>
      <enum name='readonly'>
        <value>yes</value>
        <value>no</value>
      </enum>
    </loader>
  </os>
  <devices>
    <disk supported='yes'>
      <enum name='diskDevice'>
        <value>disk</value>
        <value>cdrom</value>
        <value>floppy</value>
        <value>lun</value>
      </enum>
      <enum name='bus'>
        <value>ide</value>
        <value>fdc</value>
        <value>scsi</value>
        <value>virtio</value>
        <value>usb</value>
      </enum>
    </disk>
    <hostdev supported='yes'>
      <enum name='mode'>
        <value>subsystem</value>
      </enum>
      <enum name='startupPolicy'>
        <value>default</value>
        <value>mandatory</value>
        <value>requisite</value>
        <value>optional</value>
      </enum>
      <enum name='subsysType'>
        <value>usb</value>
        <value>pci</value>
        <value>scsi</value>
      </enum>
      <enum name='capsType'/>
      <enum name='pciBackend'>
        <value>default</value>
        <value>vfio</value>
      </enum>
    </hostdev>
  </devices>
</domainCapabilities>


# virsh domcapabilities --virttype kvm	
# virsh domcapabilities --emulatorbin /usr/libexec/qemu-kvm
# virsh domcapabilities --arch ppc64le	
# virsh domcapabilities --machine pseries-rhel7.2.0	
om
The above four commands' results are same with above output.

# virsh domcapabilities --emulatorbin /usr/libexec/qemu-kvm --arch ppc	    
  <path>/usr/libexec/qemu-kvm</path>
  <domain>qemu</domain>
  <machine>pseries-rhel7.2.0</machine>
  <arch>ppc</arch>

# virsh domcapabilities --emulatorbin /usr/libexec/qemu-kvm --arch ppcle	  
  <path>/usr/libexec/qemu-kvm</path>
  <domain>qemu</domain>
  <machine>pseries-rhel7.2.0</machine>
  <arch>ppcle</arch>

# virsh domcapabilities --emulatorbin /usr/libexec/qemu-kvm --arch ppc64le	 
  <path>/usr/libexec/qemu-kvm</path>
  <domain>qemu</domain>
  <machine>pseries-rhel7.2.0</machine>
  <arch>ppc64le</arch>

# virsh domcapabilities --emulatorbin /usr/libexec/qemu-kvm --arch ppc64	  
  <path>/usr/libexec/qemu-kvm</path>
  <domain>qemu</domain>
  <machine>pseries-rhel7.2.0</machine>
  <arch>ppc64</arch>

# virsh domcapabilities --emulatorbin /usr/libexec/qemu-kvm --arch ppcemb
  <machine>pseries-rhel7.2.0</machine>
  <arch>ppcemb</arch>

Comment 15 errata-xmlrpc 2015-11-19 06:52:55 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-2202.html