Bug 1566416

Summary: Storage device fails to validate for extra content " logical_block_size"
Product: Red Hat Enterprise Linux 7 Reporter: Jingjing Shao <jishao>
Component: libvirtAssignee: John Ferlan <jferlan>
Status: CLOSED ERRATA QA Contact: yisun
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.5CC: dyuan, lmen, xuzhang
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-4.4.0-1.el7 Doc Type: No Doc Update
Doc Text:
undefined
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-30 09:53:26 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:

Description Jingjing Shao 2018-04-12 09:23:35 UTC
Description of problem:
Storage device fails to validate for extra content " logical_block_size"

Version-Release number of selected component (if applicable):
libvirt-3.9.0-14.el7_5.2.x86_64

How reproducible:
100%

Steps to Reproduce:
1.# virsh nodedev-list --cap storage
block_sda_361866da06615c0001f3efbf90e133f74

2.# virsh nodedev-dumpxml block_sda_361866da06615c0001f3efbf90e133f74
<device>
  <name>block_sda_361866da06615c0001f3efbf90e133f74</name>
  <path>/sys/devices/pci0000:00/0000:00:01.0/0000:03:00.0/host0/target0:2:0/0:2:0:0/block/sda</path>
  <devnode type='dev'>/dev/sda</devnode>
  <devnode type='link'>/dev/disk/by-id/scsi-361866da06615c0001f3efbf90e133f74</devnode>
  <devnode type='link'>/dev/disk/by-id/wwn-0x61866da06615c0001f3efbf90e133f74</devnode>
  <devnode type='link'>/dev/disk/by-path/pci-0000:03:00.0-scsi-0:2:0:0</devnode>
  <parent>scsi_0_2_0_0</parent>
  <capability type='storage'>
    <block>/dev/sda</block>
    <bus>scsi</bus>
    <drive_type>disk</drive_type>
    <model>PERC H730 Mini</model>
    <vendor>DELL</vendor>
    <serial>361866da06615c0001f3efbf90e133f74</serial>
    <size>599550590976</size>
    <logical_block_size>512</logical_block_size>
    <num_blocks>1170997248</num_blocks>
  </capability>
</device>

3. # virsh nodedev-dumpxml block_sda_361866da06615c0001f3efbf90e133f74  > storage.xml

4. # virt-xml-validate  storage.xml  nodedev
storage.xml:17: element logical_block_size: Relax-NG validity error : Element capability has extra content: logical_block_size
storage.xml fails to validate


Actual results:
Storage device fails to validate

Expected results:
The storage device should to be validated successfully

Additional info:
N/A

Comment 2 John Ferlan 2018-05-19 12:16:25 UTC
Posted patches for a number of grammar issues:

https://www.redhat.com/archives/libvir-list/2018-May/msg01455.html

for this particular one, it's patch 8:

https://www.redhat.com/archives/libvir-list/2018-May/msg01463.html

Comment 3 John Ferlan 2018-05-25 14:36:16 UTC
Patch is now pushed:

commit 4804a4db33a37f828d033733bc47f6eff5d262c3
Author: John Ferlan <jferlan>
Date:   Sat May 19 08:00:58 2018 -0400

    schema: Add missing block data for nodedev
    
...    

    Commit id 'fe2af45b' added output for logical_block_size and
    num_blocks for both removeable and fixed storage, but did not
    update the nodedev capability causing virt-xml-validate to fail.
    It's listed as optional only because it only prints if the
    sizes are > 0. For a CDROM drive the values won't be formatted.
    
    Update the nodedevxml2xmltest in order to output the values
    for storage based on the logic from udevProcessRemoveableMedia
    and udevProcessSD with respect to the logical_blocksize and
    num_blocks calculations.
...

$ git describe 4804a4db33a37f828d033733bc47f6eff5d262c3
v4.3.0-322-g4804a4db33
$

Comment 5 yisun 2018-06-22 03:05:59 UTC
Verified with: libvirt-4.4.0-2.virtcov.el7.x86_64

Steps:
1. Having a block device which xml contains "logical_block_size" and "num_blocks"
# virsh nodedev-list --cap storage
block_sda_WDC_WD2500AAJS_75M0A0_WD_WMAV24703289
...


# virsh nodedev-dumpxml block_sda_WDC_WD2500AAJS_75M0A0_WD_WMAV24703289
<device>
  <name>block_sda_WDC_WD2500AAJS_75M0A0_WD_WMAV24703289</name>
  <path>/sys/devices/pci0000:00/0000:00:0e.0/ata1/host0/target0:0:0/0:0:0:0/block/sda</path>
  <devnode type='dev'>/dev/sda</devnode>
  <devnode type='link'>/dev/disk/by-id/ata-WDC_WD2500AAJS-75M0A0_WD-WMAV24703289</devnode>
  <devnode type='link'>/dev/disk/by-id/wwn-0x50014ee0abd7f02e</devnode>
  <devnode type='link'>/dev/disk/by-path/pci-0000:00:0e.0-ata-1.0</devnode>
  <parent>scsi_0_0_0_0</parent>
  <capability type='storage'>
    <block>/dev/sda</block>
    <bus>ata</bus>
    <drive_type>disk</drive_type>
    <model>WDC WD2500AAJS-7</model>
    <vendor>ATA</vendor>
    <serial>WDC_WD2500AAJS-75M0A0_WD-WMAV24703289</serial>
    <size>250000000000</size>
    <logical_block_size>512</logical_block_size>
    <num_blocks>488281250</num_blocks>
  </capability>
</device>

2. save above xml and validate it
# virsh nodedev-dumpxml block_sda_WDC_WD2500AAJS_75M0A0_WD_WMAV24703289 > blk1.xml

# virt-xml-validate blk1.xml 
blk1.xml validates

Comment 7 errata-xmlrpc 2018-10-30 09:53:26 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://access.redhat.com/errata/RHSA-2018:3113