Bug 1301815

Summary: Guest image occured error in qemu-img check after enlarge a small lvm to resume installing guest.
Product: Red Hat Enterprise Linux 6 Reporter: xiagao
Component: qemu-kvmAssignee: Kevin Wolf <kwolf>
Status: CLOSED NEXTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.8CC: ailan, chayang, coli, juzhang, meyang, mkenneth, ngu, pingl, rbalakri, shuang, timao, virt-maint, xutian, xuwei
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1302929 1302930 (view as bug list) Environment:
Last Closed: 2016-02-16 19:49:02 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: 1302929, 1302930, 1610930    

Description xiagao 2016-01-26 03:28:51 UTC
Description of problem:
Install rhel6.7 guest on a small lvm based iscsi storage, and enlarge lvm to resume installing guest when there is no space. After installation, check guest image with error info.

Version-Release number of selected component (if applicable):
qemu-kvm-rhev-0.12.1.2-2.483.el6.x86_64
qemu-img-rhev-0.12.1.2-2.483.el6.x86_64
kernel-2.6.32-595.el6.x86_64

How reproducible:
4/5

Steps to Reproduce:
1.login iscsi server and create lvm on host.
# iscsiadm -m node -T iqn.2016-01.com.xiagao:server.target0 -p 10.66.83.216 --login
# vgcreate vgtest /dev/sdc
# lvcreate -L 3g -n lvtest vgtest
# lvs
 lvtest vgtest       -wi-a-----   3.00g

2.Create a large enough qcow2 file on lvm .
# qemu-img create -f qcow2 /dev/vgtest/lvtest 80G

3.Install rhel6.7.z guest with -drive file=...,format=qcow2...., using pxe installaion method
/usr/libexec/qemu-kvm \
    -S  \
    -name 'virt-tests-vm1' \
    -machine rhel6.6.0  \
    -nodefaults  \
    -vga cirrus \
    -drive file=/dev/vgtest/lvtest,if=none,id=drive-virtio-disk0,boot=on,format=qcow2,cache=none,werror=stop,rerror=stop \
    -device virtio-blk-pci,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,id=virtio-disk0 \
    -device virtio-net-pci,mac=9a:d5:d6:d7:d8:d9,id=idnNqY2H,vectors=4,netdev=idz3Tned,bus=pci.0,addr=05  \
    -netdev tap,id=idz3Tned  \
    -m 4096  \
    -smp 4,cores=4,threads=1,sockets=1 \
    -cpu 'Conroe' \
    -vnc :0  \
    -enable-kvm \
    -monitor stdio

4.wait until vm pause on no space

5.extend the lvm. 
# lvextend -L +50M /dev/vgtest/lvtest

6.in qmp monitor . issue cont.
for qmp : {"execute":"cont"}

7. repeat 4~6.

8. after installation, check guest image

Actual results:
#qemu-img check /dev/vgtest/lvtest
Leaked cluster 49092 refcount=1 reference=0
Leaked cluster 49093 refcount=1 reference=0
Leaked cluster 49094 refcount=1 reference=0
Leaked cluster 49095 refcount=1 reference=0
Leaked cluster 49096 refcount=1 reference=0

........

Leaked cluster 69715 refcount=1 reference=0
Leaked cluster 69716 refcount=1 reference=0
Leaked cluster 69717 refcount=1 reference=0
Leaked cluster 69718 refcount=1 reference=0
Leaked cluster 69719 refcount=1 reference=0
Leaked cluster 69720 refcount=1 reference=0

4595 leaked clusters were found on the image.
This means waste of disk space, but no harm to data.
Image end offset: 4759093248

Expected results:
no error.

Additional info:
1.host cpu info
processor	: 1
vendor_id	: AuthenticAMD
cpu family	: 15
model		: 107
model name	: AMD Athlon(tm) Dual Core Processor 5400B
stepping	: 2
cpu MHz		: 1000.000
cache size	: 512 KB
physical id	: 0
siblings	: 2
core id		: 1
cpu cores	: 2
apicid		: 1
initial apicid	: 1
fpu		: yes
fpu_exception	: yes
cpuid level	: 1
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt rdtscp lm 3dnowext 3dnow rep_good extd_apicid pni cx16 lahf_lm cmp_legacy svm extapic cr8_legacy 3dnowprefetch lbrv

2.after installation,check lvm
# lvs
lvtest vgtest       -wi-a-----   4.74g

3.guest can boot normally.

4.guest imag info
# qemu-img info /dev/vgtest/lvtest
image: /dev/vgtest/lvtest
file format: qcow2
virtual size: 80G (85899345920 bytes)
disk size: 0
cluster_size: 65536

Comment 2 xiagao 2016-01-26 08:26:27 UTC
Can reproduce it on rhel6.7 release version.

pkg version:
qemu-kvm-rhev-0.12.1.2-2.479.el6.x86_64
qemu-img-rhev-0.12.1.2-2.479.el6.x86_64

When trigger cont after extend lvm at the first time, the image occured error.