Bug 1131821

Summary: Libvirtd crash while set blkdeviotune with the hotplug disk and specify the --config option
Product: Red Hat Enterprise Linux 6 Reporter: zhenfeng wang <zhwang>
Component: libvirtAssignee: Peter Krempa <pkrempa>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.6CC: dyuan, lhuang, libvirt-maint, mzhan, rbalakri, shyu, virt-bugs, ydu
Target Milestone: rcKeywords: Upstream
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-0.10.2-48.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1131819 Environment:
Last Closed: 2015-07-22 05:46:38 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:
Bug Depends On: 1131819    
Bug Blocks:    

Description zhenfeng wang 2014-08-20 06:38:42 UTC
+++ This bug was initially created as a clone of Bug #1131819 +++

Description of problem:
Libvirtd crash while set blkdeviotune with the hotplug disk and specify the --config option

Version-Release number of selected component (if applicable):
libvirt-1.2.7-1.el7.x86_64
qemu-kvm-rhev-2.1.0-1.el7.x86_64
kernel-3.10.0-142.el7.x86_64


How reproducible:
100%

Steps to Reproduce:
1.Prepare a running guest
# virsh list --all
 Id    Name                           State
----------------------------------------------------
 -     rhel6                          shut off

2.Create a img
#qemu-img create /var/lib/libvirt/images/test.img 1G

3.Attach the disk to the guest
#virsh attach-disk rhel6 /var/lib/libvirt/images/test.img vdb

4.Set io parameters for the vdb and specify the --config option, the libvirtd crashs

Check the libvirtd pid before the operation
# ps aux|grep libvirtd
root     26323  4.5  0.2 540600 17784 ?        Ssl  10:51   0:00 /usr/sbin/libvirtd


# virsh blkdeviotune rhel6 vdb --write-iops-sec 10 --config
error: Unable to change block I/O throttle
error: End of file while reading data: Input/output error
error: Failed to reconnect to the hypervisor

re-check the libvirtd pid, the pid changes

# ps aux|grep libvirtd
root     30602  0.2  0.2 614332 17852 ?        Ssl  11:03   0:00 /usr/sbin/libvirtd

5.The coredump info was in the attachment

Actual results:
Libvirtd crash while set blkdeviotune with the hotplug disk and specify the --config option

Expected results:
shouldn't crash

--- Additional comment from zhenfeng wang on 2014-08-20 02:37:44 EDT ---

Comment 2 zhenfeng wang 2014-08-20 06:53:27 UTC
Since i can't reproduce this issue with the libvirt-0.10.2-42.el6.x86_64.rpm, so  maybe this issue is a regression issue, please help check it, thanks

Comment 3 Peter Krempa 2014-08-20 09:10:16 UTC
Fixed upstream:

commit 653137eb957a278b556c6226424aad5395a38a61
Author: Peter Krempa <pkrempa>
Date:   Wed Aug 20 10:49:49 2014 +0200

    qemu: blkiotune: Avoid accessing non-existing disk configuration
    
    When a user would try changing the persistent IO tuning settings for a
    disk that was hotplugged to a vm in a transient way, the
    qemuDomainSetBlockIoTune API would use the same index for both the
    live and config disk array. The disk was missing from the config array
    though causing a crash of libvirtd.
    
    To fix the issue, determine the indexes separately.

v1.2.7-180-g653137e

Comment 6 Luyao Huang 2015-02-02 05:39:48 UTC
I can reproduce this bug with libvirt-0.10.2-46.el6.x86_64:

1. prepare a running vm:
# virsh list --all
 Id    Name                           State
----------------------------------------------------
 2     r6                             running

2. hot-plug a disk 
# virsh attach-disk r6 /var/lib/libvirt/images/test6.img sda
Disk attached successfully

3.use blkdeviotune set the value to hotplug disk
# virsh blkdeviotune r6 sda 1234 --config
error: Unable to change block I/O throttle
error: End of file while reading data: Input/output error
error: One or more references were leaked after disconnect from the hypervisor
error: Failed to reconnect to the hypervisor

And verify this bug with libvirt-0.10.2-48.el6.x86_64:

1.update libvirt to libvirt-0.10.2-48.el6.x86_64 and use blkdeviotune set the value to hotplug disk:

# virsh blkdeviotune r6 sda 1234 --config
error: Unable to change block I/O throttle
error: invalid argument: missing persistent configuration for disk 'sda'

2. restart the vm:
# virsh destroy  r6
Domain r6 destroyed

# virsh start r6
Domain r6 started

3.hot-plug a disk:
# virsh attach-disk r6 /var/lib/libvirt/images/test6.img sda
Disk attached successfully

4. set blk tune to the hot-plug disk:
# virsh blkdeviotune r6 sda 1123 --config 
error: Unable to change block I/O throttle
error: invalid argument: missing persistent configuration for disk 'sda'

Comment 8 errata-xmlrpc 2015-07-22 05:46:38 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://rhn.redhat.com/errata/RHBA-2015-1252.html