Bug 1669446 - Avoid duplicate default serial numbers configuration when using -blockdev for scsi
Summary: Avoid duplicate default serial numbers configuration when using -blockdev for...
Status: ON_QA
Alias: None
Product: Red Hat Enterprise Linux Advanced Virtualization
Classification: Red Hat
Component: libvirt
Version: 8.0
Hardware: All
OS: Linux
Target Milestone: rc
: 8.0
Assignee: Peter Krempa
QA Contact: Han Han
Keywords: Upstream
Depends On:
TreeView+ depends on / blocked
Reported: 2019-01-25 10:02 UTC by zhenyzha
Modified: 2019-06-04 11:44 UTC (History)
14 users (show)

Clone Of:
Last Closed:

Attachments (Terms of Use)
Display one multipath disk:mpatha (429.29 KB, image/png)
2019-01-25 10:02 UTC, zhenyzha
no flags Details

Description zhenyzha 2019-01-25 10:02:00 UTC
Created attachment 1523471 [details]
Display one multipath disk:mpatha

Description of problem:
When using cdrom to install the system, there are two blockdev disks.choose installation destination,the system automatic multipath configuration disk.
Display one multipath disk:mpatha
But when you use the -drive command,can select these two disk normally.

Version-Release number of selected component (if applicable):
  kernel version:4.18.0-62.el8.x86_64
  qemu-kvm version:qemu-kvm-3.1.0-6.module+el8+2711+98525d2b

How reproducible:

Steps to Reproduce:
/usr/libexec/qemu-kvm \
-name zhenyzha-RHEL-7.6 \
-m 4G \
-nodefaults \
-vga qxl \
-smp 4,cores=4,threads=1,sockets=1 \
-vnc :30 \
-monitor stdio \
-rtc base=utc,clock=host \
-boot order=cd,menu=off,strict=off \
-enable-kvm \
-qmp unix:/var/tmp/qmp-monitor-zhenyzha,server,nowait \
-qmp tcp:0:3001,server,nowait \
-device virtio-scsi-pci,bus=pci.0,addr=0x05,id=scsi-pci-1 \
-blockdev driver=raw,file.driver=file,node-name=drive_cd1,cache.no-flush=on,cache.direct=off,file.filename=/mnt/os2/linux/RHEL7.6-Server-x86_64.iso,read-only=on \
-device scsi-cd,id=cd1,drive=drive_cd1,bootindex=0 \
-blockdev driver=file,cache.direct=off,cache.no-flush=on,filename=guest.qcow2,node-name=my_file \
-blockdev driver=qcow2,node-name=my,file=my_file \
-device scsi-hd,id=target0,drive=my \
-blockdev driver=file,cache.direct=off,cache.no-flush=on,filename=/home/test/zhenyzha-nfs/disk/disk_2,node-name=disk_2 \
-blockdev driver=qcow2,node-name=my0,file=disk_2 \
-device scsi-hd,id=target1,drive=my0 \

Actual results:
Display one multipath disk:mpatha

Expected results:
Can choose two disks normally

Additional info:

Comment 1 Xueqiang Wei 2019-01-25 11:11:06 UTC
Hit this issue when install rhel7.6 guest on rhel8 host.

Comment 2 Kevin Wolf 2019-01-25 12:12:18 UTC
This has the same root cause as bug 1668248, and we want to address this in both QEMU and libvirt, so I will move this one to libvirt and keep the other one for QEMU.

If no serial number is specified, QEMU used to use the BlockBackend name (the -drive id) for the Device Identification Page in scsi-disk. With -blockdev, the BlockBackend becomes anonymous, so we pass an empty string to the guest for both disks, and the guest decides that this is a single multipath disk. As danpb noted, using the BlockBackend name also wasn't a good idea because it means we broke the guest ABI when libvirt changed the way it named the drives.

QEMU doesn't have a good way to provide a unique ID that is guaranteed to be stable across QEMU runs (and ideally doesn't abuse backend IDs), so it would be good if libvirt could just always pass a serial number to avoid the whole problem.

Comment 3 Peter Krempa 2019-01-25 12:49:07 UTC
Will the 'serial' be passed in the same way as it did with drive? Or is a different argument required for it? We can make sure that we pass in the old string for the cases when -blockdev will be used so that we don't break the ABI again.

Comment 4 Daniel Berrange 2019-01-25 13:08:28 UTC
Hmm, I'm not sure libvirt can unconditionally pass a serial without causing a different regression

If we don't pass 'serial' then we have

 - code page 0x80  - no data reported
 - code page 0x83  - report data based on blockbackend name

The problem we face is that with -blockdev we caused a guest ABI regression for code page 0x83.

If we do pass 'serial' then we get

 - code page 0x80  - serial reported
 - code page 0x83  - serial reported

so we'll fix the QEMU regression for code page 0x83, but cause a new guest ABI regression for code page 0x80 vs previous libvirt

Comment 5 Peter Krempa 2019-01-25 13:36:34 UTC
So it looks like we need a new property for passing in the old name for disks to qemu to use if serial is not provided to keep the old behaviour. Good thing is that -blockdev is not enabled yet so we can base the capability on the presence of the new property to avoid regression.

Comment 9 Peter Krempa 2019-02-08 11:15:16 UTC
Fixed upstream:

commit 6d3c96f0d965fe182040f6442f0cbeb46d10efda
Author: Peter Krempa <pkrempa@redhat.com>
Date:   Mon Jan 28 17:12:01 2019 +0100

    qemu: caps: Add lockout for -blockdev if QEMU_CAPS_SCSI_DISK_DEVICE_ID is not present
    Avoid regressions by disallowing the BLOCKDEV capability.
    Signed-off-by: Peter Krempa <pkrempa@redhat.com>

commit a1dce96236f6d35167924fa7e6a70f58f394b23c
Author: Peter Krempa <pkrempa@redhat.com>
Date:   Mon Jan 28 16:57:35 2019 +0100

    qemu: Use the 'device_id' property of SCSI disks to avoid regressing
    QEMU accidentally exposed the id of -drive (or same value as disk
    serial, if provided) in one of the identifiers visible from the guest.
    To avoid regression in case when -blockdev will be used we need to
    always specify it ourselves.

Comment 10 Han Han 2019-02-11 07:26:21 UTC
Basic test method in libvirt after -blockdev is enabled:
1. Start two scsi disks without serial number specified
2. In vm, check the serial number via:
# udevadm info --query=all --name=/dev/sda | grep ID_SERIAL

Make sure the serial numbers from disks are different.

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