Bug 790744

Summary: Delete snapshot parent will crash libvirtd
Product: Red Hat Enterprise Linux 6 Reporter: Alex Jia <ajia>
Component: libvirtAssignee: Eric Blake <eblake>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: high    
Version: 6.3CC: acathrow, dallan, dyuan, mzhan, rwu, whuang, zhpeng
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-0.9.10-2.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-20 06:48:22 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Alex Jia 2012-02-15 10:09:11 UTC
Description of problem:
Delete snapshot parent with many children will crash libvirtd.

Version-Release number of selected component (if applicable):
libvirt-0.9.10-1.el6.x86_64

How reproducible:
always

Steps to Reproduce:
1. qemu-img create -f qcow2 /var/lib/libvirt/images/foo.qcow2 10M
2. virsh edit guest configuration and let guest disk source point to the image file
3. # virsh snapshot-create-as foo snap
Domain snapshot snap created

# virsh snapshot-list foo
 Name                 Creation Time             State
------------------------------------------------------------
 snap                 2012-02-15 17:51:18 +0800 running

# virsh snapshot-create foo
Domain snapshot 1329299507 created

# virsh snapshot-create foo
Domain snapshot 1329299512 created

# virsh snapshot-list foo --parent
 Name                 Creation Time             State           Parent
------------------------------------------------------------
 1329299507           2012-02-15 17:51:47 +0800 running         snap
 1329299512           2012-02-15 17:51:52 +0800 running         1329299507
 snap                 2012-02-15 17:51:18 +0800 running

4. # virsh snapshot-delete --children foo snap
error: Failed to delete snapshot snap
error: End of file while reading data: Input/output error

Actual results:
libvirtd crash

Expected results:
fix it.

Additional info:

Comment 1 Alex Jia 2012-02-15 10:16:42 UTC
Eric has committed a patch for the issues:
https://www.redhat.com/archives/libvir-list/2012-February/msg00662.html

Comment 5 zhpeng 2012-02-22 07:22:21 UTC
Test with libvirt-0.9.10-2.el6.x86_64

virsh # list 
 Id Name                 State
----------------------------------
  1 kvm1                 running
# virsh dumpxml kvm1
..
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='none'/>
      <source file='/var/lib/libvirt/images/foo.img.qcow2'/>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </disk>
..

virsh # snapshot-create-as kvm1 snap
Domain snapshot snap created
virsh # snapshot-create kvm1 
Domain snapshot 1329895045 created
virsh # snapshot-create kvm1 
Domain snapshot 1329895048 created
virsh # snapshot-create kvm1 
Domain snapshot 1329895053 created
virsh # snapshot-create kvm1 
Domain snapshot 1329895056 created
virsh # snapshot-create kvm1 
Domain snapshot 1329895061 created
virsh # snapshot-list kvm1 --parent
 Name                 Creation Time             State           Parent
------------------------------------------------------------
 1329895045           2012-02-22 15:17:25 +0800 running         snap
 1329895048           2012-02-22 15:17:28 +0800 running         1329895045
 1329895053           2012-02-22 15:17:33 +0800 running         1329895048
 1329895056           2012-02-22 15:17:36 +0800 running         1329895053
 1329895061           2012-02-22 15:17:41 +0800 running         1329895056
 snap                 2012-02-22 15:17:09 +0800 running

virsh # snapshot-delete --children kvm1 snap
Domain snapshot snap deleted

virsh # snapshot-list kvm1 --parent
 Name                 Creation Time             State           Parent
------------------------------------------------------------

[root@zhpeng ~]# service libvirtd status
libvirtd (pid  5271) is running...


So, it passed.

Comment 7 errata-xmlrpc 2012-06-20 06:48:22 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHSA-2012-0748.html