Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1349237

Summary: virt-inspector can not get windows drive letters for GPT disks
Product: Red Hat Enterprise Linux 7 Reporter: Xianghua Chen <xchen>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.3CC: ptoscano, wshi, xchen
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libguestfs-1.32.5-6.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-03 18:01:53 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
log.virt-inspector-win8
none
system none

Description Xianghua Chen 2016-06-23 03:19:55 UTC
Created attachment 1171226 [details]
log.virt-inspector-win8

Description of problem:
I prepared a Windows8.1 image with GPT disk, but I can't get the drive letters using virt-inspector.
Windows7 also has the same problem.

You can see the full log with -v -x in the attachment.



Version-Release number of selected component (if applicable):
libguestfs-1.32.5-3.el7.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Prepare an Windows8.1 image with GPT disk:
First, prepare a Win8 iso.
Then, download and install OVMF ( The UEFI firmware for virtual machines).
Then,  use virt-manager to install Win8:
  --Create a new virtual machine , and choose “Customize configuration before install”
  --At Overview tab—Hypervisor Details-- Firmware, choose: “UEFI x86_64:/usr/share/OVMF/OVMF_CODE.fd"
At last, install it according to the guide.

2. Inspect the Win8 image:
# virt-inspector -a /home/xchen/my-images/win8.1-uefi.qcow2
<?xml version="1.0"?>
<operatingsystems>
  <operatingsystem>
    <root>/dev/sda4</root>
    <name>windows</name>
    <arch>x86_64</arch>
    <distro>windows</distro>
    <product_name>Windows 8.1 Enterprise</product_name>
    <product_variant>Client</product_variant>
    <major_version>6</major_version>
    <minor_version>3</minor_version>
    <windows_systemroot>/Windows</windows_systemroot>
    <windows_current_control_set>ControlSet001</windows_current_control_set>
    <hostname>WIN-NKLFAJFC4EN</hostname>
    <format>installed</format>
    <mountpoints>
      <mountpoint dev="/dev/sda4">/</mountpoint>
    </mountpoints>
    <filesystems>
      <filesystem dev="/dev/sda4">
        <type>ntfs</type>
        <uuid>468ADC538ADC40DB</uuid>
      </filesystem>
    </filesystems>
    <applications/>
  </operatingsystem>
</operatingsystems>


There should be lines like in win7 with MBR as following:
 <drive_mappings>
      <drive_mapping name="C">/dev/sda1</drive_mapping>
    </drive_mappings>


Actual results:
As above output.

Expected results:
There should be lines like in win7 with MBR as following:
 <drive_mappings>
      <drive_mapping name="C">/dev/sda1</drive_mapping>
    </drive_mappings>

Additional info:
Win7 also have this problem.

Comment 1 Richard W.M. Jones 2016-06-23 08:03:25 UTC
The drive mappings are stored in the Windows SYSTEM hive, so
can you grab the SYSTEM hive from the guest for me please.

You just need to do this command:

  guestfish --ro -a /home/xchen/my-images/win8.1-uefi.qcow2 -i \
    download 'win:\windows\system32\config\system' /tmp/system

and then attach the /tmp/system file to this bug (if it's too
big to attach you may have to compress it).

Comment 2 Xianghua Chen 2016-06-23 10:26:47 UTC
Created attachment 1171406 [details]
system

Comment 3 Richard W.M. Jones 2016-06-23 10:59:29 UTC
I think this one should be fixed by:

  commit 7cb28488a6b974c86a9dd0264d892cd01739c36e
  Author: Dawid Zamirski <*@*>
  Date:   Sat Feb 6 11:50:05 2016 -0500

    inspect: get windows drive letters for GPT disks.
    
    This patch updates the guestfs_inspect_get_drive_mappings API call to
    also return drive letters for GPT paritions. Previously this worked
    only for MBR partitions. This is achieved by matching the GPT partition
    GUID with the info stored in the blob from
    HKLM\SYSTEM\MountedDevices\DosDevices keys. For GPT partions this blob
    contains a "DMIO:ID:" prefix followed by a 16 byte binary GUID.

Comment 5 Xianghua Chen 2016-06-28 06:25:44 UTC
Verified with the packages:
libguestfs-1.32.5-6.el7.x86_64

Verify steps:
1. Prepare an Windows8.1 image with GPT disk:
First, prepare a Win8 iso.
Then, download and install OVMF ( The UEFI firmware for virtual machines).
Then,  use virt-manager to install Win8:
  --Create a new virtual machine , and choose “Customize configuration before install”
  --At Overview tab—Hypervisor Details-- Firmware, choose: “UEFI x86_64:/usr/share/OVMF/OVMF_CODE.fd"
At last, install it according to the guide.

2. Inspect the Win8 image:
# virt-inspector -a /home/xchen/my-images/win8.1-uefi.qcow2
<?xml version="1.0"?>
<operatingsystems>
  <operatingsystem>
    <root>/dev/sda4</root>
    <name>windows</name>
    <arch>x86_64</arch>
    <distro>windows</distro>
    <product_name>Windows 8.1 Enterprise</product_name>
    <product_variant>Client</product_variant>
    <major_version>6</major_version>
    <minor_version>3</minor_version>
    <windows_systemroot>/Windows</windows_systemroot>
    <windows_current_control_set>ControlSet001</windows_current_control_set>
    <hostname>xchen</hostname>
    <format>installed</format>
    <mountpoints>
      <mountpoint dev="/dev/sda4">/</mountpoint>
    </mountpoints>
    <filesystems>
      <filesystem dev="/dev/sda4">
        <type>ntfs</type>
        <uuid>468ADC538ADC40DB</uuid>
      </filesystem>
    </filesystems>
    <drive_mappings>
      <drive_mapping name="C">/dev/sda4</drive_mapping>
    </drive_mappings>
    <applications/>
  </operatingsystem>
</operatingsystems>


There is drive_mapping info .

So verified.

Comment 7 errata-xmlrpc 2016-11-03 18:01:53 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/RHSA-2016-2576.html