]> git.ipfire.org Git - thirdparty/libvirt.git/commit
snapshot: refuse to generate names for non-regular backing files
authorEric Blake <eblake@redhat.com>
Wed, 16 Nov 2011 00:19:20 +0000 (17:19 -0700)
committerEric Blake <eblake@redhat.com>
Thu, 17 Nov 2011 18:34:52 +0000 (11:34 -0700)
commitc74b97156f9355185391856a02bbb27d98a25ba4
treeacc2633c2ede0a29b1beab99b84925d9ea47949c
parentd47ab3fe6115de6c54f999ba598fe58418840653
snapshot: refuse to generate names for non-regular backing files

For whatever reason, the kernel allows you to create a regular
file named /dev/sdc.12345; although this file will disappear the
next time devtmpfs is remounted.  If you let libvirt generate
the name of the external snapshot for a disk image originally
using the block device /dev/sdc, then the domain will be rendered
unbootable once the qcow2 file is lost on the next devtmpfs
remount.  In this case, the user should have used 'virsh
snapshot-create --xmlfile' or 'virsh snapshot-create-as --diskspec'
to specify the name for the qcow2 file in a sane location, rather
than relying on libvirt generating a name that is most likely to
be wrong.  We can help avoid naive mistakes by enforcing that
the user provide the external name for any backing file that is
not a regular file.

* src/conf/domain_conf.c (virDomainSnapshotAlignDisks): Only
generate names if backing file exists as regular file.
Reported by MATSUDA Daiki.
src/conf/domain_conf.c