Bug 1861670

Summary: lsblk can not show serial information for virtio disk
Product: Red Hat Enterprise Linux 8 Reporter: Dan Zheng <dzheng>
Component: util-linuxAssignee: Karel Zak <kzak>
Status: CLOSED ERRATA QA Contact: Radka Brychtova <rskvaril>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.3CC: hhan
Target Milestone: rc   
Target Release: 8.0   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: util-linux-2.32.1-25.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-05-18 15:08:07 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 Dan Zheng 2020-07-29 08:43:32 UTC
Description of problem:

lsblk can not show serial number for virtio disk in vm.


Version-Release number of selected component (if applicable):
util-linux-2.32.1-11.el8.x86_64 (in guest)

How reproducible:
100%

Steps to Reproduce:
1. Edit vm xml with virtio disk with serial number.

<disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/q35.qcow2' index='2'/>
      <backingStore/>
      <target dev='vda' bus='virtio'/>
      <serial>WD-WMAP9A966149</serial>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0'/>
    </disk>
<disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/test.qcow2' index='1'/>
      <backingStore/>
      <target dev='vdb' bus='virtio'/>
      <serial>mytest-serial</serial>
      <alias name='virtio-disk1'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
    </disk>

2. Start guest 
3. Login guest and check disk using lsblk
# lsblk -o name,serial,size
NAME          SERIAL   SIZE
vda                    100M
vdb                     10G
\u251c\u2500vdb1         1G
\u2514\u2500vdb2         9G
  \u251c\u2500rhel-root  8G
  \u2514\u2500rhel-swap  1G
pmem0                257.8M


4. Check kernel files in guest
[root@localhost ~]# cat /sys/block/vda/serial
mytest-serial
[root@localhost ~]# cat /sys/block/vdb/serial
WD-WMAP9A966149


Actual results:
lsblk can not show serial information for virtio disks

Expected results:
lsblk can show serial information for virtio disks

Additional info:

Comment 1 Han Han 2020-07-30 01:59:30 UTC
Version: util-linux-2.32.1-22.el8.x86_64
Debug message of `lsblk -o name,serial`:
11106: libmount:     INIT: library debug mask: 0xffff
11106: libmount:     INIT: library version: 2.32.1
11106: libmount:     INIT:     feature: selinux
11106: libmount:     INIT:     feature: btrfs
11106: libmount:     INIT:     feature: debug
Available "LIBMOUNT_DEBUG=<name>[,...]|<mask>" debug masks:
   all      [0xffff] : info about all subsystems
   cache    [0x0004] : paths and tags cache
   cxt      [0x0200] : library context (handler)
   diff     [0x0400] : mountinfo changes tracking
   fs       [0x0040] : FS abstraction
   help     [0x0001] : this help
   locks    [0x0010] : mtab and utab locking
   loop     [0x2000] : loop devices routines
   options  [0x0008] : mount options parsing
   tab      [0x0020] : fstab, mtab, mountinfo routines
   update   [0x0080] : mtab, utab updates
   utils    [0x0100] : misc library utils
   monitor  [0x0800] : mount tables monitor
   btrfs    [0x1000] : btrfs specific routines
11106: libsmartcols:     INIT: library debug mask: 0xffff
11106: libsmartcols:     INIT: library version: 2.32.1
Available "LIBSMARTCOLS_DEBUG=<name>[,...]|<mask>" debug masks:
   all      [0xffff] : info about all subsystems
   buff     [0x0040] : output buffer utils
   cell     [0x0004] : table cell utils
   col      [0x0020] : cols utils
   help     [0x0001] : this help
   line     [0x0008] : table line utils
   tab      [0x0010] : table utils
11106: libsmartcols:      TAB: [0x55deddaaf480]: alloc
11106: libsmartcols:     INIT: [0x55deddaaf480]: padding debug: ENABLE
11106: libsmartcols:      TAB: [0x55deddaaf480]: raw: DISABLE
11106: libsmartcols:      TAB: [0x55deddaaf480]: export: DISABLE
11106: libsmartcols:      TAB: [0x55deddaaf480]: ascii: DISABLE
11106: libsmartcols:      TAB: [0x55deddaaf480]: json: DISABLE
11106: libsmartcols:      TAB: [0x55deddaaf480]: noheading: DISABLE
11106: libsmartcols:      TAB: [0x55deddaaf480]: new column name=NAME, whint=0.25, flags=18
11106: libsmartcols:      COL: [0x55deddaaf560]: alloc
11106: libsmartcols:      TAB: [0x55deddaaf480]: add column
11106: libsmartcols:      TAB: [0x55deddaaf480]: new column name=SERIAL, whint=0.1, flags=1
11106: libsmartcols:      COL: [0x55deddaaf640]: alloc
11106: libsmartcols:      TAB: [0x55deddaaf480]: add column
11106: libsmartcols:      TAB: [0x55deddaaf480]: new column name=MAJ:MIN, whint=6, flags=32
11106: libsmartcols:      COL: [0x55deddaaf740]: alloc
11106: libsmartcols:      TAB: [0x55deddaaf480]: add column
11106: lsblk:      DEV: iterate on /sys/block
11106: lsblk:      DEV:  dm-1 dentry
11106: lsblk:      CXT: [0x7ffcf0037970]: setting context for dm-1 [parent=(nil), wholedisk=(nil)]
11106: lsblk:      CXT: [0x7ffcf0037970]: dm-1: filename=/dev/mapper/rhel-swap
11106: lsblk:      CXT: [0x7ffcf0037970]: dm-1: npartitions=0, nholders=0, nslaves=1
11106: lsblk:      CXT: [0x7ffcf0037970]: dm-1: context successfully initialized
11106: lsblk:      CXT: [0x7ffcf0037970]: reset
11106: lsblk:      DEV:  dm-0 dentry
11106: lsblk:      CXT: [0x7ffcf0037970]: setting context for dm-0 [parent=(nil), wholedisk=(nil)]
11106: lsblk:      CXT: [0x7ffcf0037970]: dm-0: filename=/dev/mapper/rhel-root
11106: lsblk:      CXT: [0x7ffcf0037970]: dm-0: npartitions=0, nholders=0, nslaves=1
11106: lsblk:      CXT: [0x7ffcf0037970]: dm-0: context successfully initialized
11106: lsblk:      CXT: [0x7ffcf0037970]: reset
11106: lsblk:      DEV:  vda dentry
11106: lsblk:      CXT: [0x7ffcf0037970]: setting context for vda [parent=(nil), wholedisk=(nil)]
11106: lsblk:      CXT: [0x7ffcf0037970]: vda: filename=/dev/vda
11106: lsblk:      CXT: [0x7ffcf0037970]: vda: npartitions=2, nholders=0, nslaves=0
11106: lsblk:      CXT: [0x7ffcf0037970]: vda: context successfully initialized
11106: lsblk:      CXT: [0x7ffcf0037970]: probe whole-disk for partitions
11106: lsblk:      CXT: [0x7ffcf0037970]:   checking vda2
11106: lsblk:      CXT: [0x7ffcf0037730]: setting context for vda2 [parent=0x7ffcf0037970, wholedisk=0x7ffcf0037970]
11106: lsblk:      CXT: [0x7ffcf0037730]: vda2: filename=/dev/vda2
11106: lsblk:      CXT: [0x7ffcf0037730]: vda2: npartitions=0, nholders=2, nslaves=0
11106: lsblk:      CXT: [0x7ffcf0037730]: vda2: context successfully initialized
11106: libsmartcols:     LINE: [0x55deddab7b30]: alloc
11106: libsmartcols:     LINE: [0x55deddab7b30]: alloc 3 cells
11106: libsmartcols:      TAB: [0x55deddaaf480]: add line
11106: lsblk:      DEV: [0x7ffcf0037970]: vda: found udev properties
11106: libsmartcols:     LINE: [0x55deddac2c50]: alloc
11106: libsmartcols:     LINE: [0x55deddac2c50]: alloc 3 cells
11106: libsmartcols:      TAB: [0x55deddaaf480]: add line
11106: libsmartcols:     LINE: [0x55deddab7b30]: add child
11106: lsblk:      CXT: [0x7ffcf0037730]: vda2: list dependencies
11106: lsblk:      CXT: [0x7ffcf0037730]: vda2: checking for 'holders' dependence
11106: lsblk:      CXT: [0x7ffcf0037570]: setting context for dm-1 [parent=0x7ffcf0037730, wholedisk=(nil)]
11106: lsblk:      CXT: [0x7ffcf0037570]: dm-1: filename=/dev/mapper/rhel-swap
11106: lsblk:      CXT: [0x7ffcf0037570]: dm-1: npartitions=0, nholders=0, nslaves=1
11106: lsblk:      CXT: [0x7ffcf0037570]: dm-1: context successfully initialized
11106: lsblk:      CXT: [0x7ffcf0037730]: vda2: dm-1: dependence is whole-disk
11106: libsmartcols:     LINE: [0x55deddab8130]: alloc
11106: libsmartcols:     LINE: [0x55deddab8130]: alloc 3 cells
11106: libsmartcols:      TAB: [0x55deddaaf480]: add line
11106: libsmartcols:     LINE: [0x55deddac2c50]: add child
11106: lsblk:      CXT: [0x7ffcf0037570]: dm-1: list dependencies
11106: lsblk:      CXT: [0x7ffcf0037570]: reset
11106: lsblk:      CXT: [0x7ffcf0037570]: setting context for dm-0 [parent=0x7ffcf0037730, wholedisk=(nil)]
11106: lsblk:      CXT: [0x7ffcf0037570]: dm-0: filename=/dev/mapper/rhel-root
11106: lsblk:      CXT: [0x7ffcf0037570]: dm-0: npartitions=0, nholders=0, nslaves=1
11106: lsblk:      CXT: [0x7ffcf0037570]: dm-0: context successfully initialized
11106: lsblk:      CXT: [0x7ffcf0037730]: vda2: dm-0: dependence is whole-disk
11106: libsmartcols:     LINE: [0x55deddacad70]: alloc
11106: libsmartcols:     LINE: [0x55deddacad70]: alloc 3 cells
11106: libsmartcols:      TAB: [0x55deddaaf480]: add line
11106: libsmartcols:     LINE: [0x55deddac2c50]: add child
11106: lsblk:      CXT: [0x7ffcf0037570]: dm-0: list dependencies
11106: lsblk:      CXT: [0x7ffcf0037570]: reset
11106: lsblk:      CXT: [0x7ffcf0037730]: vda2: checking for 'holders' -- done
11106: lsblk:      CXT: [0x7ffcf0037730]: reset
11106: lsblk:      CXT: [0x7ffcf0037970]:   checking vda1
11106: lsblk:      CXT: [0x7ffcf0037730]: setting context for vda1 [parent=0x7ffcf0037970, wholedisk=0x7ffcf0037970]
11106: lsblk:      CXT: [0x7ffcf0037730]: vda1: filename=/dev/vda1
11106: lsblk:      CXT: [0x7ffcf0037730]: vda1: npartitions=0, nholders=0, nslaves=0
11106: lsblk:      CXT: [0x7ffcf0037730]: vda1: context successfully initialized
11106: libsmartcols:     LINE: [0x55deddac2d30]: alloc
11106: libsmartcols:     LINE: [0x55deddac2d30]: alloc 3 cells
11106: libsmartcols:      TAB: [0x55deddaaf480]: add line
11106: libsmartcols:     LINE: [0x55deddab7b30]: add child
11106: lsblk:      CXT: [0x7ffcf0037730]: vda1: list dependencies
11106: lsblk:      CXT: [0x7ffcf0037730]: reset
11106: lsblk:      CXT: [0x7ffcf0037970]: probe whole-disk for partitions -- done
11106: lsblk:      CXT: [0x7ffcf0037970]: vda: list dependencies
11106: lsblk:      CXT: [0x7ffcf0037970]: reset
11106: lsblk:      DEV: iterate on /sys/block -- done
11106: libsmartcols:      TAB: [0x55deddaaf480]: sorting table
11106: libsmartcols:      TAB: [0x55deddaaf480]: printing
11106: libsmartcols:      TAB: [0x55deddaaf480]: initialize printing
11106: libsmartcols:      TAB: [0x55deddaaf480]: setting default symbols
11106: libsmartcols:      TAB: [0x55deddaaf480]: set symbols
11106: libsmartcols:     BUFF: [0x55deddac2e10]: alloc (size=8193)
11106: libsmartcols:      TAB: [0x55deddaaf480]: recounting widths (termwidth=80)
11106: libsmartcols:      COL: [0x55deddaaf560]:            NAME seq=0, width=13, hint=20, avg=8, max=13, min=4, extreme=not 
11106: libsmartcols:      COL: [0x55deddaaf640]:          SERIAL seq=1, width=6, hint=8, avg=0, max=0, min=6, extreme=not trunc
11106: libsmartcols:      TAB: [0x55deddaaf480]:  non-terminal output
11106: libsmartcols:      TAB: [0x55deddaaf480]:  final width: 20 (rc=0)
11106: libsmartcols:      COL: [0x55deddaaf560]:            NAME seq=0, width=13, hint=20, avg=8, max=13, min=4, extreme=not 
11106: libsmartcols:      COL: [0x55deddaaf640]:          SERIAL seq=1, width=6, hint=8, avg=0, max=0, min=6, extreme=not trunc
11106: libsmartcols:      COL: [0x55deddaaf740]: MAJ:MIN (hidden) ignored
11106: libsmartcols:      TAB: [0x55deddaaf480]: printing header
11106: libsmartcols:      TAB: [0x55deddaaf480]: printing tree
11106: libsmartcols:      TAB: [0x55deddaaf480]: printing line
11106: libsmartcols:      TAB: [0x55deddaaf480]: printing line
11106: libsmartcols:      TAB: [0x55deddaaf480]: printing line
11106: libsmartcols:      TAB: [0x55deddaaf480]: printing line
11106: libsmartcols:      TAB: [0x55deddaaf480]: printing line
11106: libsmartcols:     BUFF: [0x55deddac2e10]: dealloc
11106: libsmartcols:      TAB: [0x55deddaaf480]: remove symbols reference
11106: libsmartcols:      TAB: [0x55deddaaf480]: dealloc
11106: libsmartcols:      TAB: [0x55deddaaf480]: remove all lines
11106: libsmartcols:      TAB: [0x55deddaaf480]: remove line
11106: libsmartcols:     LINE: [0x55deddab7b30]: remove child
11106: libsmartcols:      TAB: [0x55deddaaf480]: remove line
11106: libsmartcols:     CELL: [0x55deddac2d30]: dealloc
11106: libsmartcols:     LINE: [0x55deddac2d30]: free cells
11106: libsmartcols:     LINE: [0x55deddab7b30]: remove child
11106: libsmartcols:     CELL: [0x55deddab7b30]: dealloc
11106: libsmartcols:     LINE: [0x55deddab7b30]: free cells
11106: libsmartcols:      TAB: [0x55deddaaf480]: remove line
11106: libsmartcols:     LINE: [0x55deddac2c50]: remove child
11106: libsmartcols:      TAB: [0x55deddaaf480]: remove line
11106: libsmartcols:     CELL: [0x55deddacad70]: dealloc
11106: libsmartcols:     LINE: [0x55deddacad70]: free cells
11106: libsmartcols:     LINE: [0x55deddac2c50]: remove child
11106: libsmartcols:     CELL: [0x55deddac2c50]: dealloc
11106: libsmartcols:     LINE: [0x55deddac2c50]: free cells
11106: libsmartcols:      TAB: [0x55deddaaf480]: remove line
11106: libsmartcols:     CELL: [0x55deddab8130]: dealloc
11106: libsmartcols:     LINE: [0x55deddab8130]: free cells
11106: libsmartcols:      TAB: [0x55deddaaf480]: remove all columns
11106: libsmartcols:      TAB: [0x55deddaaf480]: remove column
11106: libsmartcols:      COL: [0x55deddaaf560]: dealloc
11106: libsmartcols:      TAB: [0x55deddaaf480]: remove column
11106: libsmartcols:      COL: [0x55deddaaf640]: dealloc
11106: libsmartcols:      TAB: [0x55deddaaf480]: remove column
11106: libsmartcols:      COL: [0x55deddaaf740]: dealloc
NAME......... SERIAL
vda.......... 
├─vda1....... 
└─vda2....... 
  ├─rhel-root 
  └─rhel-swap 


udev results:
[root@localhost ~]# udevadm info /dev/vda|grep serial -i
E: ID_SERIAL=WD-WMAP9A966149


Cannnot reproduced on util-linux-2.35.2-2.fc33.x86_64

Comment 2 Karel Zak 2020-08-10 10:31:00 UTC
It sounds like we need to backport https://github.com/karelzak/util-linux/commit/e81d0f80068086147434fa947a4f723c00318772

Unfortunately, RHEL-8 lsblk version reads only ID_SERIAL_SHORT which is not defined for virtio.

Comment 15 errata-xmlrpc 2021-05-18 15:08:07 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 (util-linux 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/RHBA-2021:1694