Bug 1601677 - update virtual disk with iotune group name returns success but no change
Summary: update virtual disk with iotune group name returns success but no change
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux Advanced Virtualization
Classification: Red Hat
Component: libvirt
Version: 8.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: 8.0
Assignee: Ján Tomko
QA Contact: Han Han
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-07-17 03:12 UTC by yafu
Modified: 2020-11-14 06:27 UTC (History)
7 users (show)

Fixed In Version: libvirt-5.0.0-9.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-08-07 10:41:09 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2019:2395 0 None None None 2019-08-07 10:41:35 UTC

Description yafu 2018-07-17 03:12:28 UTC
Description of problem:
update virtual disk with iotune group name returns success but no change

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

How reproducible:
100%

Steps to Reproduce:
1.Prepare a virtual disk xml with iotune:
#cat disk.xml 
<disk type='block' device='disk'>
      <driver name='qemu' type='raw'/>
      <source dev='/dev/vg/lv01'/>
      <target dev='vdb' bus='virtio'/>
      <iotune>
        <read_bytes_sec>3000</read_bytes_sec>
        <write_bytes_sec>4000</write_bytes_sec>
        <read_iops_sec>2000</read_iops_sec>
        <write_iops_sec>1000</write_iops_sec>
        <group_name>group1</group_name>
      </iotune>
      <alias name='ua-sdfjsldklwetltklret-sdfsdfsf'/>
      <address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0'/>
    </disk>

2.Attach it to a running guest:
#virsh attach-device iommu1 disk.xml
Device attached successfully

3.Query the group name:
#virsh blkdeviotune iommu1 vdb
total_bytes_sec: 0
read_bytes_sec : 2000
write_bytes_sec: 4000
total_iops_sec : 0
read_iops_sec  : 2000
write_iops_sec : 1000
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
group_name     : ***group1***
total_bytes_sec_max_length: 0
read_bytes_sec_max_length: 0
write_bytes_sec_max_length: 0
total_iops_sec_max_length: 0
read_iops_sec_max_length: 0
write_iops_sec_max_length: 0

4.Modify the group_name in disk xml:
#cat disk.xml
<disk type='block' device='disk'>
      <driver name='qemu' type='raw'/>
      <source dev='/dev/vg/lv01'/>
      <target dev='vdb' bus='virtio'/>
      <iotune>
        <read_bytes_sec>3000</read_bytes_sec>
        <write_bytes_sec>4000</write_bytes_sec>
        <read_iops_sec>2000</read_iops_sec>
        <write_iops_sec>1000</write_iops_sec>
        <group_name>***group2***</group_name>
      </iotune>
      <alias name='ua-sdfjsldklwetltklret-sdfsdfsf'/>
      <address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0'/>
    </disk>

5.Live update the disk with group name:
#virsh update-device iommu1 disk.xml
Device updated successfully

6.Query the group name:
#virsh blkdeviotune iommu1 vdb
total_bytes_sec: 0
read_bytes_sec : 2000
write_bytes_sec: 4000
total_iops_sec : 0
read_iops_sec  : 2000
write_iops_sec : 1000
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
group_name     : ***group1***
total_bytes_sec_max_length: 0
read_bytes_sec_max_length: 0
write_bytes_sec_max_length: 0
total_iops_sec_max_length: 0
read_iops_sec_max_length: 0
write_iops_sec_max_length: 0


Actual results:
update virtual disk with iotune group name returns success but no change

Expected results:
'virsh blkdeviotune --group-name' can update the group name for running guest, so it should also update group name with 'virsh update-device'

Additional info:

Comment 2 Peter Krempa 2018-07-17 11:44:50 UTC
Looks like we don't check that blkdeviotune.group_name changed in qemuDomainDiskChangeSupported

Comment 3 Katerina Koukiou 2018-07-31 07:44:35 UTC
@yafu, none of the blkiodevtune parameters are updatable with "virsh blkdeviotune". Thus supporting group_name would mean we should support updating this way all of them. Since there is separate command to update these settings, we should stick to that. And emitting error as we do for the rest of blkiodevtune settings is the way to go IMO.

Comment 4 Katerina Koukiou 2018-07-31 07:47:48 UTC
fixed by: https://www.redhat.com/archives/libvir-list/2018-July/msg02071.html

Comment 5 Katerina Koukiou 2018-08-09 07:49:53 UTC
v4.6.0-58-g047cfb05ee

commit 047cfb05ee949325e77726531fd381820be8dc62
Author: Katerina Koukiou <kkoukiou>
Commit: Katerina Koukiou <kkoukiou>

    qemu: emit error when trying to update blkiotune group_name in qemuDomainChangeDiskLive

Comment 8 Han Han 2019-03-18 10:27:53 UTC
Test on libvirt-5.0.0-7.module+el8+2887+effa3c42.x86_64:
1. Start a vm with following disk xml:
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/tmp/scsi'/>
      <backingStore/>
      <target dev='vdb' bus='virtio'/>
      <iotune>
        <read_bytes_sec>3000</read_bytes_sec>
        <write_bytes_sec>4000</write_bytes_sec>
        <read_iops_sec>2000</read_iops_sec>
        <write_iops_sec>1000</write_iops_sec>
      </iotune>
      <alias name='ua-sdfjsldklwetltklret-sdfsdfsf'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </disk>
2. Remove the address line, then update the disk with this xml:
# cat /tmp/disk.xml
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/tmp/scsi'/>
      <backingStore/>
      <target dev='vdb' bus='virtio'/>
      <iotune>
        <read_bytes_sec>3000</read_bytes_sec>
        <write_bytes_sec>4000</write_bytes_sec>
        <read_iops_sec>2000</read_iops_sec>
        <write_iops_sec>1000</write_iops_sec>
        <group_name>group2</group_name>
      </iotune>
      <alias name='ua-sdfjsldklwetltklret-sdfsdfsf'/>
    </disk>

# virsh -k0 update-device a1 /tmp/disk.xml
error: Failed to update device from /tmp/disk.xml
error: Operation not supported: cannot modify field 'blkdeviotune group_name' of the disk

The reason is, in the macro of CHECK_EQ. When we expand that macro of blkdeviotune.group_name:
if (disk->blkdeviotune.group_name != orig_disk->blkdeviotune.group_name)

That is not correct to compare strings.

Send a patch to fix it: https://www.redhat.com/archives/libvir-list/2019-March/msg01146.html

Comment 10 Ján Tomko 2019-03-28 14:38:39 UTC
Another upstream version:
https://www.redhat.com/archives/libvir-list/2019-March/msg01941.html

Comment 11 Ján Tomko 2019-03-29 12:04:21 UTC
Pushed upstream as:
commit 4fbc8ddcd04331601c5c31787a94c632c62bcbd3
Author:     Ján Tomko <jtomko>
CommitDate: 2019-03-29 12:54:41 +0100

    qemu: error out on attempt to change blkiotune group name
    
    Check that the attribute is the same in qemuDomainDiskChangeSupported
    in case somebody tries to change it using the UpdateDevice API.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1601677
    
    Signed-off-by: Ján Tomko <jtomko>
    Reviewed-by: Laine Stump <laine>

git describe: v5.2.0-rc1-9-g4fbc8ddcd0

Comment 15 Han Han 2019-07-04 09:14:17 UTC
Verified on libvirt-5.0.0-12.module+el8.0.1+3556+b59953c6.x86_64 qemu-kvm-3.1.0-28.module+el8.0.1+3556+b59953c6.x86_64:
SC1: Live update group name from A to B
# virsh -k0 update-device hhan /tmp/disk.xml                                                                                                                                              
error: Failed to update device from /tmp/disk.xml
error: Operation not supported: cannot modify field 'blkdeviotune group name' of the disk


SC2: Live update group name from A to NULL
# virsh -k0 update-device hhan /tmp/disk.xml                                                                                                                                              
Device updated successfully

SC3: Live update group name from NULL to A
# virsh -k0 update-device hhan /tmp/disk.xml                                                                                                                                              
error: Failed to update device from /tmp/disk.xml
error: Operation not supported: cannot modify field 'blkdeviotune group name' of the disk

Comment 17 errata-xmlrpc 2019-08-07 10:41:09 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:2395


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