Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-42606

block-threshold event for virtio disk sometimes late for more than 30s

    • Icon: Bug Bug
    • Resolution: Not a Bug
    • Icon: Undefined Undefined
    • None
    • rhel-9.5
    • libvirt / Storage
    • None
    • None
    • None
    • rhel-sst-virtualization-storage
    • ssg_virtualization
    • None
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None
    • None
    • None

      Description of problem:
      block-threshold event for virtio disk sometimes late for more than 30s

      Version-Release number of selected component (if applicable):
      libvirt-10.4.0-1.el9.x86_64

      How reproducible:
      80%

      Steps to Reproduce:
      1. Start a vm with 2 virtio disks
      prepare the test.qcow3 image

      # cd /var/lib/libvirt/images
      # qemu-img create -f qcow2 test.qcow2 200M
      # virsh dumpxml rhel --xpath //disk
      <disk type="file" device="disk">
        <driver name="qemu" type="qcow2"/>
        <source file="/var/lib/libvirt/images/RHEL-9.5-x86_64-latest-ovmf.qcow2"/>
        <target dev="vda" bus="virtio"/>
        <address type="pci" domain="0x0000" bus="0x03" slot="0x00" function="0x0"/>
      </disk>
      <disk type="file" device="disk">
        <driver name="qemu" type="qcow2"/>
        <source file="/var/lib/libvirt/images/test.qcow2"/>
        <target dev="vdb" bus="virtio"/>
        <address type="pci" domain="0x0000" bus="0x04" slot="0x00" function="0x0"/>
      </disk>
      

      2. Set domblkthreshold for vdb:

      # virsh domblklist rhel
       Target   Source
      ---------------------------------------------------------------------
       vda      /var/lib/libvirt/images/RHEL-9.5-x86_64-latest-ovmf.qcow2
       vdb      /var/lib/libvirt/images/test.qcow2
      #  virsh domblkthreshold rhel vdb 100M
      #  virsh domstats rhel --backing | grep threshold
        block.1.threshold=104857600
      

      3. write data above the threshold on the vm, check if there is event on host:
      On 1st terminal, track the events:

      # virsh event --event block-threshold --loop --timestamp 

      On 2nd terminal, login vm and write data to vdb:

      [guest] # mkfs.ext4 /dev/vdb
      [guest] # mount /dev/vdb /mnt
      [guest] # dd if=/dev/urandom of=/mnt/bigfile bs=1M count=110 ; date
      110+0 records in
      110+0 records out
      115343360 bytes (115 MB, 110 MiB) copied, 0.458109 s, 252 MB/s
      Mon Jun 17 20:31:27 CST 2024
      

      The captured log is about 31s late:

      #  virsh event --event block-threshold --loop --timestamp
      2024-06-17 12:31:58.474+0000: event 'block-threshold' for domain 'rhel': dev: vdb(/var/lib/libvirt/images/test.qcow2) 104857600 524288
      2024-06-17 12:31:58.474+0000: event 'block-threshold' for domain 'rhel': dev: vdb[1](/var/lib/libvirt/images/test.qcow2) 104857600 524288
      

      Actual results:
      block-threshold event for virtio disk sometimes late for more than 30s

      Expected results:
      The block-threshold event log immediately after the operation

      Additional info:
      1) Can also be reproduced on rhel 10 with libvirt-10.4.0-1.el10.x86_64, can not reproduce with sata disk;
      2) It seems when using larger numbers (more than the threshold), no such issue:
      Terminal 1:

      #  dd if=/dev/urandom of=/mnt/bigfile bs=1M count=150 ; date
      150+0 records in
      150+0 records out
      157286400 bytes (157 MB, 150 MiB) copied, 0.775307 s, 203 MB/s
      Mon Jun 17 20:47:14 CST 2024
      

      Terminal 2:

      # virsh domstats rhel --backing | grep threshold
        block.1.threshold=104857600
      # virsh event --event block-threshold --loop --timestamp
      2024-06-17 12:47:14.566+0000: event 'block-threshold' for domain 'rhel': dev: vdb(/var/lib/libvirt/images/test.qcow2) 104857600 589824
      2024-06-17 12:47:14.566+0000: event 'block-threshold' for domain 'rhel': dev: vdb[1](/var/lib/libvirt/images/test.qcow2) 104857600 589824
      

              virt-maint virt-maint
              yalzhang@redhat.com Yalan Zhang
              virt-maint virt-maint
              virt-bugs virt-bugs
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved: