]> xenbits.xensource.com Git - libvirt.git/commitdiff
snapshot: allow disk snapshots of qcow2 disks
authorEric Blake <eblake@redhat.com>
Sat, 17 Sep 2011 12:16:08 +0000 (06:16 -0600)
committerEric Blake <eblake@redhat.com>
Sat, 17 Sep 2011 12:16:08 +0000 (06:16 -0600)
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.

src/qemu/qemu_driver.c

index 2a1e5eab090d86b433d30d8def80032c94800b8f..e2f428fbed67982f40431d7711599aacf321ad01 100644 (file)
@@ -9151,7 +9151,7 @@ qemuDomainSnapshotCreateSingleDiskActive(struct qemud_driver *driver,
     origsrc = disk->src;
     disk->src = source;
     origdriver = disk->driverType;
-    disk->driverType = driverType;
+    disk->driverType = (char *) "raw"; /* Don't want to probe backing files */
 
     if (virDomainLockDiskAttach(driver->lockManager, vm, disk) < 0)
         goto cleanup;