Bug 1886714

Summary: Can not resize block device with sata bus for guest
Product: Red Hat Enterprise Linux Advanced Virtualization Reporter: Lili Zhu <lizhu>
Component: libvirtAssignee: Peter Krempa <pkrempa>
Status: CLOSED WONTFIX QA Contact: Han Han <hhan>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.3CC: chhu, dyuan, hhan, jsuchane, lmen, pkrempa, virt-maint, xuzhang
Target Milestone: rc   
Target Release: 8.3   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-12-04 16:08:28 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1897025    

Description Lili Zhu 2020-10-09 08:03:31 UTC
Description of problem:
Can not resize block device with sata bus for guest

Version-Release number of selected component (if applicable):
libvirt-6.6.0-6.el8.x86_64
qemu-kvm-5.1.0-10.module+el8.3.0+8254+568ca30d.x86_64

How reproducible:
100%

Steps to Reproduce:
1. prepare a guest with sata disk
...
 <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/test.qcow2' index='1'/>
      <backingStore/>
      <target dev='vdb' bus='sata'/>
      <alias name='sata0-0-1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>

...

2. check the block device in guest
# lsblk
NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda             8:0    0  200M  0 disk 

3. resize the block device
# virsh blockresize hostname /var/lib/libvirt/images/test.qcow2 --size 400M
Block device '/var/lib/libvirt/images/test.qcow2' is resized

4. check the block device in host
# qemu-img info -U /var/lib/libvirt/images/test.qcow2 
image: /var/lib/libvirt/images/test.qcow2
file format: qcow2
virtual size: 400 MiB (419430400 bytes)
disk size: 388 KiB
cluster_size: 65536
Format specific information:
    compat: 1.1
    compression type: zlib
    lazy refcounts: false
    refcount bits: 16
    corrupt: false

5. check the block device info via virsh cmd
# virsh domblkinfo hostname vdb
Capacity:       419430400
Allocation:     397312
Physical:       393216

6. inform the OS of partition table changes
# partprobe /dev/sda

7. check the size of block device
# cat /proc/partitions 
major minor  #blocks  name

 252        0   10485760 vda
 252        1    1048576 vda1
 252        2    9436160 vda2
   8        0     204800 sda
 253        0    8384512 dm-0
 253        1    1048576 dm-1

Expected results:
The size of block device should be updated. Or if blockresize for block device with sata bus is not supported, it should report an error.

Comment 1 Lili Zhu 2020-10-09 08:15:48 UTC
After reboot the guest, the size of block device with sata bus can be updated.

Comment 2 Jaroslav Suchanek 2020-10-26 14:44:16 UTC
(In reply to Lili Zhu from comment #1)
> After reboot the guest, the size of block device with sata bus can be
> updated.

You mean, that once you rebooted the guest, the blockresize command worked as expected?

How can we reproduce this? Can you attach libvirt debug logs please? Thanks.

Comment 3 Lili Zhu 2020-10-29 02:47:30 UTC
(In reply to Jaroslav Suchanek from comment #2)
> (In reply to Lili Zhu from comment #1)
> > After reboot the guest, the size of block device with sata bus can be
> > updated.
> 
> You mean, that once you rebooted the guest, the blockresize command worked
> as expected?
> 
> How can we reproduce this? Can you attach libvirt debug logs please? Thanks.

reproduce steps:
1. repeat step1-step7 in comment #0
2. reboot the guest, then check the block size info in guest
# lsblk 
NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda             8:0    0  400M  0 disk 
vda           252:0    0   10G  0 disk 
├─vda1        252:1    0    1G  0 part /boot
└─vda2        252:2    0    9G  0 part 
  ├─rhel-root 253:0    0    8G  0 lvm  /
  └─rhel-swap 253:1    0    1G  0 lvm  [SWAP]

the block size info is updated after reboot.

Additional info:
For the block device with virtio bus, the size will be updated right after 
resizing the block device via virsh blockresize.

Comment 4 Peter Krempa 2020-12-04 16:08:28 UTC
The command successfully resizes the disk backend, but apparently the guest doesn't re-read it. Since restart shows proper size and this is just a minor problem I'm closing this as wontfix.