Bug 1164080 - libvirt do a wrong check for the hot-unplug disk when use blkdeviotune --config
Summary: libvirt do a wrong check for the hot-unplug disk when use blkdeviotune --config
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.1
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: John Ferlan
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-11-14 03:48 UTC by Luyao Huang
Modified: 2015-11-19 05:55 UTC (History)
6 users (show)

Fixed In Version: libvirt-1.2.13-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-19 05:55:52 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2202 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2015-11-19 08:17:58 UTC

Description Luyao Huang 2014-11-14 03:48:36 UTC
Description of problem:
libvirt do a wrong check for the hot-unplug disk when use blkdeviotune --config


Version-Release number of selected component (if applicable):
libvirt-1.2.8-6.el7.x86_64


How reproducible:
100%

Steps to Reproduce:

1.# virsh start r6
Domain r6 started

2.# virsh domblklist r6
Target     Source
------------------------------------------------
vda        gluster-vol1/rh6.img
sdb        iqn.2003-01.org.linux-iscsi.test1.x8664:sn.05011d8e73cb/0
sdc        /var/lib/libvirt/images/r6.img
hdc        /tmp/test.iso

3.# virsh detach-disk r6 sdb
Disk detached successfully

4.# virsh domblklist r6
Target     Source
------------------------------------------------
vda        gluster-vol1/rh6.img
sdc        /var/lib/libvirt/images/r6.img
hdc        /tmp/test.iso

# virsh blkdeviotune r6 sdb
error: Unable to get block I/O throttle parameters
error: invalid argument: No device found for specified path

# virsh domblklist r6 --inactive
Target     Source
------------------------------------------------
vda        gluster-vol1/rh6.img
sdb        iqn.2003-01.org.linux-iscsi.test1.x8664:sn.05011d8e73cb/0
sdc        /var/lib/libvirt/images/r6.img
hdc        /tmp/test.iso

# virsh blkdeviotune r6 sdb --config
error: Unable to get block I/O throttle parameters
error: invalid argument: No device found for specified path

Expected results:

# virsh domblklist r6 --inactive
Target     Source
------------------------------------------------
vda        gluster-vol1/rh6.img
sdb        iqn.2003-01.org.linux-iscsi.test1.x8664:sn.05011d8e73cb/0
sdc        /var/lib/libvirt/images/r6.img
hdc        /tmp/test.iso

# virsh blkdeviotune r6 sdb --config
total_bytes_sec: 0
read_bytes_sec : 0
write_bytes_sec: 0
total_iops_sec : 0
read_iops_sec  : 0
write_iops_sec : 0

Additional info:

I have sent a patch to upstream:

https://www.redhat.com/archives/libvir-list/2014-November/msg00514.html

Comment 1 John Ferlan 2014-11-14 22:30:17 UTC
Note that because no flag was given on:

# virsh blkdeviotune r6 sdb
error: Unable to get block I/O throttle parameters
error: invalid argument: No device found for specified path

#

This is the same as passing --current.  Since the vm is running/active, the AFFECT_LIVE path will be used and you'll still see a failure.  That's expected.

The case that is broken however is the --config path


I tested the patch on my system and got:

# virsh blkdeviotune rh64 vdb
total_bytes_sec: 0
read_bytes_sec : 0
write_bytes_sec: 0
total_iops_sec : 0
read_iops_sec  : 0
write_iops_sec : 0

# virsh detach-disk rh64 vdb
Disk detached successfully

# virsh blkdeviotune rh64 vdb --config
total_bytes_sec: 0
read_bytes_sec : 0
write_bytes_sec: 0
total_iops_sec : 0
read_iops_sec  : 0
write_iops_sec : 0
total_bytes_sec_max: 0
read_bytes_sec_max: 0
write_bytes_sec_max: 0
total_iops_sec_max: 0
read_iops_sec_max: 0
write_iops_sec_max: 0
size_iops_sec  : 0

# virsh blkdeviotune rh64 vdb --live
error: Unable to get block I/O throttle parameters
error: invalid argument: No device found for specified path

# virsh blkdeviotune rh64 vdb --current
error: Unable to get block I/O throttle parameters
error: invalid argument: No device found for specified path

# virsh blkdeviotune rh64 vdb
error: Unable to get block I/O throttle parameters
error: invalid argument: No device found for specified path

#

You will note that yes, there are more parameters for the 'config' path than the live/current path.  While interesting it's not surprising given that this config has:

# /usr/bin/qemu-kvm --version
QEMU emulator version 1.6.2, Copyright (c) 2003-2008 Fabrice Bellard

and the 'new' parameters require 1.7 installed.

The only other thing interesting is the output of the tune params isn't aligned for the new params...

Comment 2 Luyao Huang 2014-11-15 08:18:31 UTC
(In reply to John Ferlan from comment #1)
> Note that because no flag was given on:
> 
> # virsh blkdeviotune r6 sdb
> error: Unable to get block I/O throttle parameters
> error: invalid argument: No device found for specified path
> 
> #
> 
> This is the same as passing --current.  Since the vm is running/active, the
> AFFECT_LIVE path will be used and you'll still see a failure.  That's
> expected.

Yes, this is expected.When doesn't pass any plags means blkdeviotune --current.

> 
> The case that is broken however is the --config path
> 

That is what i want to say, this is main point of this bug.Sorry, i forgot give a clearly description in this step.


> 
> I tested the patch on my system and got:
> 
> # virsh blkdeviotune rh64 vdb
> total_bytes_sec: 0
> read_bytes_sec : 0
> write_bytes_sec: 0
> total_iops_sec : 0
> read_iops_sec  : 0
> write_iops_sec : 0
> 
> # virsh detach-disk rh64 vdb
> Disk detached successfully
> 
> # virsh blkdeviotune rh64 vdb --config
> total_bytes_sec: 0
> read_bytes_sec : 0
> write_bytes_sec: 0
> total_iops_sec : 0
> read_iops_sec  : 0
> write_iops_sec : 0
> total_bytes_sec_max: 0
> read_bytes_sec_max: 0
> write_bytes_sec_max: 0
> total_iops_sec_max: 0
> read_iops_sec_max: 0
> write_iops_sec_max: 0
> size_iops_sec  : 0
> 
> # virsh blkdeviotune rh64 vdb --live
> error: Unable to get block I/O throttle parameters
> error: invalid argument: No device found for specified path
> 
> # virsh blkdeviotune rh64 vdb --current
> error: Unable to get block I/O throttle parameters
> error: invalid argument: No device found for specified path
> 
> # virsh blkdeviotune rh64 vdb
> error: Unable to get block I/O throttle parameters
> error: invalid argument: No device found for specified path
> 
> #
> 
> You will note that yes, there are more parameters for the 'config' path than
> the live/current path.  While interesting it's not surprising given that
> this config has:
> 
> # /usr/bin/qemu-kvm --version
> QEMU emulator version 1.6.2, Copyright (c) 2003-2008 Fabrice Bellard
> 
> and the 'new' parameters require 1.7 installed.
> 
> The only other thing interesting is the output of the tune params isn't
> aligned for the new params...

So interesting, your qemu is a upstream qemu, am i right?
Eww, i found i cannot test this in my fedora( What a pity :( ).
# rpm -q qemu-kvm
qemu-kvm-1.6.2-9.fc20.x86_64
# rpm -q libvirt
libvirt-1.1.3.6-2.fc20.x86_64


Thanks in advance for your expectations, and i will give a more clearly description when i file bug next time.

Comment 3 John Ferlan 2014-11-15 13:32:02 UTC
Well funny thing about my system - I do build and install the upstream qemu; however, I never modified my yum.conf to not update the qemu when an update is ready (as found through yum update) on my f20 system.  So when the last yum update ran, it overwrite my local build (I've since resolved that).

No problem about the description - I would probably have all sorts of problems typing in a different language than my what my fingers know natively

Comment 6 John Ferlan 2015-05-11 12:45:24 UTC
This was pushed upstream during 1.2.11 - it seems doing proper bug triage was forgotten... Moving to MODIFIED since it's already in a downstream libvirt.

$ git show 72b4151f858df3564b82a8ebba60778b996b6dce
commit 72b4151f858df3564b82a8ebba60778b996b6dce
Author: Luyao Huang <lhuang@redhat.com>
Date:   Fri Nov 14 11:21:10 2014 +0800

    qemu: Fix get blkiodevtune for a disk that has been hot unplugged
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1164080
    
    After a disk is hotunplugged a subsequent call to qemuDomainGetBlockIoTune
    to get the --config settings of that disk will fail because the disk is no
    longer found by qemuDiskPathToAlias causing an unexpected failure.
    
    Since only the --live flag needs to have the disk device pointer, move the
    fetch inside the (flags & VIR_DOMAIN_AFFECT_LIVE) condition. This will also
    affect the results if no flags are provided or the --current flag is provided.

Comment 8 yisun 2015-09-10 03:00:24 UTC
verified on:
libvirt-1.2.17-8.el7.x86_64
qemu-kvm-rhev-2.3.0-22.el7.x86_64
# uname -r
3.10.0-314.el7.x86_64


Steps:

# virsh domblklist rhel1
Target     Source
------------------------------------------------
vda        /home/pool/rhel.qcow2
sda        /home/pool/test.qcow2


# virsh detach-disk rhel1 sda
Disk detached successfully

# virsh blkdeviotune rhel1 sda --config   //successful as expected
total_bytes_sec: 0
read_bytes_sec : 0
write_bytes_sec: 0
total_iops_sec : 0
read_iops_sec  : 0
write_iops_sec : 0
total_bytes_sec_max: 0
read_bytes_sec_max: 0
write_bytes_sec_max: 0
total_iops_sec_max: 0
read_iops_sec_max: 0
write_iops_sec_max: 0
size_iops_sec  : 0


# virsh blkdeviotune rhel1 sda --current   // failed as expected
error: Unable to get block I/O throttle parameters
error: invalid argument: No device found for specified path


# virsh blkdeviotune rhel1 sda --live  // failed as expected
error: Unable to get block I/O throttle parameters
error: invalid argument: No device found for specified path

Comment 10 errata-xmlrpc 2015-11-19 05:55:52 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-2202.html


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