Patch to enable transient disks in libvirt for qemu

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm not a C coder, but hey I managed to get transient disks working.  I
think there was some discussion years ago on the list about having
libvirt/qemu dump the transient disk image into a default random temp
directory wasn't the Right Way To Do Things, and I think interest
evaporated.

Anyway, have a patch.
diff -urN libvirt-1.2.18.2/src/qemu/qemu_command.c libvirt-1.2.18.2-patched/src/qemu/qemu_command.c
--- libvirt-1.2.18.2/src/qemu/qemu_command.c    2015-12-23 18:21:41.000000000 -0500
+++ libvirt-1.2.18.2-patched/src/qemu/qemu_command.c    2016-05-06 17:26:55.033133087 -0400
@@ -3756,9 +3756,7 @@
         virBufferAddLit(&opt, ",readonly=on");
     }
     if (disk->transient) {
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                       _("transient disks not supported yet"));
-        goto error;
+       virBufferAddLit(&opt, ",snapshot=on");
     }
     if (disk->src->format > 0 &&
         disk->src->type != VIR_STORAGE_TYPE_DIR &&
@@ -9839,13 +9837,20 @@
             optstr = qemuBuildDriveStr(conn, disk,
                                        emitBootindex ? false : !!bootindex,
                                        qemuCaps);
+
             if (deviceFlagMasked)
                 virQEMUCapsSet(qemuCaps, QEMU_CAPS_DEVICE);
+
             if (!optstr)
                 goto error;
+
             virCommandAddArg(cmd, optstr);
             VIR_FREE(optstr);
 
+            if (disk->transient) {
+                virCommandAddArg(cmd, "-snapshot");
+            }
+
             if (!emitBootindex)
                 bootindex = 0;
             else if (disk->info.bootIndex)
--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]