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 1029747

Summary: qmp does not give any error message when rewrite one of snapshot chain images
Product: Red Hat Enterprise Linux 7 Reporter: Jun Li <juli>
Component: qemu-kvmAssignee: Jeff Cody <jcody>
Status: CLOSED WONTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: famz, hhuang, juzhang, michen, qiguo, rbalakri, shu, virt-maint, xfu
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-01-27 20:04:10 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 Jun Li 2013-11-13 05:44:08 UTC
Description of problem:
After one of snapshot chain images rewrite, can not use snapshot_blkdev to create new snapshot. 
When rewrite one of snapshot chain images, qmp does not give any hint.

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

How reproducible:
100%

Steps to Reproduce:
1.Boot guest.
<cli>:
# /usr/libexec/qemu-kvm -M pc-i440fx-rhel7.0.0 -cpu SandyBridge -enable-kvm -m 4G -smp 4,sockets=2,cores=2,threads=1 -name juli -uuid 355a2475-4e03-4cdd-bf7b-5d6a59edaa68 -rtc base=localtime,clock=host,driftfix=slew \
-device virtio-scsi-pci,bus=pci.0,addr=0x5,id=scsi0 -drive file=iscsi://10.66.6.82:3260/iqn.2013-11.com.example:storage.disk1.juli.xyz/1,if=none,id=drive-scsi0-0-0,media=disk,cache=none,format=qcow2,werror=stop,rerror=stop,aio=native  -device scsi-hd,drive=drive-scsi0-0-0,bus=scsi0.0,scsi-id=0,lun=0,id=juli,bootindex=2 \
-drive file=/home/ISO/en_windows_8.1_preview_x86_dvd_2358833.iso,if=none,media=cdrom,format=raw,aio=native,id=drive-ide1-0-0 -device ide-drive,drive=drive-ide1-0-0,id=ide1-0-0,bus=ide.0,unit=0,bootindex=4 -device virtio-balloon-pci,id=ballooning -global PIIX4_PM.disable_s3=0 -global PIIX4_PM.disable_s4=0 -net none -k en-us -boot menu=on,reboot-timeout=-1,strict=on -qmp tcp:0:4477,server,nowait -serial unix:/tmp/ttyS0,server,nowait -vnc :3 -spice port=5939,disable-ticketing  -vga qxl -global qxl-vga.revision=3 -monitor stdio -monitor tcp:0:7777,server,nowait -monitor unix:/tmp/monitor1,server,nowait \
-netdev tap,id=tap1,vhost=on,queues=4,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown,ifname=tap-juli \
-device virtio-net-pci,netdev=tap1,id=nic1,mq=on,vectors=17,mac=1a:59:0a:4b:aa:94
2.save live snapshot snapshot-n (n=1,2,3) via qmp.
$ telnet 10.66.106.4 4477
{"execute":"qmp_capabilities"}
{"return": {}}
{ "execute": "blockdev-snapshot-sync", "arguments": { "device": "drive-scsi0-0-0", "snapshot-file": "/home/snapshot-1.img", "format": "qcow2" } }
{"return": {}}
{ "execute": "blockdev-snapshot-sync", "arguments": { "device": "drive-scsi0-0-0", "snapshot-file": "/home/snapshot-2.img", "format": "qcow2" } }
{"return": {}}
{ "execute": "blockdev-snapshot-sync", "arguments": { "device": "drive-scsi0-0-0", "snapshot-file": "/home/snapshot-3.img", "format": "qcow2" } }
{"return": {}}
3.save live snapshot snapshot-1 after step 2.
{ "execute": "blockdev-snapshot-sync", "arguments": { "device": "drive-scsi0-0-0", "snapshot-file": "/home/snapshot-1.img", "format": "qcow2" } }
{"return": {}}
4.save live snapshot snapshot-4 via qmp.
 { "execute": "blockdev-snapshot-sync", "arguments": { "device": "drive-scsi0-0-0", "snapshot-file": "/home/snapshot-4.img", "format": "qcow2" } }

Actual results:
{ "execute": "blockdev-snapshot-sync", "arguments": { "device": "drive-scsi0-0-0", "snapshot-file": "/home/snapshot-4.img", "format": "qcow2" } }
{"error": {"class": "GenericError", "desc": "Could not open '/home/snapshot-1.img': Could not open file: Too many open files: Too many open files"}}


Expected results:
When rewrite one of snapshot chain images, qmp give an error message or forbid this behaviour.

Additional info:
After step 2, do the following live snapshot:
{ "execute": "blockdev-snapshot-sync", "arguments": { "device": "drive-scsi0-0-0", "snapshot-file": "/home/snapshot-3.img", "format": "qcow2" } }
{"error": {"class": "GenericError", "desc": "Error: Trying to create an image with the same filename as the backing file"}}

As the above shows, qmp will give an error message.

Comment 2 Jeff Cody 2013-12-19 18:16:52 UTC
Xu Wang's upstream series, "Refine and export backing file loop check" fixes this issue.  The series has spent some time on the upstream list, and is now at v9:

http://lists.gnu.org/archive/html/qemu-devel/2013-11/msg03245.html