Bug 1461005

Summary: snapshot is not resized after commit the changes in the backing file
Product: Red Hat Enterprise Linux 7 Reporter: Ping Li <pingl>
Component: qemu-kvmAssignee: Jeff Cody <jcody>
Status: CLOSED WONTFIX QA Contact: Ping Li <pingl>
Severity: high Docs Contact:
Priority: medium    
Version: 7.4CC: aliang, chayang, coli, hachen, juzhang, knoel, michen, ngu, pingl, rbalakri, shuang, virt-maint, xuhan, xuwei
Target Milestone: rc   
Target Release: ---   
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: 2017-07-31 20:40:04 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: 1473046    

Description Ping Li 2017-06-13 10:52:30 UTC
Description of problem:
Created a file in the snapshot and committed the changes in the backing file. Disk size of snapshot is unchanged.

Version-Release number of selected component (if applicable):
qemu-kvm-1.5.3-141.el7

How reproducible:
4/4

Steps to Reproduce:
1. Create snapshot and boot the snapshot with below options.
#qemu-img create -f qcow2 -b base.qcow2 sn.qcow2
qemu options:
    -device virtio-scsi-pci,id=virtio_scsi_pci0,bus=pci.0,addr=0x3 \
    -drive id=drive_image1,if=none,snapshot=off,aio=native,cache=none,format=qcow2,file=/home/testrun/diskfile/sn.qcow2 \
    -device scsi-hd,id=image1,drive=drive_image1,bootindex=1 \
2. Create a file in the snapshot
#dd if=/dev/urandom of=sn bs=1M count=2048
#md5sum sn > md5.sn
3. Shutdown the guest and Get the image info of backing file and snapshot
# qemu-img info base.qcow2 
image: base.qcow2
file format: qcow2
virtual size: 20G (21474836480 bytes)
disk size: 3.4G
cluster_size: 65536
Format specific information:
    compat: 1.1
    lazy refcounts: false
# qemu-img info sn.qcow2 
image: sn.qcow2
file format: qcow2
virtual size: 20G (21474836480 bytes)
disk size: 1.0G    ----> 1G
cluster_size: 65536
backing file: base.qcow2
Format specific information:
    compat: 1.1
    lazy refcounts: false
4. commit the changes.
#qemu-img commit -f qcow2 sn.qcow2
5. Get the image info backing file and snapshot
# qemu-img info base.qcow2 
image: base.qcow2
file format: qcow2
virtual size: 20G (21474836480 bytes)
disk size: 5.4G
cluster_size: 65536
Format specific information:
    compat: 1.1
    lazy refcounts: false
# qemu-img info sn.qcow2 
image: sn.qcow2
file format: qcow2
virtual size: 20G (21474836480 bytes)
disk size: 1.0G    ----> 1G
cluster_size: 65536
backing file: base.qcow2
Format specific information:
    compat: 1.1
    lazy refcounts: false


Actual results:
Disk size of snapshot is unchanged after commit the changes

Expected results:
Disk size of snapshot should be resized.

Additional info:
Reproduce the issue with qemu-kvm-1.5.3-126.el7 and qemu-kvm-1.5.3-130.el7.

Cannot reproduce the issue with qemu-kvm-rhev-2.9.0-7.el7
# qemu-img info base.qcow2 
image: base.qcow2
file format: qcow2
virtual size: 20G (21474836480 bytes)
disk size: 2.6G
cluster_size: 65536
Format specific information:
    compat: 1.1
    lazy refcounts: false
    refcount bits: 16
    corrupt: false
# qemu-img info sn.qcow2 
image: sn.qcow2
file format: qcow2
virtual size: 20G (21474836480 bytes)
disk size: 2.0G    ----> 2G
cluster_size: 65536
backing file: base.qcow2
Format specific information:
    compat: 1.1
    lazy refcounts: false
    refcount bits: 16
    corrupt: false
# qemu-img commit -f qcow2 sn.qcow2 
Image committed.
# qemu-img info base.qcow2 
image: base.qcow2
file format: qcow2
virtual size: 20G (21474836480 bytes)
disk size: 4.6G
cluster_size: 65536
Format specific information:
    compat: 1.1
    lazy refcounts: false
    refcount bits: 16
    corrupt: false
# qemu-img info sn.qcow2 
image: sn.qcow2
file format: qcow2
virtual size: 20G (21474836480 bytes)
disk size: 256K    ----> disk size is resized
cluster_size: 65536
backing file: base.qcow2
Format specific information:
    compat: 1.1
    lazy refcounts: false
    refcount bits: 16
    corrupt: false