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

Failed to change the block size of USB disk

    • None
    • None
    • TestOnly
    • rhel-sst-virtualization-storage
    • ssg_virtualization
    • 5
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None
    • RegressionOnly
    • None

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

      I tried to change the block size of usb disk, but it doesn't take effect.
      Actually I'm not sure whether this is supported. If it is not supported, I think it's better to forbid such configuration.

      Please provide the package NVR for which bug is seen:

      libvirt-10.0.0-1.el9.x86_64
      kernel-5.14.0-408.el9.x86_64
      qemu-kvm-8.2.0-2.el9.x86_64

      How reproducible:

      100%

      Steps to reproduce

      1. Define a guest with usb disk and configure the block size:
      # cat vm.xml
      ...    
      <disk type='file' device='disk'>
            <driver name='qemu' type='raw'/>
            <source file='/var/lib/libvirt/images/usb.img' index='1'/>
            <backingStore/>
            <blockio logical_block_size='1024' physical_block_size='1024' discard_granularity='1024'/>
            <target dev='hda' bus='usb'/>
            <alias name='usb-disk0'/>
            <address type='usb' bus='0' port='1'/>
          </disk>
          <controller type='usb' index='0' model='qemu-xhci'>
            <alias name='usb'/>
            <address type='pci' domain='0x0000' bus='0x07' slot='0x00' function='0x0'/>
          </controller>
      ...
      # virsh define vm.xml
      
      1. Start vm: virsh start avocado-vt-vm1
      2. Login vm, check usb disk
      [root@localhost ~]# lsblk
      NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
      sda             8:0    0  300M  0 disk 
      vda           252:0    0   10G  0 disk 
      ├─vda1        252:1    0  600M  0 part /boot/efi
      ├─vda2        252:2    0    1G  0 part /boot
      └─vda3        252:3    0  8.4G  0 part 
        ├─rhel-root 253:0    0  7.4G  0 lvm  /
        └─rhel-swap 253:1    0    1G  0 lvm  [SWAP]
      [root@localhost ~]# blockdev --getss /dev/sda
      512
      [root@localhost ~]# blockdev --getpbsz /dev/sda
      512
      
      

      Expected results

      The block size of usb disk is same as what's configured in vm xml

      Actual results

      The block size of usb disk is not same as what's configured in vm xml

      Additional info

      qemu command line:

      -blockdev {"driver":"file","filename":"/var/lib/libvirt/images/usb.img","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"} -blockdev {"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"} -device {"driver":"usb-storage","bus":"usb.0","port":"1","drive":"libvirt-1-format","id":"usb-disk0","logical_block_size":1024,"physical_block_size":1024,"discard_granularity":1024,"removable":false}
      

              kwolf@redhat.com Kevin Wolf
              rhn-support-fjin Fangge Jin
              virt-maint virt-maint
              Yanbin Duan Yanbin Duan
              Votes:
              0 Vote for this issue
              Watchers:
              13 Start watching this issue

                Created:
                Updated:
                Resolved: