Bug 1344897 - the error info is not accurate when setting the values of blkdeviotune
Summary: the error info is not accurate when setting the values of blkdeviotune
Keywords:
Status: CLOSED DEFERRED
Alias: None
Product: Red Hat Enterprise Linux Advanced Virtualization
Classification: Red Hat
Component: libvirt
Version: 8.0
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Virtualization Maintenance
QA Contact: yisun
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-06-12 09:13 UTC by lijuan men
Modified: 2020-02-11 13:17 UTC (History)
6 users (show)

Fixed In Version: libvirt-3.1.0-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-02-11 13:17:10 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description lijuan men 2016-06-12 09:13:18 UTC
Description of problem:
the error info is not accurate when setting the values of blkdeviotune

Version-Release number of selected component (if applicable):
libvirt-1.3.5-1.el7
qemu-kvm-rhev-2.6.0-5.el7
kernel-3.10.0-433.el7

How reproducible:
100%

Steps to Reproduce:
scenario 1:
When the values of total_bytes_sec and total_bytes_sec_max are both 0,total_bytes_sec_max can't be set as other values.
 	
1.set total_bytes_sec and total_bytes_sec_max as 0.
[root@localhost ~]# virsh blkdeviotune r7 vda 
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

2.set total_bytes_sec_max as other value
[root@localhost ~]# virsh blkdeviotune r7 vda --total_bytes_sec_max 123
error: Unable to change block I/O throttle
error: internal error: Unexpected error



scenario 2:If I change the corresponded *max value, then I cannot set other value any more

1.set total_bytes_sec and total_bytes_sec_max as 123 and 456.
[root@localhost ~]# virsh blkdeviotune r7 vda --total_bytes_sec 123

[root@localhost ~]# virsh blkdeviotune r7 vda --total_bytes_sec_max 456

[root@localhost ~]# virsh blkdeviotune r7 vda 
total_bytes_sec: 123
read_bytes_sec : 0
write_bytes_sec: 0
total_iops_sec : 0
read_iops_sec  : 0
write_iops_sec : 0
total_bytes_sec_max: 456
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

2.set read_bytes_sec as 789
[root@localhost ~]# virsh blkdeviotune r7 vda --read_bytes_sec 789   
error: Unable to change block I/O throttle
error: internal error: Unexpected error

3.set total_bytes_sec as 0 and 789
[root@localhost ~]# virsh blkdeviotune r7 vda --total_bytes_sec 0     
error: Unable to change block I/O throttle
error: internal error: Unexpected error

[root@localhost ~]# virsh blkdeviotune r7 vda --total_bytes_sec 789   

[root@localhost ~]# virsh blkdeviotune r7 vda 
total_bytes_sec: 789
read_bytes_sec : 0
write_bytes_sec: 0
total_iops_sec : 0
read_iops_sec  : 0
write_iops_sec : 0
total_bytes_sec_max: 456
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

Actual results:
the error info is not accurate

Expected results:
libvrit should give detailed error prompt

Additional info:

Comment 1 Martin Kletzander 2016-06-12 17:38:58 UTC
Fixed upstream with v1.3.5-194-g5f4c50d528c8:
commit 5f4c50d528c8a7297c04c485b7b2ffd8ce859682
Author: Martin Kletzander <mkletzan>
Date:   Tue Jun 7 15:24:13 2016 +0200

    qemu: Yet another check for blkdeviotune values

Comment 3 lijuan men 2016-08-24 06:55:16 UTC
there are also some scenarios where the error information is not accurate

secnario1:

[root@184pzhang rng]# virsh blkdeviotune vm2 vda --total-bytes-sec 1000

[root@184pzhang rng]# virsh blkdeviotune vm2 vda
total_bytes_sec: 1000
read_bytes_sec : 0
write_bytes_sec: 0
total_iops_sec : 0
read_iops_sec  : 0
write_iops_sec : 0
total_bytes_sec_max: 100
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

[root@184pzhang rng]# virsh blkdeviotune vm2 vda --total-bytes-sec-max 888
error: Unable to change block I/O throttle
error: internal error: Unexpected error


secnario2:

[root@184pzhang ~]# virsh blkdeviotune vm2 vda --total-bytes-sec 1000

[root@184pzhang ~]# virsh blkdeviotune vm2 vda --total-bytes-sec-max 2000

[root@184pzhang ~]# virsh blkdeviotune vm2 vda 
total_bytes_sec: 1000
read_bytes_sec : 0
write_bytes_sec: 0
total_iops_sec : 0
read_iops_sec  : 0
write_iops_sec : 0
total_bytes_sec_max: 2000
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

[root@184pzhang ~]# virsh blkdeviotune vm2 vda --total-bytes-sec 3000
error: Unable to change block I/O throttle
error: internal error: Unexpected error

scenario3:
[root@184pzhang rng]# virsh blkdeviotune vm2 vda --total-bytes-sec 1000

[root@184pzhang rng]# virsh blkdeviotune vm2 vda --total-bytes-sec-max 2000

[root@184pzhang rng]# virsh blkdeviotune vm2 vda
total_bytes_sec: 1000
read_bytes_sec : 0
write_bytes_sec: 0
total_iops_sec : 0
read_iops_sec  : 0
write_iops_sec : 0
total_bytes_sec_max: 2000
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


[root@184pzhang rng]# virsh blkdeviotune vm2 vda --read-bytes-sec 3000
error: Unable to change block I/O throttle
error: unsupported configuration: value 'total_bytes_sec_max' cannot be set if 'total_bytes_sec' is not set

[root@184pzhang rng]# virsh blkdeviotune vm2 vda --write-bytes-sec 3000
error: Unable to change block I/O throttle
error: unsupported configuration: value 'total_bytes_sec_max' cannot be set if 'total_bytes_sec' is not set

scenario4:
[root@184pzhang ~]# virsh blkdeviotune vm2 vda 
total_bytes_sec: 1400
read_bytes_sec : 0
write_bytes_sec: 0
total_iops_sec : 0
read_iops_sec  : 0
write_iops_sec : 0
total_bytes_sec_max: 2000
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

[root@184pzhang ~]# virsh blkdeviotune vm2 vda --total-bytes-sec 0
error: Unable to change block I/O throttle
error: unsupported configuration: value 'total_bytes_sec_max' cannot be set if 'total_bytes_sec' is not set

Is the error info in scenario3 and scenario4 right?

Comment 4 Martin Kletzander 2016-09-01 08:38:35 UTC
scenario 4 should give an error, maybe it could be a bit better worded, but it makes sense as it is to me as well.

All the other scenarios I cannot reproduce

Comment 5 Martin Kletzander 2016-09-01 08:56:30 UTC
sorry, I can reproduce scenario 3 and it should have a different wording, it's just a matter of changing the sentence

Comment 6 lijuan men 2016-09-01 12:49:48 UTC
(In reply to Martin Kletzander from comment #4)
> scenario 4 should give an error, maybe it could be a bit better worded, but
> it makes sense as it is to me as well.
> 
> All the other scenarios I cannot reproduce

for the scenarios 1 and 2,maybe I didn't point out some detailed info,sorry.

the version I tested:
libvirt-2.0.0-6.el7.x86_64
qemu-kvm-rhev-2.6.0-22.el7.x86_64

for scenario1:
1)set  total-bytes-sec as 1000
2)set the value of total-bytes-sec-max less than total-bytes-sec (such as 800)
you will see the error

for secnario2:
1)set  total-bytes-sec as 1000 ,total-bytes-sec-max 2000
2)set the value of total-bytes-sec more than total-bytes-sec-max(such as 3000)
you will see the error

I try the two scenarios again,I can reproduce

for scenario 3 and 4,will you fix them?

Comment 7 Martin Kletzander 2016-09-20 08:07:45 UTC
(In reply to lijuan men from comment #6)
Yes, but we need to move this to next release.

Comment 8 lijuan men 2016-09-20 08:54:06 UTC
let me summarize the scenarios again.It could be convenient for you to track the bug.

version:
libvirt-2.0.0-9.el7.x86_64
qemu-kvm-rhev-2.6.0-25.el7.x86_64


scenario 1:If I change the corresponded *max value, then I cannot set other value any more(just as the scenario2 in the bug description)

steps:
[root@localhost ~]# virsh blkdeviotune bios hda --total-bytes-sec 123

[root@localhost ~]# virsh blkdeviotune bios hda --total-bytes-sec-max 456

[root@localhost ~]# virsh blkdeviotune bios hda
total_bytes_sec: 123
read_bytes_sec : 0
write_bytes_sec: 0
total_iops_sec : 0
read_iops_sec  : 0
write_iops_sec : 0
total_bytes_sec_max: 456
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

[root@localhost ~]# virsh blkdeviotune bios hda --read_bytes_sec 789   
error: Unable to change block I/O throttle
error: unsupported configuration: value ***'total_bytes_sec_max'*** cannot be set if ***'total_bytes_sec'*** is not set

[root@localhost ~]# virsh blkdeviotune bios hda --total-bytes-sec 0
error: Unable to change block I/O throttle
error: unsupported configuration: value ***'total_bytes_sec_max' ***cannot be set if 'total_bytes_sec' is not set


scenario2:if we set the value of total-bytes-sec-max less than total-bytes-sec,the error info is not accurate

steps:
[root@184pzhang rng]# virsh blkdeviotune vm2 vda --total-bytes-sec 1000

[root@184pzhang rng]# virsh blkdeviotune vm2 vda
total_bytes_sec: 1000
read_bytes_sec : 0
write_bytes_sec: 0
total_iops_sec : 0
read_iops_sec  : 0
write_iops_sec : 0
total_bytes_sec_max: 100
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

[root@184pzhang rng]# virsh blkdeviotune vm2 vda --total-bytes-sec-max 888
error: Unable to change block I/O throttle
error: internal error: Unexpected error


scenario3:if we set the value of total-bytes-sec more than total-bytes-sec-max ,the error info is not accurate

steps:
[root@184pzhang ~]# virsh blkdeviotune vm2 vda --total-bytes-sec 1000

[root@184pzhang ~]# virsh blkdeviotune vm2 vda --total-bytes-sec-max 2000

[root@184pzhang ~]# virsh blkdeviotune vm2 vda 
total_bytes_sec: 1000
read_bytes_sec : 0
write_bytes_sec: 0
total_iops_sec : 0
read_iops_sec  : 0
write_iops_sec : 0
total_bytes_sec_max: 2000
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

[root@184pzhang ~]# virsh blkdeviotune vm2 vda --total-bytes-sec 3000
error: Unable to change block I/O throttle
error: internal error: Unexpected error

Comment 9 Martin Kletzander 2016-09-20 09:30:16 UTC
That's perfect, it will be much easier now, thanks a lot.

Comment 11 Martin Kletzander 2017-01-25 09:18:47 UTC
Patch proposed upstream:

https://www.redhat.com/archives/libvir-list/2017-January/msg00993.html

Comment 12 Martin Kletzander 2017-01-31 19:52:16 UTC
Fixed upstream with v3.0.0-79-gb42524552036:
commit b42524552036cadb99d32c5dd0d6d598721518ff
Author: Martin Kletzander <mkletzan>
Date:   Tue Jan 24 14:52:33 2017 +0100

    qemu: Add better message for some invalid block I/O settings

Comment 14 Fangge Jin 2017-03-16 09:03:07 UTC
Hi Martin

According to what's mentioned in https://bugzilla.redhat.com/show_bug.cgi?id=1270442#c0, qemu will set max to the 1/10 of avg if no max is set. But actually libvirt disallows set max smaller than avg. Is this a contradiction between libvirt and qemu?

> > [root@localhost ~]# virsh blkdeviotune vm hdb --total-bytes-sec 1000
> >
> > [root@localhost ~]# virsh blkdeviotune vm hdb
> > total_bytes_sec: 1000
> > read_bytes_sec : 0
> > write_bytes_sec: 0
> > total_iops_sec : 0
> > read_iops_sec  : 0
> > write_iops_sec : 0
> > total_bytes_sec_max: 100    <== set total_bytes_sec: 1000 will cause a total_bytes_sec_max: 100, why?
> > 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
> 
> This is a result of a qemu behaviour. The corresponding qemu code can is
> in throttle_fix_bucket() in util/throttle.c:
> 
> http://git.qemu.org/?p=qemu.git;a=blob;f=util/throttle.c;
> h=f976ac7de585da8683811b1275001cf73c71c636;hb=HEAD#l294
> 
> So setting an average, but not setting the max (i.e. setting
> total-bytes-sec but not total-bytes-sec-max) will result in qemu setting
> max to the 1/10 of avg. This is a result of the throttling algorithm
> used in qemu. It just needs both.

Comment 15 Pei Zhang 2017-03-16 09:43:16 UTC
If what I understand is correct, it should be like following :

1. As default, *-max =  avg / 10, in order to get better performance.
Refer to : https://bugzilla.redhat.com/show_bug.cgi?id=1355665#c4
 
2. QEMU bug : Bug 1355665 - Suggest to limit the burst value to be not less than the throttle value
This bug fix make sure bps_max / iops_max setting cannnot be lower than bps/iops.

3. the logic in libvirt about xxx* and xxx*_max in this bug :
https://bugzilla.redhat.com/show_bug.cgi?id=1329041#c15

Comment 16 Martin Kletzander 2017-03-20 06:53:05 UTC
(In reply to JinFangge from comment #14)
No, it is not, QEMU itself has that limitation:

$ virsh qemu-monitor-command fedora '{"execute":"block_set_io_throttle","arguments":{"device":"drive-virtio-disk0","bps":0,"bps_rd":0,"bps_wr":1024024,"iops":0,"iops_rd":0,"iops_wr":0,"bps_max":0,"bps_rd_max":0,"bps_wr_max":1024,"iops_max":0,"iops_rd_max":0,"iops_wr_max":0,"iops_size":0}}'
{"id":"libvirt-21","error":{"class":"GenericError","desc":"bps_max/iops_max cannot be lower than bps/iops"}}

Libvirt cannot guarantee what the settings are if they are made only inside QEMU as there is no way to probe for those (There is no 'block_get_io_throttle' command).

Comment 17 lijuan men 2017-05-31 09:56:09 UTC
according to comment 8,test these scenarios again,but there are still some problems

version:
libvirt-3.2.0-6.el7.x86_64
qemu-kvm-rhev-2.9.0-7.el7.x86_64

steps:


scenario1:
1)when the guest is running ,
[root@lmen1 ~]# virsh blkdeviotune  uefi sda   --total-bytes-sec 123

[root@lmen1 ~]# virsh blkdeviotune  uefi sda   --total-bytes-sec-max 456

[root@lmen1 ~]# virsh blkdeviotune  uefi sda 
total_bytes_sec: 123
read_bytes_sec : 0
write_bytes_sec: 0
total_iops_sec : 0
read_iops_sec  : 0
write_iops_sec : 0
total_bytes_sec_max: 456
read_bytes_sec_max: 0
write_bytes_sec_max: 0
...

[root@lmen1 ~]# virsh blkdeviotune  uefi sda --read_bytes_sec 789     
error: Unable to change block I/O throttle
error: unsupported configuration: cannot reset 'total_bytes_sec' when 'total_bytes_sec_max' is set

  -->the error is the same in comment 8,not accurate


2)when the guest is down:
[root@lmen1 ~]# virsh destroy uefi
Domain uefi destroyed

[root@lmen1 ~]# virsh blkdeviotune  uefi sda 
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
...


[root@lmen1 ~]# virsh blkdeviotune  uefi sda   --total-bytes-sec 123

[root@lmen1 ~]# virsh blkdeviotune  uefi sda   --total-bytes-sec-max 456

[root@lmen1 ~]# virsh blkdeviotune  uefi sda 
total_bytes_sec: 123
read_bytes_sec : 0
write_bytes_sec: 0
total_iops_sec : 0
read_iops_sec  : 0
write_iops_sec : 0
total_bytes_sec_max: 456
read_bytes_sec_max: 0
...

[root@lmen1 ~]# virsh blkdeviotune  uefi sda --read_bytes_sec 789   --->success

[root@lmen1 ~]# virsh blkdeviotune  uefi sda 
total_bytes_sec: 0
read_bytes_sec : 789
write_bytes_sec: 0
total_iops_sec : 0
read_iops_sec  : 0
write_iops_sec : 0
total_bytes_sec_max: 456   -->should it be 0?
read_bytes_sec_max: 0
write_bytes_sec_max: 0
total_iops_sec_max: 0
...

[root@lmen1 ~]# virsh start uefi    --can't start the guest
error: Failed to start domain uefi
error: internal error: process exited while connecting to monitor: profiling:/builddir/build/BUILD/libvirt-3.2.0/src/access/.libs/libvirt_driver_access_la-viraccessdriverpolkit.gcda:Cannot open
profiling:/builddir/build/BUILD/libvirt-3.2.0/src/access/.libs/libvirt_driver_access_la-viraccessapichecklxc.gcda:Cannot open
profiling:/builddir/build/BUILD/libvirt-3.2.0/src/access/.libs/libvirt_driver_access_la-viraccessapicheckqemu.gcda:Cannot open
profiling:/builddir/build/BUILD/libvirt-3.2.0/src/access/.libs/libvirt_driver_access_la-viraccessapicheck.gcda:Cannot open
profiling:/builddir/build/BUILD/libvirt-3.2.0/src/access/.libs/libvirt_driver_access_la-viraccessdriverstack.gcda:Cannot open
profiling:/builddir/build/BUILD/libvirt-3.2.0/src/access/.libs/libvirt_driver_access_la-viraccessdrivernop.gcda:Cannot open
profiling:/builddir/build/BUILD/libvirt-3.2.0/src/access/.libs/libvirt_driver_access_la-viraccessmanager.gcda:Cannot open
profiling:/builddir/build/BUILD/libvirt-3.2.0/src/access/.libs/libvirt_driver_access_la-viraccessperm.g



for scenario2:
1)when the guest is down

[root@lmen1 ~]# virsh destroy uefi
Domain uefi destroyed

[root@lmen1 ~]# 
[root@lmen1 ~]# virsh blkdeviotune  uefi sda   --total-bytes-sec 1000

[root@lmen1 ~]# virsh blkdeviotune  uefi sda   --total-bytes-sec-max 888   -->success

[root@lmen1 ~]# virsh blkdeviotune  uefi sda  
total_bytes_sec: 1000
read_bytes_sec : 0
write_bytes_sec: 0
total_iops_sec : 0
read_iops_sec  : 0
write_iops_sec : 0
total_bytes_sec_max: 888
read_bytes_sec_max: 0
write_bytes_sec_max: 0
...

[root@lmen1 ~]# virsh start uefi
error: Failed to start domain uefi
error: internal error: process exited while connecting to monitor: profiling:/builddir/build/BUILD/libvirt-3.2.0/src/access/.libs/libvirt_driver_access_la-viraccessdriverpolkit.gcda:Cannot open
profiling:/builddir/build/BUILD/libvirt-3.2.0/src/access/.libs/libvirt_driver_access_la-viraccessapichecklxc.gcda:Cannot open
profiling:/builddir/build/BUILD/libvirt-3.2.0/src/access/.libs/libvirt_driver_access_la-viraccessapicheckqemu.gcda:Cannot open
profiling:/builddir/build/BUILD/libvirt-3.2.0/src/access/.libs/libvirt_driver_access_la-viraccessapicheck.gcda:Cannot open
profiling:/builddir/build/BUILD/libvirt-3.2.0/src/access/.libs/libvirt_driver_access_la-viraccessdriverstack.gcda:Cannot open
profiling:/builddir/build/BUILD/libvirt-3.2.0/src/access/.libs/libvirt_driver_access_la-viraccessdrivernop.gcda:Cannot open
profiling:/builddir/build/BUILD/libvirt-3.2.0/src/access/.libs/libvirt_driver_access_la-viraccessmanager.gcda:Cannot open
profiling:/builddir/build/BUILD/libvirt-3.2.0/src/access/.libs/libvirt_driver_access_la-viraccessperm.g


2)when the guest is running   -->result is right
[root@lmen1 ~]# virsh list
 Id    Name                           State
----------------------------------------------------
 69    uefi                           running

[root@lmen1 ~]# virsh blkdeviotune  uefi sda   --total-bytes-sec 1000

[root@lmen1 ~]# virsh blkdeviotune  uefi sda   --total-bytes-sec-max 888
error: Unable to change block I/O throttle
error: unsupported configuration: value 'total_bytes_sec_max' cannot be smaller than 'total_bytes_sec'

scenario3:
similar with scenario2
2)when the guest is down,total-bytes-sec-max can be smaller than total_bytes_sec,and the guest can't start 
2)when the guest is running,total-bytes-sec-max can't be smaller than total_bytes_sec,the error is right

Comment 18 Martin Kletzander 2017-05-31 15:48:43 UTC
Scenario 1:  It is not the same, I changed it to "cannot reset", so now it tells you you cannot reset 'total_bytes_sec' (which you requested by setting read_bytes_sec).  That is the reason.

For the rest we really need to redo lot of that, it's so confusing.  And the lengthiness of this BZ certainly doesn't help.

Comment 22 Jaroslav Suchanek 2020-02-11 13:17:10 UTC
This bug was closed deferred as a result of bug triage.

Please reopen if you disagree and provide justification why this bug should
get enough priority. Most important would be information about impact on
customer or layered product. Please indicate requested target release.


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