Bug 896403 - delete snapshot which name contain '/' lead to libvirtd crash
delete snapshot which name contain '/' lead to libvirtd crash
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt (Show other bugs)
Unspecified Unspecified
high Severity high
: rc
: ---
Assigned To: Peter Krempa
Virtualization Bugs
: Regression
Depends On:
Blocks: 905536
  Show dependency treegraph
Reported: 2013-01-17 03:34 EST by yanbing du
Modified: 2013-02-21 02:29 EST (History)
10 users (show)

See Also:
Fixed In Version: libvirt-0.10.2-17.el6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-02-21 02:29:55 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
libvirtd-crash.log (64.42 KB, text/plain)
2013-01-17 03:34 EST, yanbing du
no flags Details

  None (edit)
Description yanbing du 2013-01-17 03:34:16 EST
Created attachment 680077 [details]

Description of problem:
Create an internal snapshot which name contain '/', then delete it via virsh snapshot-delete command. This will lead to libvitd crash.

In fact, when create the snapshot, the snapshot xml doesn't create:
2013-01-17 08:09:26.925+0000: 24012: error : virFileRewrite:501 : cannot create file '/var/lib/libvirt/qemu/snapshot/test//tmp/test.sn.xml.new': No such file or directory
2013-01-17 08:09:26.925+0000: 24012: warning : qemuDomainSnapshotCreateXML:11790 : unable to save metadata for snapshot /tmp/test.sn

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Create an internal snapshot for a domain
# virsh snapshot-create-as test /tmp/test.sn
Domain snapshot /tmp/test.sn created

# virsh snapshot-list test
 Name                 Creation Time             State
 /tmp/test.sn         2013-01-17 16:00:57 +0800 shutoff

# ls /var/lib/libvirt/qemu/snapshot/test//tmp/test.sn
ls: cannot access /var/lib/libvirt/qemu/snapshot/test//tmp/test.sn: No such file or directory

2. Delete the new created snapshot
# virsh snapshot-delete test /tmp/test.sn
error: Failed to delete snapshot /tmp/test.sn
error: End of file while reading data: Input/output error
error: Failed to reconnect to the hypervisor

3. Restart libvirtd and check the snapshot
#  virsh snapshot-list test
 Name                 Creation Time             State
# qemu-img info /tmp/as2
image: /tmp/as2
file format: qcow2
virtual size: 1.0G (1073741824 bytes)
disk size: 160K
cluster_size: 65536
backing file: /tmp/asd
Snapshot list:
ID        TAG                 VM SIZE                DATE       VM CLOCK
3         /tmp/test.sn              0 2013-01-17 16:00:57   00:00:00.000

Actual results:
libvirtd crash 

Expected results:
libvirtd still running.
Or, when create snapshot, libvirt can refuse the snapshot name which contain '/'.

Additional info:
BTW, on libvirt-0.9.10-21.el6_3.8.x86_64, libvirtd will not crash. So this should be a regression bug.
Comment 3 Peter Krempa 2013-01-17 08:13:22 EST
Patches for the issue posted upstream:
Comment 4 Peter Krempa 2013-01-21 06:04:48 EST
Fixed upstream:

commit 790f912b468657859466215312dbfb0b1a9a1f69
Author: Peter Krempa <pkrempa@redhat.com>
Date:   Thu Jan 17 14:07:10 2013 +0100

    qemu: Reject attempts to create snapshots with names containig '/'
    The snapshot name is used to create path to the definition save file.
    When the name contains slashes the creation of the file fails. Reject
    such names.

commit 27054e1217e2787b1806f55c5f6eb8908612d690
Author: Peter Krempa <pkrempa@redhat.com>
Date:   Thu Jan 17 14:04:01 2013 +0100

    qemu: Don't return success if creation of snapshot save file fails
    When the snapshot definition can't be saved, the
    qemuDomainSnapshotCreate function succeeded without filling some of the
    fields in the internal definition.
    This patch removes the snapshot and returns failure if the XML file
    cannot be written.
Comment 7 yanbing du 2013-01-24 00:08:16 EST
Test with libvirt-0.10.2-17.el6.x86_64

# virsh snapshot-create-as test /tmp/test.sn
error: invalid snapshot name '/tmp/test.sn': name can't contain '/'

So, move but to VERIFIED.
Comment 8 errata-xmlrpc 2013-02-21 02:29:55 EST
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.


Note You need to log in before you can comment on or make changes to this bug.