Bug 1741838

Summary: qomid was null when start a VM with disk iotune and customized alias, blockdev enabled
Product: Red Hat Enterprise Linux Advanced Virtualization Reporter: Han Han <hhan>
Component: libvirtAssignee: Peter Krempa <pkrempa>
Status: CLOSED ERRATA QA Contact: Han Han <hhan>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.1CC: dyuan, jdenemar, knoel, meili, xuzhang
Target Milestone: rc   
Target Release: 8.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-5.6.0-3.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-11-06 07:18:55 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:
Attachments:
Description Flags
The libvirtd log of step1
none
More detailed libvirtd log none

Description Han Han 2019-08-16 08:29:13 UTC
Created attachment 1604309 [details]
The libvirtd log of step1

Description of problem:
As subject

Version-Release number of selected component (if applicable):
libvirt-5.6.0-1.module+el8.1.0+3890+4d3d259c.x86_64
qemu-kvm-4.1.0-1.module+el8.1.0+3966+4a23dca1.x86_64

How reproducible:
100%

Steps to Reproduce:
1. start a VM with disk iotune and customized alias, blockdev enabled
VM xml:
<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
...    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/copy.qcow2'/>
      <target dev='vda' bus='virtio'/>
      <iotune>
        <total_bytes_sec>500000</total_bytes_sec>
      </iotune>
      <alias name='ua-a'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0c' function='0x0'/>
    </disk>
...
  <qemu:capabilities>
    <qemu:add capability='blockdev'/>
  </qemu:capabilities>
</domain>

# virsh start copy
error: Failed to start domain copy
error: internal error: unable to execute 'block_set_io_throttle', unexpected error: 'Need exactly one of 'device' and 'id''

The log of block_set_io_throttle parameters:
Aug 16 16:16:56 lab.rhel8.me libvirtd[15758]: drivealias=<null>, qomid=<null>, info=0x7fca80317f80

The log of block_set_io_throttle parameters when -blockdev disabled:
Aug 16 16:16:24 lab.rhel8.me libvirtd[15758]: drivealias=<null>, qomid=/machine/peripheral/virtio-disk0/virtio-backend, info=0x7fca84312c70

Actual results:
As above

Expected results:
VM Started

Additional info:

Comment 1 Han Han 2019-08-16 08:49:30 UTC
Created attachment 1604312 [details]
More detailed libvirtd log

Comment 2 Peter Krempa 2019-08-26 13:12:32 UTC
Fixed upstream:

commit b8222be5831261578e60ce2e867a968a6f80f67d
Author: Peter Krempa <pkrempa>
Date:   Fri Aug 16 17:01:10 2019 +0200

    qemu: alias: Generate 'qomName' of disk with useraliases
    
    Commit fb64e176f4f forgot to delete the check that short-circuits the
    disk alias creation if the alias is already present. The side effect
    of this is that the creation qomName which is necessary to be able to
    refer to disk frontends when -blockdev is used was skipped when user
    aliases are used.
    
    Fix it by deleting the check. Also prevent any potential memory leaks
    from calling this function repeatedly by creating the qomName only when
    it's not present.

v5.6.0-339-gb8222be583

Comment 5 Han Han 2019-09-03 03:06:53 UTC
Version:
libvirt-5.6.0-3.module+el8.1.0+4110+a6d45c3d.x86_64
qemu-kvm-4.1.0-5.module+el8.1.0+4076+b5e41ebc.x86_6

Steps:
Start vm as following disk xml variants:
iotune: yes
alias: with custom alias, without custom alias
disk type: virtio, scsi

1. custom alias, virtio disk
# virsh dumpxml copy|xmllint --xpath //disk -
<disk type="file" device="disk">
      <driver name="qemu" type="qcow2"/>
      <source file="/var/lib/libvirt/images/copy.qcow2"/>
      <target dev="vda" bus="virtio"/>
      <iotune>
        <total_bytes_sec>50000000</total_bytes_sec>
      </iotune>
      <alias name="ua-a"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x0d" function="0x0"/>
    </disk>

# virsh start copy                           
Domain copy startedl

2. no custom alias, virtio disk
➜  ~ virsh dumpxml copy|xmllint --xpath //disk -
<disk type="file" device="disk">
      <driver name="qemu" type="qcow2"/>
      <source file="/var/lib/libvirt/images/copy.qcow2"/>
      <target dev="vda" bus="virtio"/>
      <iotune>
        <total_bytes_sec>50000000</total_bytes_sec>
      </iotune>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x0d" function="0x0"/>
    </disk>#                                                                                                                                                                ➜  ~ ~

 virsh start copy                           
Domain copy started

3. custom alias, scsi disk
➜  ~ virsh dumpxml copy|xmllint --xpath //disk -
<disk type="file" device="disk">
      <driver name="qemu" type="qcow2"/>
      <source file="/var/lib/libvirt/images/copy.qcow2"/>
      <target dev="sda" bus="scsi"/>
      <iotune>
        <total_bytes_sec>50000000</total_bytes_sec>
      </iotune>
      <alias name="ua-a"/>
      <address type="drive" controller="0" bus="0" target="0" unit="0"/>
    </disk>#                                                                                                                                                                ➜  ~ virsh start copy
Domain copy started

4. no custom alias, scsi disk
➜  ~ virsh dumpxml copy|xmllint --xpath //disk -
<disk type="file" device="disk">
      <driver name="qemu" type="qcow2"/>
      <source file="/var/lib/libvirt/images/copy.qcow2"/>
      <target dev="sda" bus="scsi"/>
      <iotune>
        <total_bytes_sec>50000000</total_bytes_sec>
      </iotune>
      <address type="drive" controller="0" bus="0" target="0" unit="0"/>
    </disk>#                                                                                                                                                                ➜  ~ virsh start copy                           
Domain copy started

Works as expected.

Comment 7 errata-xmlrpc 2019-11-06 07:18:55 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/RHBA-2019:3723