[libvirt] [PATCH] snapshot: allow disk snapshots of qcow2 disks

Eric Blake eblake at redhat.com
Sat Sep 17 14:55:48 UTC 2011

On 09/17/2011 08:51 AM, Daniel Veillard wrote:
> On Sat, Sep 17, 2011 at 06:22:09AM -0600, Eric Blake wrote:
>> For all types of disks other than qcow2, we were requesting that
>> SELinux labeling visit the new file as if it were qcow2, which
>> means labeling would try to find the backing files of an empty file.
>> And for a pre-existing qcow2 disk, we were passing NULL, which meant
>> that labelling tried to probe the file type (and if probing is
>> disabled, per the default qemu.conf, this made snapshots fail).
>> What we really want is to make SELinux labeling visit the new
>> file as raw; it will later be converted to qcow2 if qemu successfully
>> made the snapshot.
>> * src/qemu/qemu_driver.c
>> (qemuDomainSnapshotCreateSingleDiskActive): Force SELinux labeling
>> to avoid probe of new file.
>> ---
>> Fixes https://bugzilla.redhat.com/show_bug.cgi?id=738676
>> I wonder why we are passing disk types as strings, instead of encoding
>> them as an enum.  Use of an enum would avoid my ugly hack of having to
>> cast away const of my temporary assignment of a string.
>    The only advantage I would see is better error handling when hitting
> a value not known by the current libvirtd, the string allows to report
> what is missing, but it's really a corner case.

I'll probably try cleaning that up, post 0.9.5.

>> -    disk->driverType = driverType;
>> +    disk->driverType = (char *) "raw"; /* Don't want to probe backing files */
>>       if (virDomainLockDiskAttach(driver->lockManager, vm, disk)<  0)
>>           goto cleanup;
>    ACK,


Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

More information about the libvir-list mailing list