
On 11/17/2011 02:11 AM, shu ming wrote:
Checking the source of the disk will exclude the case when the source disk is block device while the snapshot target is given manually by the users with "snapshot-create --xmlfile" or "virsh snapshot-create-as --diskspec". Why not check the snapshot directory where it will be created?
Because it is assumed that if you are bothering to take the time to pass --xmlfile or --diskspec, then you are also aware of the issues of that file name and can deal with the consequences of naming a bogus location for the resulting qcow2 file. The patch below is only a crutch to make the default behavior, with no explicit name, less likely to cause confusion; while still leaving the user with the full power of the tool when they go with explicit file names.
* src/conf/domain_conf.c (virDomainSnapshotAlignDisks): Only generate names if backing file exists as regular file. Reported by MATSUDA Daiki.
-- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org