Bug 1131811 - The iotune element will disappear from the guest's xml while set an invalid value
Summary: The iotune element will disappear from the guest's xml while set an invalid v...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.1
Hardware: x86_64
OS: Unspecified
unspecified
medium
Target Milestone: rc
: ---
Assignee: Erik Skultety
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks: 1131813
TreeView+ depends on / blocked
 
Reported: 2014-08-20 06:30 UTC by zhenfeng wang
Modified: 2015-03-05 07:42 UTC (History)
6 users (show)

Fixed In Version: libvirt-1.2.8-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1131813 (view as bug list)
Environment:
Last Closed: 2015-03-05 07:42:46 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:0323 0 normal SHIPPED_LIVE Low: libvirt security, bug fix, and enhancement update 2015-03-05 12:10:54 UTC

Description zhenfeng wang 2014-08-20 06:30:42 UTC
Description of problem:
The iotune element will disappear from the guest's xml while set an invalid value

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 normal guest
# virsh list --all
 Id    Name                           State
----------------------------------------------------
 -     rhel6                          shut off

2.Set io parameters for a block device of domain
# virsh domblklist rhel6
Target     Source
------------------------------------------------
hda        /var/lib/libvirt/images/rhel6.img

# virsh blkdeviotune rhel6 hda --write-iops-sec 10 --config

3.Check the setting works
# virsh blkdeviotune rhel6 hda
total_bytes_sec: 0
read_bytes_sec : 0
write_bytes_sec: 0
total_iops_sec : 0
read_iops_sec  : 0
write_iops_sec : 10

# virsh dumpxml rhel6 |grep iotune -A 1
      <iotune>
        <write_iops_sec>10</write_iops_sec>
      </iotune>

4.Edit the guest's xml set an invalid iotune value

#virsh edit rhel6
--
<iotune>
        <write_iops_sec>10a</write_iops_sec>
      </iotune>


:wq   //---save the guest's xml

5.Re-check the  io parameters for the block device of domain , the configuration
about the iotune have gone.

# virsh blkdeviotune rhel6 hda
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 dumpxml rhel6  |grep iotune
#

Actual results:
The iotune element will disappear from the guest's xml while set an invalid value

Expected results:
Should report an error while save the guest's xml with an invalid value, and
the configuration about the iotune shouldn't disappear, we should get an expect
error just like following

# virsh edit rhel6
--
<vcpu placement='static'>1a</vcpu>

:wq  //--save the guest's xml
error: XML error: maximum vcpus must be an integer
Failed. Try again? [y,n,f,?]:

Comment 2 Erik Skultety 2014-08-26 07:22:29 UTC
Fixed upstream:

commit d60c33c6b5f84eb1468054374f5272189477f713
Author: Erik Skultety <eskultet@redhat.com>
Date:   Mon Aug 25 10:50:12 2014 +0200

    iotune: setting an invalid value now reports error
    
    When trying to set an invalid value into iotune element, standard
    behavior was to not report any error, rather to reset all affected
    subelements of the iotune element back to 0 which results in ignoring
    those particular subelements by XML generator. Patch further
    examines the return code of the virXPathULongLong function
    and in case of an invalid non-integer value raises an error.
    Fixed to preserve consistency with invalid value checking
    of other elements.
    
    Resolves https://bugzilla.redhat.com/show_bug.cgi?id=1131811

v1.2.7-224-gd60c33c

Comment 4 zhengqin 2014-09-10 06:40:22 UTC
Verify this issue with build libvirt-1.2.8-1.el7.x86_64:

Verify steps:
1.Prepare a normal guest
# virsh list --all
 Id    Name                           State
----------------------------------------------------
 -     rhel6                          shut off

2.Set io parameters for a block device of domain
# virsh domblklist rhel6
Target     Source
------------------------------------------------
hda        /var/lib/libvirt/images/rhel6.img

# virsh blkdeviotune rhel6 hda --write-iops-sec 10 --config

3.Check the setting works
# virsh blkdeviotune rhel6 hda
total_bytes_sec: 0
read_bytes_sec : 0
write_bytes_sec: 0
total_iops_sec : 0
read_iops_sec  : 0
write_iops_sec : 10

# virsh dumpxml rhel6 |grep iotune -A 1
      <iotune>
        <write_iops_sec>10</write_iops_sec>
      </iotune>

4.Edit the guest's xml set an invalid iotune value

#virsh edit rhel6
--
<iotune>
        <write_iops_sec>10a</write_iops_sec>
      </iotune>


:wq   //---save the guest's xml

Result:
An error will show to prevent saving xml, and only integer will be acceptable.
-----------------------------------------
error: XML error: write I/O operations limit must be an integer
Failed. Try again? [y,n,f,?]:
-----------------------------------------

Comment 5 Erik Skultety 2014-09-10 07:28:28 UTC
verified with libvirt-1.2.8-1, got the same behavior as expected

Comment 6 vivian zhang 2014-12-01 08:59:25 UTC
I can produce this bug on build qemu-kvm-rhev-2.1.0-1.el7.x86_64 libvirt-1.2.7-1.el7.x86_64

verify it on build
libvirt-1.2.8-9.el7.x86_64
qemu-kvm-rhev-2.1.2-14.el7.x86_64
3.10.0-208.el7.x86_64

verify steps

1. prepare a guest in shutoff with iotune tage in xml
# virsh list --all
 Id    Name                           State
----------------------------------------------------
-     rhel7new                       shut off

# virsh edit rhel7new
...
<iotune>
        <read_bytes_sec>10</read_bytes_sec>
        <write_bytes_sec>10</write_bytes_sec>
        <read_iops_sec>10</read_iops_sec>
        <write_iops_sec>10</write_iops_sec>
      </iotune>
...
2. check xml configuration has been validated

# virsh blkdeviotune rhel7new hda
total_bytes_sec: 0
read_bytes_sec : 10
write_bytes_sec: 10
total_iops_sec : 0
read_iops_sec  : 10
write_iops_sec : 10

3. modify guest xml to invalid value and wq, xml check with error
# virsh edit rhel7new
...
<iotune>
        <read_bytes_sec>aa</read_bytes_sec>
        <write_bytes_sec>10</write_bytes_sec>
        <read_iops_sec>10</read_iops_sec>
        <write_iops_sec>10</write_iops_sec>
      </iotune>
...

# virsh edit rhel7new
error: XML error: read throughput limit must be an integer
Failed. Try again? [y,n,f,?]:

the same result to read_bytes_sec, write_bytes_sec, total_bytes_sec, read_iops_sec, write_iops_sec and total_iops_sec

move to verified

Comment 8 errata-xmlrpc 2015-03-05 07:42:46 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/RHSA-2015-0323.html


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