Bug 1899527 - RFE: Report logical_name for disks without mounted file-system
Summary: RFE: Report logical_name for disks without mounted file-system
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux Advanced Virtualization
Classification: Red Hat
Component: libvirt
Version: 8.3
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: rc
: 8.4
Assignee: Marc-Andre Lureau
QA Contact: Lili Zhu
URL:
Whiteboard:
Depends On: 1859494
Blocks: 1919857
TreeView+ depends on / blocked
 
Reported: 2020-11-19 13:39 UTC by Marc-Andre Lureau
Modified: 2024-10-01 17:06 UTC (History)
22 users (show)

Fixed In Version: libvirt-7.0.0-1.el8
Doc Type: Enhancement
Doc Text:
Clone Of: 1859494
Environment:
Last Closed: 2021-05-25 06:45:10 UTC
Type: Feature Request
Target Upstream Version: 7.0.0
Embargoed:


Attachments (Terms of Use)

Description Marc-Andre Lureau 2020-11-19 13:39:50 UTC
+++ This bug was initially created as a clone of Bug #1859494 +++

In RHEL 7 and below, ovirt-guest-agent reported logical names also of disks with no file-system mounted. We need qemu-guest-agent to do the same on RHEL 8, otherwise RHV users that upgrade their guests to RHEL 8 would miss that information.

Comment 1 Marc-Andre Lureau 2020-11-20 18:17:55 UTC
Initial version posted upstream:
https://patchew.org/Libvirt/20201120180948.203254-1-marcandre.lureau@redhat.com/

Comment 2 Michal Privoznik 2020-12-01 13:41:04 UTC
Pushed upstream:

172b830435 virsh: add --disk informations to guestinfo command
0cb2d9f05d qemu_driver: report guest disk informations
05a75ca2ce domain: add disk informations to virDomainGetGuestInfo
8401a586a2 qemu_agent: add qemuAgentGetDisks
3169db81f6 qemu: use virJSONValueObjectGetStringArray
b3dad96972 util: json: add virJSONValueObjectGetStringArray convenience
c6fcb75f77 qemu_agent: factor out qemuAgentGetDiskAddress
f534eae275 qemu_agent: export qemuAgentDiskAddressFree & add g_auto

v6.10.0-10-g172b830435


Although, this patch is somewhat important:

https://www.redhat.com/archives/libvir-list/2020-December/msg00020.html

Hence, I'm not moving to POST just yet.

Comment 3 Daniel Berrangé 2020-12-02 12:49:00 UTC
Some further API fixes were required for consistency

https://www.redhat.com/archives/libvir-list/2020-December/msg00146.html

Comment 4 Michal Privoznik 2020-12-02 14:42:01 UTC
Merged patch from comment 2:

b46ec55d53 qemuDomainGetGuestInfo: Exit early if getting info fails

v6.10.0-43-gb46ec55d53

Comment 5 Michal Privoznik 2020-12-03 16:08:39 UTC
Patch from comment 3 is not merged too:

d4745bb909 src: use singular form instead of plural, for guest disk info

v6.10.0-69-gd4745bb909

Comment 6 Jiri Denemark 2020-12-04 11:38:21 UTC
I believe this bug should be moved to RHEL-AV. The original qemu-guest-agent
bug makes sense in RHEL since it's a guest change and we want that in RHEL
(non-AV), but this libvirt part is on the host side, which should be RHEL-AV
for RHV.

Comment 7 Michal Privoznik 2020-12-04 17:35:54 UTC
(In reply to Jiri Denemark from comment #6)
> I believe this bug should be moved to RHEL-AV. The original qemu-guest-agent
> bug makes sense in RHEL since it's a guest change and we want that in RHEL
> (non-AV), but this libvirt part is on the host side, which should be RHEL-AV
> for RHV.

In that case, upstream work is done and this can go to POST then.

Comment 8 Marc-Andre Lureau 2020-12-08 08:38:17 UTC
(In reply to Jiri Denemark from comment #6)
> I believe this bug should be moved to RHEL-AV. The original qemu-guest-agent
> bug makes sense in RHEL since it's a guest change and we want that in RHEL
> (non-AV), but this libvirt part is on the host side, which should be RHEL-AV
> for RHV.

I believe you are correct.

Arik, that's also what you expected for ovirt support (bug 1836661)?

Comment 9 Arik 2020-12-08 08:46:16 UTC
(In reply to Marc-Andre Lureau from comment #8)
> (In reply to Jiri Denemark from comment #6)
> > I believe this bug should be moved to RHEL-AV. The original qemu-guest-agent
> > bug makes sense in RHEL since it's a guest change and we want that in RHEL
> > (non-AV), but this libvirt part is on the host side, which should be RHEL-AV
> > for RHV.
> 
> I believe you are correct.
> 
> Arik, that's also what you expected for ovirt support (bug 1836661)?

Yes, that's correct.

Comment 11 Lili Zhu 2020-12-30 09:28:45 UTC
Tested this bug with:
libvirt-6.10.0-1.fc34.x86_64
qemu-kvm-5.2.0-0.7.rc2.fc34.x86_64
qemu-guest-agent-5.2.0-2.module+el8.4.0+9186+ec44380f.x86_64

1. prepare a guest with guest agent device
virsh domtime pc
Time: 1609318675

2. create an unmounted iscsi disk in guest
# lsblk 
NAME          MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda             8:0    0   1G  0 disk /mnt
vda           252:0    0  10G  0 disk 
├─vda1        252:1    0   1G  0 part /boot
└─vda2        252:2    0   9G  0 part 
  ├─rhel-root 253:0    0   8G  0 lvm  /
  └─rhel-swap 253:1    0   1G  0 lvm  [SWAP]

3. report filesystem information
virsh guestinfo pc --filesystem
fs.count            : 2
fs.0.name           : dm-0
fs.0.mountpoint     : /
fs.0.fstype         : xfs
fs.0.total-bytes    : 8575254528
fs.0.used-bytes     : 1748971520
fs.0.disk.count     : 1
fs.0.disk.0.alias   : vda
fs.0.disk.0.device  : /dev/vda2
fs.1.name           : vda1
fs.1.mountpoint     : /boot
fs.1.fstype         : xfs
fs.1.total-bytes    : 1063256064
fs.1.used-bytes     : 183119872
fs.1.disk.count     : 1
fs.1.disk.0.alias   : vda
fs.1.disk.0.device  : /dev/vda1

4. report disk information
virsh guestinfo pc --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.alias        : vda
disk.3.name         : /dev/sda   <== unmounted disk
disk.3.partition    : no
disk.4.name         : /dev/dm-0
disk.4.partition    : no
disk.4.dependency.count: 1
disk.4.dependency.0.name: /dev/vda2
disk.4.guest_alias  : rhel-root
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

5. construct filesystem on sda1 and mount the disk
virsh guestinfo --disk pc
disk.count          : 7
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.alias        : vda
disk.3.name         : /dev/sda1
disk.3.partition    : yes
disk.3.dependency.count: 1
disk.3.dependency.0.name: /dev/sda
disk.4.name         : /dev/sda
disk.4.partition    : no
disk.5.name         : /dev/dm-0
disk.5.partition    : no
disk.5.dependency.count: 1
disk.5.dependency.0.name: /dev/vda2
disk.5.guest_alias  : rhel-root
disk.6.name         : /dev/dm-1
disk.6.partition    : no
disk.6.dependency.count: 1
disk.6.dependency.0.name: /dev/vda2
disk.6.guest_alias  : rhel-swap

6. check the filesystem info
virsh guestinfo --filesystem pc
fs.count            : 3
fs.0.name           : dm-0
fs.0.mountpoint     : /
fs.0.fstype         : xfs
fs.0.total-bytes    : 8575254528
fs.0.used-bytes     : 1754783744
fs.0.disk.count     : 1
fs.0.disk.0.alias   : vda
fs.0.disk.0.device  : /dev/vda2
fs.1.name           : vda1
fs.1.mountpoint     : /boot
fs.1.fstype         : xfs
fs.1.total-bytes    : 1063256064
fs.1.used-bytes     : 183119872
fs.1.disk.count     : 1
fs.1.disk.0.alias   : vda
fs.1.disk.0.device  : /dev/vda1
fs.2.name           : sda1
fs.2.mountpoint     : /mnt
fs.2.fstype         : xfs
fs.2.total-bytes    : 522878976
fs.2.used-bytes     : 30318592
fs.2.disk.count     : 1
fs.2.disk.0.serial  : 360014054d41384d5d67471dbade68599
fs.2.disk.0.device  : /dev/sda1

Comment 14 Lili Zhu 2021-01-25 09:31:37 UTC
Tested this bug with:
libvirt-daemon-7.0.0-2.module+el8.4.0+9520+ef609c5f.x86_64
qemu-guest-agent-5.2.0-3.module+el8.4.0+9499+42e58f08.x86_64

1.prepare a guest with guest agent device
virsh domtime avocado-vt-vm1
Time: 1609318675

2. check the disk of guest
# virsh guestinfo avocado-vt-vm1 --disk 
disk.count          : 5
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.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/dm-1
disk.4.partition    : no
disk.4.dependency.count: 1
disk.4.dependency.0.name: /dev/vda2
disk.4.guest_alias  : rhel-swap

3. attach a disk to guest
# virsh attach-disk avocado-vt-vm1 /var/lib/libvirt/images/test.img vdb
Disk attached successfully

4. check disk of guest
# 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.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   <== (new disk here)
disk.4.partition    : no
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

Logical names also of disks with no file-system mounted can be shown now, mark the bug as verified.

Comment 15 Lili Zhu 2021-01-25 09:33:49 UTC
Forget to mention about the feature supporting status for windows guest, change the bug status back
to ON_QA status

Comment 16 Lili Zhu 2021-01-29 12:12:40 UTC
Will track the feature supporting status for windows guest in Bug #1919535, mark the bug as verified.

Comment 17 Tomáš Golembiovský 2021-04-06 10:07:25 UTC
The way this was implemented in libvirt makes it problematic to use from oVirt. Is there any reason why the address and especially serial number is not reported?

The fact that only a disk name is reported means we have to construct a mapping between names and serial numbers AND ensure this has not changed during the calls to qemu-ga. Otherwise we risk reporting wrong guest disk names and users can run into serious troubles. 

All in all this has serious drawbacks compared to the qemu-ga API. Can we enhance the libvirt API?

Comment 18 Michal Privoznik 2021-04-14 07:55:36 UTC
(In reply to Tomáš Golembiovský from comment #17)
> The way this was implemented in libvirt makes it problematic to use from
> oVirt. Is there any reason why the address and especially serial number is
> not reported?
> 
> The fact that only a disk name is reported means we have to construct a
> mapping between names and serial numbers AND ensure this has not changed
> during the calls to qemu-ga. Otherwise we risk reporting wrong guest disk
> names and users can run into serious troubles. 
> 
> All in all this has serious drawbacks compared to the qemu-ga API. Can we
> enhance the libvirt API?

Tomas,

libvirt fetches addresses internally and uses them to find corresponding disk <target/> in the domain XML. However, it seems that serial is fetched but unused. That should be fairly easy to expose. But I'm not so sure about the address field - I mean, disks can be on various buses and each uses different addressing scheme. What format would help you for addresses?

Comment 19 Michal Privoznik 2021-04-14 08:15:58 UTC
I've posted a patch that exposes disk serial here:

https://listman.redhat.com/archives/libvir-list/2021-April/msg00552.html

Comment 20 Han Han 2021-04-14 08:31:22 UTC
(In reply to Michal Privoznik from comment #19)
> I've posted a patch that exposes disk serial here:
> 
> https://listman.redhat.com/archives/libvir-list/2021-April/msg00552.html

And remember to mention that in virsh manpage

Comment 21 Tomáš Golembiovský 2021-04-14 09:14:31 UTC
At the moment we only need the serial number and we're not interested in the address as such (bus/slot/etc.). This patch is good enough and greatly improves the usability. Thank you!

Comment 22 Michal Privoznik 2021-04-14 09:53:41 UTC
v2:

https://listman.redhat.com/archives/libvir-list/2021-April/msg00560.html

Tomas, do you want this tracked in a separate bug? This one is in VERIFIED and I'd like to keep it that way.

Comment 23 Tomáš Golembiovský 2021-04-14 10:13:04 UTC
Sure, whatever you prefer.

Comment 24 Michal Privoznik 2021-04-14 11:59:53 UTC
Okay, new bug it is then.

Comment 25 Michal Privoznik 2021-04-20 09:17:34 UTC
New bug created: bug 1949486.

Comment 27 errata-xmlrpc 2021-05-25 06:45:10 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:2098


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