Bug 1211996

Summary: virt-inspector gives incorrect arch (ppc64) for ppc64le guest
Product: [Community] Virtualization Tools Reporter: Richard W.M. Jones <rjones>
Component: libguestfsAssignee: Maros Zatko <mzatko>
Status: CLOSED UPSTREAM QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: mzatko, ptoscano, rbalakri
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-05-28 12:01: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:
Bug Depends On:    
Bug Blocks: 1264835    

Description Richard W.M. Jones 2015-04-15 11:34:04 UTC
Description of problem:

$ virt-builder --arch ppc64le fedora-21 --output fedora-21-ppc64le
$ virt-inspector -a fedora-21-ppc64le
<?xml version="1.0"?>
<operatingsystems>
  <operatingsystem>
    <root>/dev/sda5</root>
    <name>linux</name>
    <arch>ppc64</arch>     # incorrect, should be ppc64le

The root cause seems to be because guestfs_file_architecture
gives the wrong output:

$ guestfish --ro -a fedora-21-ppc64le -i

><fs> file-architecture /boot/vmlinuz-3.17.4-301.fc21.ppc64le 
ppc64
><fs> file-architecture /bin/ls
ppc64

The output of 'file /bin/ls' on ppc64le is:

ELF 64-bit LSB executable, 64-bit PowerPC or cisco 7500, version 1 (SYSV), dynamically linked, interpreter /lib64/ld64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=bf32a7e5068074a54e91a65b2110a34bd0e9aea4, stripped

Note 'LSB' indicating little endian.

For comparison, on ppc64 (big endian):

ELF 64-bit MSB executable, 64-bit PowerPC or cisco 7500, version 1 (SYSV), dynamically linked, interpreter /lib64/ld64.so.1, for GNU/Linux 2.6.32, BuildID[sha1]=20d03ec87b2e8a3073bcc9e1427f1598ee8e2821, stripped

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

libguestfs-1.29.34-1.fc23.x86_64

Comment 1 Richard W.M. Jones 2015-05-28 12:01:09 UTC
Upstream commit:
https://github.com/libguestfs/libguestfs/commit/33d2b4a7341830efeddb1f258ac77f67a8004d30

$ virt-builder --arch ppc64le fedora-21 --output fedora-21-ppc64le
$ virt-inspector -a fedora-21-ppc64le | grep arch | head -1
    <arch>ppc64le</arch>

Fixed in libguestfs >= 1.29.45.