RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1494327 - Cannot set vm's block threshold by 'virsh domblkthreshold'
Summary: Cannot set vm's block threshold by 'virsh domblkthreshold'
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.5
Hardware: x86_64
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Peter Krempa
QA Contact: Meina Li
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-09-22 03:57 UTC by yisun
Modified: 2018-04-10 10:58 UTC (History)
8 users (show)

Fixed In Version: libvirt-3.8.0-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-04-10 10:57:19 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2018:0704 0 None None None 2018-04-10 10:58:32 UTC

Description yisun 2017-09-22 03:57:01 UTC
Description of problem:
Cannot set vm's block threshold by 'virsh domblkthreshold'

Version-Release number of selected component (if applicable):
libvirt-3.7.0-2.el7.x86_64
qemu-kvm-rhev-2.9.0-16.el7_4.8.x86_64

How reproducible:
100%

Steps to Reproduce:
## rpm -qa | egrep "libvirt-3|qemu-kvm-rhev"
libvirt-3.7.0-2.el7.x86_64
qemu-kvm-rhev-2.9.0-16.el7_4.8.x86_64


1. having a vm, whose second disk's xml as follow:
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/test-threshold.raw'/>
      <backingStore/>
      <target dev='vdb' bus='virtio'/>
      <alias name='virtio-disk1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </disk>

## virsh start avocado-vt-vm1
Domain avocado-vt-vm1 started

2. try to set the domain block threshold of its vdb:
## virsh domblkthreshold avocado-vt-vm1 vdb 1G
error: Operation not supported: threshold currently can't be set for block device 'vdb'

Actual results:
cannot set blockthreshold of vm's vdb

Expected results:
Should be able to set it. This is not reproduced with libvirt 7.4 (qemu version not changed) as follow:
## rpm -qa | egrep "libvirt-3|qemu-kvm-rhev"
qemu-kvm-rhev-2.9.0-16.el7_4.8.x86_64
libvirt-3.2.0-14.el7_4.3.x86_64

## virsh domblkthreshold avocado-vt-vm1 vdb 1G

## virsh domstats avocado-vt-vm1 --block | grep threshold
...
  block.1.threshold=1073741824

Comment 3 Peter Krempa 2017-09-25 12:43:29 UTC
Fixed upstream:

commit 93575f345116fe1413f6fe3109227b8be2f416da
Author: Peter Krempa <pkrempa>
Date:   Mon Sep 25 11:44:00 2017 +0200

    qemu: block: Use correct alias when extracting disk node names
    
    The alias recorded in disk->info.alias is the alias for the frontend
    device but we are interested in the backend drive. This messed up the
    disk node name extraction code as qemu reports the drive alias in the
    block query commands. This was broken in the node name detector
    refactoring done in commit 0175dc6ea024d

Comment 5 Meina Li 2017-10-19 07:51:52 UTC
Test env components:
kernel-3.10.0-734.el7.x86_64
libvirt-3.8.0-1.el7.x86_64
qemu-kvm-rhev-2.10.0-2.el7.x86_64

Steps to verify:
@Terminal 1:
1. Start a vm whose its second disk's xml as follow:
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/test.raw'/>
      <backingStore/>
      <target dev='vdb' bus='virtio'/>
      <alias name='virtio-disk1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0'/>
    </disk>

# virsh start lmn
Domain lmn started

2. Set the domain block threshold of its vdb:
# virsh domblkthreshold lmn vdb 200M

## virsh domstats lmn --block | grep threshold
  block.1.threshold=209715200

3. Check the block threshold event: 
# virsh event --event block-threshold --loop

@Terminal 2:
1. Connect to domain:
# virsh console lmn
Connected to domain lmn
Escape character is ^]
Red Hat Enterprise Linux Server 7.4 (Maipo)
Kernel 3.10.0-693.el7.x86_64 on an x86_64
localhost login: root
Password: 
Last login: Thu Oct 19 14:01:24 on ttyS0

2. [In guest]
# mkfs.ext4 /dev/vdb
# mount /dev/vdb /mnt
# dd if=/dev/urandom of=/mnt/a bs=1M count=300
300+0 records in
300+0 records out
314572800 bytes (315 MB) copied, 2.82178 s, 111 MB/s
# sync

@Terminal 1:
virsh event --event block-threshold --loop
event 'block-threshold' for domain lmn: dev: vdb(/var/lib/libvirt/images/test.raw) 209715200 192946176   <=== event captured

It also be verified on qcow2 type(driver),block type(disk) and volume type(disk).
The results are as expected, move this bug to be verified.

Comment 6 Meina Li 2018-01-26 06:45:28 UTC
Hi Peter,
For domblkthreshold in `man virsh`, it describe "dev specifies the disk device target or backing chain element of given device using the 'target[1]' syntax." So I use backing chain element to test it, and found the below questions:
(1)It can be set by `virsh domblkthreshold rhel7 vda[0] 2G`, but actually we don't have vda[0] in chain.
(2)It can't use vda[1],vda[2]..to set the block threshold.
So, is it only a doc error or a libvirt bug? Thanks.

Test steps:
1. Prepare a running guest.
2. Do snapshot for it, and check dumpxml.
# virsh dumpxml rhel7 | grep disk -a8
 <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/rhel7.p2'/>
      <backingStore type='file' index='1'>
        <format type='qcow2'/>
        <source file='/var/lib/libvirt/images/rhel7.p1'/>
        <backingStore type='file' index='2'>
          <format type='qcow2'/>
          <source file='/var/lib/libvirt/images/rhel7.qcow2'/>
          <backingStore/>
        </backingStore>
      </backingStore>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x08' slot='0x00' function='0x0'/>
    </disk>
3. Set block threshold for vda device.
# virsh domblkthreshold rhel7 vda[1] 2G
# virsh domstats rhel7 --block | grep threshold
no output

# virsh domblkthreshold rhe7 vda[2] 2G
# virsh domstats rhel7 --block | grep threshold
no output

# virsh domblkthreshold rhel7 vda[0] 2G
# virsh domstats rhel7 --block | grep threshold
  block.0.threshold=2147483648

Comment 7 Meina Li 2018-01-26 06:56:40 UTC
the test version for comment 6:
libvirt-3.9.0-9.el7.x86_64
qemu-kvm-rhev-2.10.0-18.el7.x86_64

Comment 8 Peter Krempa 2018-01-29 11:19:26 UTC
vda[0] is not currently a valid index, since there is no <backingStore index='0'> You can use only the valid ones.

vda[1],vda[2] is not possible. The API operates only on a single target. You need to make two calls for both elements.

I think the docs are clear on the fact that the index must be found in the XMl and that only one target is legal.

Comment 12 errata-xmlrpc 2018-04-10 10:57:19 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/RHEA-2018:0704


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