Bug 1949486 - Expose disk serial number in virDomainGetGuestInfo()
Summary: Expose disk serial number in virDomainGetGuestInfo()
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux Advanced Virtualization
Classification: Red Hat
Component: libvirt
Version: 8.5
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: 8.5
Assignee: Michal Privoznik
QA Contact: Lili Zhu
URL:
Whiteboard:
Depends On:
Blocks: 1919857
TreeView+ depends on / blocked
 
Reported: 2021-04-14 12:07 UTC by Michal Privoznik
Modified: 2021-12-28 03:34 UTC (History)
4 users (show)

Fixed In Version: libvirt-7.3.0-1.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-11-16 07:52:40 UTC
Type: Bug
Target Upstream Version: 7.3.0
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2021:4684 0 None None None 2021-11-16 07:53:23 UTC

Description Michal Privoznik 2021-04-14 12:07:02 UTC
Description of problem:
The disk serial number is not exposed in domain guest info, despite qemu-ga reporting it:

2021-04-14 12:04:34.652+0000: 14606: debug : qemuAgentCommandFull:1098 : Send command '{"execute":"guest-get-disks"}' for write, seconds = -2
2021-04-14 12:04:34.655+0000: 14712: debug : qemuAgentIOProcessLine:262 : Line [{"return": [{"name": "/dev/sda1", "dependencies": ["/dev/sda"], "partition": true}, {"name": "/dev/sda", "dependencies": [], "partition": false, "address": {"serial": "0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-0", "bus-type": "scsi", "bus": 0, "unit": 0, "pci-controller": {"bus": 0, "slot": 4, "domain": 0, "function": 0}, "dev": "/dev/sda", "target": 0}}, {"name": "/dev/dm-0", "dependencies": ["/dev/loop0"], "partition": false, "alias": "crypt"}, {"name": "/dev/loop0", "dependencies": [], "partition": false}]}]


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


How reproducible:
100%

Steps to Reproduce:
1. virsh guestinfo --disk $dom
2. observe no disk.N.serial
3.

Actual results:


Expected results:
Disk serial number is exposed

Additional info:
See bug 1899527#c17

Comment 1 Michal Privoznik 2021-04-14 12:10:09 UTC
Merged upstream as:

commit 3bf8dfd56faedd23cce9ec1b723b7f167817a94b
Author:     Michal Prívozník <mprivozn>
AuthorDate: Wed Apr 14 10:09:35 2021 +0200
Commit:     Michal Prívozník <mprivozn>
CommitDate: Wed Apr 14 13:56:09 2021 +0200

    qemu: Expose disk serial in virDomainGetGuestInfo()
    
    When querying guest info via virDomainGetGuestInfo() the
    'guest-get-disks' agent command is called. It may report disk
    serial number which we parse, but never report nor use for
    anything else.
    
    As it turns out, it may help management application find matching
    disk in their internals.
    
    Signed-off-by: Michal Privoznik <mprivozn>
    Reviewed-By: Tomáš Golembiovský <tgolembi>
    Reviewed-by: Peter Krempa <pkrempa>

v7.2.0-187-g3bf8dfd56f

Comment 6 Lili Zhu 2021-05-30 08:02:52 UTC
Verify this bug with:
libvirt-daemon-7.3.0-1.module+el8.5.0+11004+f4810536.x86_64

1. prepare a guest with guest agent device
# virsh list --all
 Id   Name             State
--------------------------------
 14   avocado-vt-vm1   running

2. attach a disk with serial num
# virsh attach-disk avocado-vt-vm1 /var/lib/libvirt/images/a.img vdb --serial ytriet
Disk attached successfully

3. check the serial num of the attached disk
# virsh guestinfo avocado-vt-vm1 --disk 
disk.count          : 6
disk.0.name         : /dev/vda1
disk.0.partition    : yes
disk.0.dependency.count: 1
disk.0.dependency.0.name: /dev/vda
disk.1.name         : /dev/vda2
disk.1.partition    : yes
disk.1.dependency.count: 1
disk.1.dependency.0.name: /dev/vda
disk.2.name         : /dev/vda
disk.2.partition    : no
disk.2.serial       : WD-WMAP9A966149
disk.2.alias        : vda
disk.3.name         : /dev/dm-0
disk.3.partition    : no
disk.3.dependency.count: 1
disk.3.dependency.0.name: /dev/vda2
disk.3.guest_alias  : rhel-root
disk.4.name         : /dev/vdb
disk.4.partition    : no
disk.4.serial       : ytriet     <== serial number been reported
disk.4.alias        : vdb
disk.5.name         : /dev/dm-1
disk.5.partition    : no
disk.5.dependency.count: 1
disk.5.dependency.0.name: /dev/vda2
disk.5.guest_alias  : rhel-swap

As the testing result matches with the expected result, marked the bug 
as verified

Comment 8 errata-xmlrpc 2021-11-16 07:52:40 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 (virt:av 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:4684


Note You need to log in before you can comment on or make changes to this bug.