Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1038522

Summary: qemu/qmp should report error and stop during block_stream to a non-enough-space block
Product: Red Hat Enterprise Linux 7 Reporter: Qian Guo <qiguo>
Component: qemu-kvm-rhevAssignee: Jeff Cody <jcody>
Status: CLOSED NOTABUG QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: acathrow, chayang, hhuang, juzhang, knoel, michen, shu, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-07-29 19:19:52 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:

Description Qian Guo 2013-12-05 09:29:25 UTC
Description of problem:

When test libiscsi backend virtual block, boot guest with a 5G real size data block and have more than 1G real data inside, then create a snapshot of it to a 1G real size libiscsi block, if block streaming to this snapshot, qemu/qmp can not report any error, and can finish successfully.

Version-Release number of selected component (if applicable):
# uname -r
3.10.0-57.el7.x86_64
]# rpm -q qemu-kvm-rhev
qemu-kvm-rhev-1.5.3-20.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.Prepare 2  iscsi luns, one is 5G size block and another is 1G size.
5Gfile:  10.66.71.180:3260,1 iqn.10.66.71.180.target4
1Gfile:  10.66.71.180:3260,1 iqn.10.66.71.180.target8

2.Boot rhel7 guest with the 5G size data disk:
# /usr/libexec/qemu-kvm -M pc -cpu Penryn,-kvm_pv_eoi -enable-kvm -m 4096 -smp 4,socket=1,cores=4,threads=1 -name rhel7 -nodefaults -nodefconfig -drive file=iscsi://10.66.71.180:3260/iqn.10.66.71.180.target1/1,if=none,id=drive-virtio-disk0,format=qcow2,werror=stop,rerror=stop,aio=native -device virtio-blk-pci,id=virtio-disk0,drive=drive-virtio-disk0 -global PIIX4_PM.disable_s3=0 -global PIIX4_PM.disable_s4=0 -vnc :10 -vga qxl -global qxl-vga.vram_size=67108864 -monitor stdio -boot menu=on -netdev tap,id=netdev0,vhost=on,fd=7 -device virtio-net-pci,mac=46:c5:83:01:5f:4c,netdev=netdev0,id=net0 -device virtio-balloon-pci,id=b1 7<>/dev/tap7 -drive file=iscsi://10.66.71.180:3260/iqn.10.66.71.180.target4/1,if=none,id=drive-virtio-disk1,format=qcow2,werror=stop,rerror=stop,aio=native -device virtio-blk-pci,id=virtio-disk1,drive=drive-virtio-disk1  -qmp tcp:0:1111,server,nowait

3.Inside guest, in the data disk, create a 3G size file:
# ll -h
total 3.0G
-rw-r--r--. 1 root root 3.0G Dec  5 17:06 3Gfile
# md5sum  3Gfile 
4322d422199eaccfbd36feb3da955b16  3Gfile

4.Create snapshot to the 1G size iscsi lun
(qemu) snapshot_blkdev drive-virtio-disk1 iscsi://10.66.71.180:3260/iqn.10.66.71.180.target8/1
Formatting 'iscsi://10.66.71.180:3260/iqn.10.66.71.180.target8/1', fmt=qcow2 size=5368709120 backing_file='iscsi://10.66.71.180:3260/iqn.10.66.71.180.target4/1' backing_fmt='qcow2' encryption=off cluster_size=65536 lazy_refcounts=off 

(qemu) info block
drive-virtio-disk0: removable=0 io-status=ok file=iscsi://10.66.71.180:3260/iqn.10.66.71.180.target1/1 ro=0 drv=qcow2 encrypted=0 bps=0 bps_rd=0 bps_wr=0 iops=0 iops_rd=0 iops_wr=0
drive-virtio-disk1: removable=0 io-status=ok file=iscsi://10.66.71.180:3260/iqn.10.66.71.180.target8/1 backing_file=iscsi://10.66.71.180:3260/iqn.10.66.71.180.target4/1 backing_file_depth=1 ro=0 drv=qcow2 encrypted=0 bps=0 bps_rd=0 bps_wr=0 iops=0 iops_rd=0 iops_wr=0

# qemu-img info iscsi://10.66.71.180:3260/iqn.10.66.71.180.target8/1
image: iscsi://10.66.71.180:3260/iqn.10.66.71.180.target8/1
file format: qcow2
virtual size: 5.0G (5368709120 bytes)
disk size: unavailable
cluster_size: 65536
backing file: iscsi://10.66.71.180:3260/iqn.10.66.71.180.target4/1
backing file format: qcow2
Format specific information:
    compat: 1.1
    lazy refcounts: false

5.Block stream this device
(qemu) snapshot_blkdev drive-virtio-disk1 iscsi://10.66.71.180:3260/iqn.10.66.71.180.target8/1


Actual results:
1.Block streaming can be finished successfully:
(qemu) info block
drive-virtio-disk0: removable=0 io-status=ok file=iscsi://10.66.71.180:3260/iqn.10.66.71.180.target1/1 ro=0 drv=qcow2 encrypted=0 bps=0 bps_rd=0 bps_wr=0 iops=0 iops_rd=0 iops_wr=0
drive-virtio-disk1: removable=0 io-status=ok file=iscsi://10.66.71.180:3260/iqn.10.66.71.180.target8/1 ro=0 drv=qcow2 encrypted=0 bps=0 bps_rd=0 bps_wr=0 iops=0 iops_rd=0 iops_wr=0

# qemu-img info iscsi://10.66.71.180:3260/iqn.10.66.71.180.target8/1
image: iscsi://10.66.71.180:3260/iqn.10.66.71.180.target8/1
file format: qcow2
virtual size: 5.0G (5368709120 bytes)
disk size: unavailable
cluster_size: 65536
Format specific information:
    compat: 1.1
    lazy refcounts: false

2.Boot guest agian with iscsi://10.66.71.180:3260/iqn.10.66.71.180.target8/1
The file is still existing, and md5sum value is same as above:
# md5sum 3Gfile 
4322d422199eaccfbd36feb3da955b16  3Gfile

3.But this physical block is only 1G size, this should be not right, I tried delete this file, and re-dd a more than 1G file, qemu/qmp report input/ouput io error, and guest access paused (this is the expected result).
Expected results:
Should not block stream successfully.
Additional info:

Comment 3 Jeff Cody 2014-07-22 20:10:46 UTC
Most likely, the test 3G file was created with (mostly/all) zeros, and so the sectors were allocated in the qcow2 file as zero clusters.  Especially since the md5sum matched the guest file, this doesn't appear to be an issue.

Comment 4 Jeff Cody 2014-07-29 19:19:52 UTC
Meant to close this as NOTABUG, rather than moving to MODIFIED.