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:
Looks like we don't check that blkdeviotune.group_name changed in qemuDomainDiskChangeSupported
@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.
fixed by: https://www.redhat.com/archives/libvir-list/2018-July/msg02071.html
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
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
Another upstream version: https://www.redhat.com/archives/libvir-list/2019-March/msg01941.html
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
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
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