qemu-kvm: virt-install VM fails due to inconsistent virsh capabilities output due to multiple qemu instance

Bug #1628101 reported by bugproxy
18
This bug affects 2 people
Affects Status Importance Assigned to Milestone
qemu (Debian)
Fix Released
Unknown
qemu (Ubuntu)
Won't Fix
Low
Taco Screen team

Bug Description

== Comment: #0 - Satheesh Rajendran <email address hidden> - 2016-09-26 07:12:52 ==
---Problem Description---
VM creation fails for wrong machine type from virt-install.

From the initial debugging it looks like pseries-2.7 is not listed as a supported machine type from qemu-system-ppc64 but the virsh capabilities lists as default, hence virt-install ended in choosing pseries-2.7 and qemu complains as unsupported type.

may be pseries-2.7 is renamed to pseries-yakkety? which needs a change in capabilities?

Contact Information = <email address hidden>

---uname output---
Linux ltc-test-ci1 4.8.0-17-generic #19-Ubuntu SMP Sun Sep 25 06:35:40 UTC 2016 ppc64le ppc64le ppc64le GNU/Linux

Machine Type = power 8 ppc64le

---Debugger---
A debugger is not configured

---Steps to Reproduce---
  /usr/bin/virt-install --connect=qemu:///system --hvm --accelerate --name 'vm1' --machine pseries --ram=1024 --vcpu=2 --import --os-variant linux --serial pty --disk path=/var/lib/libvirt/images/ubuntu-16.10-ppc64le.qcow2,bus=scsi,size=10,format=qcow2 --network=bridge=virbr0,model=spapr-vlan,mac=52:54:00:49:4a:4b --noautoconsole

Starting install...
ERROR internal error: process exited while connecting to monitor: 2016-09-26T10:58:22.312099Z qemu-system-ppc64: -enable-kvm: unsupported machine type
Use -machine help to list supported machines
Domain installation does not appear to have been successful.
If it was, you can restart your domain by running:
  virsh --connect qemu:///system start vm1
otherwise, please restart your installation.

#qemu-system-ppc64 -machine ?
Supported machines are:
bamboo bamboo
g3beige Heathrow based PowerMAC
mac99 Mac99 based PowerMAC
mpc8544ds mpc8544ds
none empty machine
ppce500 generic paravirt e500 platform
prep PowerPC PREP platform
pseries-2.1 pSeries Logical Partition (PAPR compliant)
pseries-2.2 pSeries Logical Partition (PAPR compliant)
pseries-2.3 pSeries Logical Partition (PAPR compliant)
pseries-2.4 pSeries Logical Partition (PAPR compliant)
pseries-2.5 pSeries Logical Partition (PAPR compliant)
pseries-2.6 pSeries Logical Partition (PAPR compliant)
pseries-xenial pSeries Logical Partition (PAPR compliant)
pseries pSeries Logical Partition (PAPR compliant) (alias of pseries-yakkety)
pseries-yakkety pSeries Logical Partition (PAPR compliant) (default)
ref405ep ref405ep
taihu taihu
virtex-ml507 Xilinx Virtex ML507 reference design

#virsh capabilities
....
....
 <guest>
    <os_type>hvm</os_type>
    <arch name='ppc64le'>
      <wordsize>64</wordsize>
      <emulator>/usr/bin/qemu-system-ppc64le</emulator>
      <machine maxCpus='255'>pseries-yakkety</machine>
      <machine canonical='pseries-yakkety' maxCpus='255'>pseries</machine>
      <machine maxCpus='1'>ref405ep</machine>
      <machine maxCpus='1'>virtex-ml507</machine>
      <machine maxCpus='32'>ppce500</machine>
      <machine maxCpus='15'>mpc8544ds</machine>
      <machine maxCpus='1'>bamboo</machine>
      <machine maxCpus='1'>g3beige</machine>
      <machine maxCpus='1'>prep</machine>
      <machine maxCpus='1'>mac99</machine>
      <machine maxCpus='255'>pseries-2.6</machine>
      <machine maxCpus='255'>pseries-2.4</machine>
      <machine maxCpus='255'>pseries-2.5</machine>
      <machine maxCpus='255'>pseries-2.2</machine>
      <machine maxCpus='1'>taihu</machine>
      <machine maxCpus='255'>pseries-2.3</machine>
      <machine maxCpus='255'>pseries-xenial</machine>
      <machine maxCpus='255'>pseries-2.1</machine>
      <domain type='qemu'/>
      <domain type='kvm'>
        <emulator>/usr/bin/kvm</emulator>
        <machine maxCpus='255'>pseries-2.7</machine>-----------------------------------------------NOK
        <machine canonical='pseries-2.7' maxCpus='255'>pseries</machine>
        <machine maxCpus='1'>ref405ep</machine>
        <machine maxCpus='1'>virtex-ml507</machine>
        <machine maxCpus='32'>ppce500</machine>
        <machine maxCpus='15'>mpc8544ds</machine>
        <machine maxCpus='1'>bamboo</machine>
        <machine maxCpus='1'>g3beige</machine>
        <machine maxCpus='1'>prep</machine>
        <machine maxCpus='1'>mac99</machine>
        <machine maxCpus='255'>pseries-2.6</machine>
        <machine maxCpus='255'>pseries-2.4</machine>
        <machine maxCpus='255'>pseries-2.5</machine>
        <machine maxCpus='255'>pseries-2.2</machine>
        <machine maxCpus='1'>taihu</machine>
        <machine maxCpus='255'>pseries-2.3</machine>
        <machine maxCpus='255'>pseries-2.1</machine>
      </domain>
    </arch>
    <features>
      <cpuselection/>
      <deviceboot/>
      <disksnapshot default='on' toggle='no'/>
    </features>
  </guest>

Userspace tool common name: ii qemu-system-ppc 1:2.6.1+dfsg-0ubuntu3 ppc64el QEMU full system emulation binaries (ppc) , ii libvirt0:ppc64el 2.1.0-1ubuntu6 ppc64el library for interfacing with different virtualization systems

The userspace tool has the following bit modes: both

Userspace rpm: ii qemu-system-ppc 1:2.6.1+dfsg-0ubuntu3 ppc64el QEMU full system emulation binaries (ppc) , ii libvirt0:ppc64el 2.1.0-1ubuntu6 ppc64el library for interfacing with different virtualization systems

Userspace tool obtained from project website: na

*Additional Instructions for <email address hidden>:
-Post a private note with access information to the machine that the bug is occuring on.
-Attach ltrace and strace of userspace application.

== Comment: #1 - Satheesh Rajendran <email address hidden> - 2016-09-26 09:17:32 ==
There was a local qemu-system-ppc64 instance and due to /usr/bin/kvm defaults to local qemu-system-ppc64 instance there was inconsistent in virsh capabilities output, even after removing the local qemu-system-ppc64 instance.

Had a discussion with Shiva, after removing libvirt cache, libvirt restart the virsh capabilities output became consistent

== Comment: #2 - Shivaprasad G. Bhat <email address hidden> - 2016-09-26 09:19:41 ==
Just to add, the binary in wrapper better be an absolute path that way, there is never an inconsistency over PATH variable changes

== Comment: #3 - Satheesh Rajendran <email address hidden> - 2016-09-26 09:26:21 ==
To avoid this behavior permanently, it is good to the absolute path for qemu-system-ppc64 in /usr/bin/kvm wrapper,

 #!/bin/sh
set -f

getcpu() {
   CPU="unknown"
   [ -r /proc/cpuinfo ] || return
   local line
   while read line; do
      set -- $line
      [ "$1" = "cpu" ] && CPU="$3" && return 0;
   done < /proc/cpuinfo
   return
}

getcpu
case "$CPU" in
  e500*|e6500*|e5500*)
    qemu=qemu-system-ppcemb
    ;;
  *)
    case "" in
      ppc64*)
        qemu=qemu-system-ppc64--------------------------------->qemu=/usr/bin/qemu-system-ppc64
        ;;
      *)
        qemu=qemu-system-ppc------------------------------------->qemu=/usr/bin/qemu-system-ppc
        ;;
    esac
  ;;
esac
exec "$qemu" -enable-kvm "$@"

bugproxy (bugproxy)
tags: added: architecture-ppc64le bugnameltc-146735 severity-high targetmilestone-inin1610
Changed in ubuntu:
assignee: nobody → Taco Screen team (taco-screen-team)
affects: ubuntu → qemu (Ubuntu)
Revision history for this message
Ryan Harper (raharper) wrote :
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Hi,
first of all thank you for the pre-analysis.
I must admit that it is long enough that I was mislead at first :-)

I as well have:
    <os_type>hvm</os_type>
    <arch name='ppc64le'>
      <wordsize>64</wordsize>
      <emulator>/usr/bin/qemu-system-ppc64le</emulator>
      <machine maxCpus='255'>pseries-yakkety</machine>

On:
ii libvirt-bin 2.1.0-1ubuntu6 ppc64el programs for the libvirt library
ii qemu-kvm 1:2.6.1+dfsg-0ubuntu3 ppc64el QEMU Full virtualization

But not
virsh capabilities | grep '2\.7'

And actually there should be no 2.7 around ever as this is qemu 2.6.
I assume you had a self provided qemu 2.7 around on the system before?

Following your pre-analysis I finally understood that you got rid of the main issue by clearing some cache.
Quote: "Had a discussion with Shiva, after removing libvirt cache, libvirt restart the virsh capabilities output became consistent"

So I understand you hit your custom qemu 2.7 with that by "missing" a hard coded path in the kvm wrapper? And your suggestion is to hardcode the full path in the kvm wrapper.

So that is an issue I understand - but not related to the type changes we had.
Just falling into that time incidentally I think.

IMHO - users are supposed to be able to overwrite their qemu used for KVM by providing one that is preferred in path.
Your suggestion would break that, don't you think that is loosing more than it fixes?

Waiting for your feedback before going into too much more detail.
If you want more of a fast discussion please catch cpaelzer on freenode e.g. #ubuntu-server (European timezone)

Changed in qemu (Ubuntu):
status: New → Incomplete
Revision history for this message
Satheesh Rajendran (sathnaga) wrote :

Yes, your understanding is correct, the initial issue got rectified by removing cache and removing the local qemu instance compiled with qemu-2.7.

Looks like the PATH precedence is local bydefault and it can be inconsistent, so
different utilities takes inconsistent values in this case, like virt-install complains about
unsupported cpu.

Keeping the absolute binary path in kvm wrapper will make that it always points to the system installed binary and if user wants to use his binary anyways can change wrapper "or" use it standalone?, which other distributions also follow.

In that way we would have inconsistent virsh capabilities output even the custom binaries installed in the system

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Ok, I checked a bit further and agree now.
The conflict starts at libvirt usually preferring absolute paths vs the kvm wrapper which uses normal PATH lookup.

That understood I think the severity is low.

I really really appreciate the report as it is a valid issue - but I don't think it qualifies to be pressed into yakkety or for an SRU.

This bug is present in Debian too. So it would be best fixed in Debian, and then Ubuntu will pick it up on the next merge. Provide a minimal patch (changing the path in the debian/kvm* files) and we pick it up on the next merge.

Would you mind filing a bug with Debian please?
We will link it here and track inclusion eventually.

Changed in qemu (Ubuntu):
status: Incomplete → Triaged
importance: Undecided → Low
tags: added: bitesize needs-upstream-report
Revision history for this message
bugproxy (bugproxy) wrote : Comment bridged from LTC Bugzilla

------- Comment From <email address hidden> 2016-12-12 04:05 EDT-------
(In reply to comment #11)
>
> Ok, I checked a bit further and agree now.
> The conflict starts at libvirt usually preferring absolute paths vs the kvm
> wrapper which uses normal PATH lookup.
>
> That understood I think the severity is low.
>
> I really really appreciate the report as it is a valid issue - but I don't
> think it qualifies to be pressed into yakkety or for an SRU.
>
> This bug is present in Debian too. So it would be best fixed in Debian, and
> then Ubuntu will pick it up on the next merge. Provide a minimal patch
> (changing the path in the debian/kvm* files) and we pick it up on the next
> merge.
>
> Would you mind filing a bug with Debian please?
> We will link it here and track inclusion eventually.

Raised debian bug https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=847840

Regards,
-Satheesh

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Thank you, once (if) accepted in Debian we can think on spreading it to the multi-arch counterparts that are only present in Ubuntu.

Changed in qemu (Debian):
status: Unknown → New
Revision history for this message
Robie Basak (racb) wrote :

Since Debian says "I don't think this is a bug." with justification, marking this Won't Fix in Ubuntu for now. If Debian changes its position, please reopen.

Changed in qemu (Ubuntu):
status: Triaged → Won't Fix
Changed in qemu (Debian):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.