Bug 1677608

Summary: Libvirt cannot get disk info of the guest with sata disk installed on VMware
Product: Red Hat Enterprise Linux 8 Reporter: liuzi <zili>
Component: libvirtAssignee: Michal Privoznik <mprivozn>
Status: CLOSED ERRATA QA Contact: Vera <vwu>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.0CC: jdenemar, jsuchane, juzhou, knoel, lmen, mxie, mzhan, rbalakri, tzheng, vwu, xiaodwan
Target Milestone: rc   
Target Release: 8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-7.8.0-1.module+el8.6.0+12978+7d7a0321 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1679376 (view as bug list) Environment:
Last Closed: 2022-05-10 13:18:34 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: 6.9.0
Embargoed:
Bug Depends On: 1883588    
Bug Blocks: 1679376    
Attachments:
Description Flags
screenshot1 none

Description liuzi 2019-02-15 10:57:57 UTC
Description of problem:
Libvirt cannot get disk info of the guest with sata disk installed on VMware

Version-Release number of selected component (if applicable):
libvirt-4.5.0-21.module+el8+2777+e17f6250.x86_64
qemu-kvm-2.12.0-61.module+el8+2786+5afd5ae3.x86_64

How reproducible:
100%

Steps to reproduce:
1.Prepare a guest with sata disk on ESX6.5 and make sure the guest can boot normally,pls refer to screenshot 1

2. Check the guest's xml info
# virsh -c vpx://root.73.141/data/10.73.196.89/?no_verify=1 dumpxml esx6.5-rhel7.6-sata
Enter root's password for 10.73.73.141:
<domain type='vmware' xmlns:vmware='http://libvirt.org/schemas/domain/vmware/1.0'>
  <name>esx6.5-rhel7.6-sata</name>
  <uuid>422c3051-9921-378a-b991-d9ec680abd3e</uuid>
  <memory unit='KiB'>2097152</memory>
  <currentMemory unit='KiB'>2097152</currentMemory>
  <vcpu placement='static'>1</vcpu>
  <cputune>
    <shares>1000</shares>
  </cputune>
  <os>
    <type arch='x86_64'>hvm</type>
  </os>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <interface type='bridge'>
      <mac address='00:50:56:ac:94:8c'/>
      <source bridge='VM Network'/>
      <model type='vmxnet3'/>
    </interface>
    <video>
      <model type='vmvga' vram='8192' primary='yes'/>
    </video>
  </devices>
  <vmware:datacenterpath>data</vmware:datacenterpath>
  <vmware:moref>vm-663</vmware:moref>
</domain>

Actual results:
As above description

Expected results:
Libvirt can get disk info of the guest with sata disk installed on VMware

Additional info:
1.The bug can reproduce on rhel7

Comment 1 liuzi 2019-02-15 11:00:03 UTC
Created attachment 1535116 [details]
screenshot1

Comment 3 Pino Toscano 2020-10-14 09:46:56 UTC
Fixed upstream for libvirt 6.9.0:

commit 2214fe90442c0f66359e5def3c3033bae0c60102 (HEAD -> master, origin/master, origin/HEAD)
Author: Pino Toscano <ptoscano>
Date:   Mon Oct 12 17:06:59 2020 +0200

    vmx: start parsing SATA disks
    
    Always reverse-engineering VMX files, attempt to support SATA disks in
    guests, and their controllers.
    
    The esx-in-the-wild-10 test case is taken from RHBZ#1883588, while the
    result of esx-in-the-wild-8 is updated with SATA disks.
    
    Fixes (hopefully):
    https://bugzilla.redhat.com/show_bug.cgi?id=1677608
    https://bugzilla.redhat.com/show_bug.cgi?id=1883588
    
    Signed-off-by: Pino Toscano <ptoscano>
    Reviewed-by: Michal Privoznik <mprivozn>

 src/vmx/vmx.c                                    | 138 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/vmx2xmldata/vmx2xml-esx-in-the-wild-10.vmx | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/vmx2xmldata/vmx2xml-esx-in-the-wild-10.xml |  36 ++++++++++++++++++++++++++++++++++++
 tests/vmx2xmldata/vmx2xml-esx-in-the-wild-8.xml  |   6 ++++++
 tests/vmx2xmltest.c                              |   1 +
 5 files changed, 282 insertions(+)

commit 18a1dd57cd32493ce1124f2f1400811ccc9815b7
Author: Pino Toscano <ptoscano>
Date:   Mon Oct 12 13:33:45 2020 +0200

    vmx: expand the disk array
    
    Account for the possible SATA disks too, which means 120 potential
    disks.
    
    This means the size of the array triples, however that is unavoidable
    with the current way of reading disks.
    
    Signed-off-by: Pino Toscano <ptoscano>
    Reviewed-by: Michal Privoznik <mprivozn>

 src/vmx/vmx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

commit 11e61489ff6a7e03ed47629c6561228e5d4c09bb
Author: Pino Toscano <ptoscano>
Date:   Mon Oct 12 13:25:25 2020 +0200

    vmx: shortcut 'cdrom-image' as CD-ROM earlier
    
    Add it to the list of 'deviceType' values ignored for disks.
    
    Signed-off-by: Pino Toscano <ptoscano>
    Reviewed-by: Michal Privoznik <mprivozn>

 src/vmx/vmx.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

commit b23ee6394a34a9e3c0301dcdc8c65fb92b0f4e0c
Author: Pino Toscano <ptoscano>
Date:   Mon Oct 12 13:16:24 2020 +0200

    vmx: hide private helpers
    
    Move all the private helpers for parsing and formatting of domain
    elements as private static functions in vmx.c, to avoid using them
    directly.
    
    Signed-off-by: Pino Toscano <ptoscano>
    Reviewed-by: Michal Privoznik <mprivozn>

 src/libvirt_vmx.syms | 12 ------------
 src/vmx/vmx.c        | 62 ++++++++++++++++++++++++++++++++++++++++++++++----------------
 src/vmx/vmx.h        | 44 --------------------------------------------
 3 files changed, 46 insertions(+), 72 deletions(-)

Comment 11 Vera 2021-10-26 07:03:53 UTC
Verified with the following version:

libvirt-7.8.0-1.module+el8.6.0+12978+7d7a0321.x86_64
qemu-kvm-6.1.0-4.module+el8.6.0+13039+4b81a1dc.x86_64

# virsh -c vpx://root.73.141/data/10.73.196.89/?no_verify=1 dumpxml Auto-esx6.5-rhel7.6-sata
Enter root's password for 10.73.73.141: 
<domain type='vmware' xmlns:vmware='http://libvirt.org/schemas/domain/vmware/1.0'>
  <name>Auto-esx6.5-rhel7.6-sata</name>
  <uuid>422c3051-9921-378a-b991-d9ec680abd3e</uuid>
  <memory unit='KiB'>2097152</memory>
  <currentMemory unit='KiB'>2097152</currentMemory>
  <vcpu placement='static'>1</vcpu>
  <cputune>
    <shares>1000</shares>
  </cputune>
  <os>
    <type arch='x86_64'>hvm</type>
  </os>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <disk type='file' device='disk'>
      <source file='[esx6.5-function] esx6.5-rhel7.6-sata/esx6.5-rhel7.6-sata.vmdk'/>
      <target dev='sda' bus='sata'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <controller type='sata' index='0'/>
    <interface type='bridge'>
      <mac address='00:50:56:ac:94:8c' type='generated'/>
      <source bridge='VM Network'/>
      <model type='vmxnet3'/>
    </interface>
    <video>
      <model type='vmvga' vram='8192' primary='yes'/>
    </video>
  </devices>
  <vmware:datacenterpath>data</vmware:datacenterpath>
  <vmware:moref>vm-2079</vmware:moref>
</domain>


The disk info shows in this fixed version.

Moving state to Verified.

Comment 13 errata-xmlrpc 2022-05-10 13:18:34 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 (Moderate: virt:rhel and virt-devel:rhel security, bug fix, and enhancement update), 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://access.redhat.com/errata/RHSA-2022:1759