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

virsh edit can not set "discard_granularity=0" for virtio-blk device

Linking RHIVOS CVEs to...Migration: Automation ...SWIFT: POC ConversionSync from "Extern...XMLWordPrintable

    • libvirt-11.7.0-1.el10
    • No
    • Low
    • 1
    • rhel-virt-core-libvirt-1
    • ssg_virtualization
    • 3
    • False
    • False
    • Hide

      None

      Show
      None
    • None
    • Libvirt Bugs already in Sprint
    • All
    • 11.6.0
    • None

      What were you trying to do that didn't work?

      As subject

      What is the impact of this issue to you?

      under windows server 2022 the default virtio-blk situation is quite
      bad, ssd trim is very slow. and defrag a bigger volume like 1TB
      disk will always show "memory not enough", even when the volume is
      empty.

        I found discussions to change the "discard_granularity" to make trim
      happy again. and libvirt support the syntax like below:

         <blockio discard_granularity='2097152'/>

         I also found if I can set "discard_granularity" to zero, then
      windows will recognize the device as "traditional hard drive" again
      and won't do unnecessary trim to it.

         the sad part is if I setup it under RHEL 9.4 with librirt 10.0 like below:

        <blockio discard_granularity='0'/>

         the line will just disappear when I close "virsh edit"

          so I can only use complex  format with "<qemu:override>" to set"discard_granularity='0'"

          PS: although the parameter seems working fine for windows driver, it seems has no affect for linux. the vm trim capability under rhel 9.4 looks like below no matter the "discard_granularity" is zero or other value.

      > lsblk -D
      NAME            DISC-ALN DISC-GRAN DISC-MAX DISC-ZERO
      vda                    0      512B       2G         0

      Please provide the package NVR for which the bug is seen:

      libvirt-10.0.0-6.7.el9_4.x86_64

      How reproducible is this bug?:

      100%

      Steps to reproduce

      1. create a vm with virtio-blk device
      2. virsh edit the vm, add lines "<blockio discard_granularity='0'/>" to the device. the parameter is ignored when saved because the value is "0" which looks like the default value.

      Expected results

           virsh accept "<blockio discard_granularity='0'/>" as a valid parameter.

              phrdina@redhat.com Pavel Hrdina
              tbsky tbsky d (Inactive)
              Pavel Hrdina Pavel Hrdina
              Meina Li Meina Li
              Votes:
              0 Vote for this issue
              Watchers:
              11 Start watching this issue

                Created:
                Updated: