[PATCH 3/7] qemu: block: Add helper for generating snapshot transaction for -blockdev

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

 



For the modern use cases we are going to use 'blockdev-snapshot' instead
of 'blockdev-snapshot-sync'.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_block.c | 15 +++++++++++++++
 src/qemu/qemu_block.h |  5 +++++
 2 files changed, 20 insertions(+)

diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index 7145a2a99d..e47bc2d8f0 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -1886,6 +1886,21 @@ qemuBlockSnapshotAddLegacy(virJSONValuePtr actions,
 }


+int
+qemuBlockSnapshotAddBlockdev(virJSONValuePtr actions,
+                             virDomainDiskDefPtr disk,
+                             virStorageSourcePtr newsrc)
+{
+    if (qemuMonitorJSONTransactionAdd(actions, "blockdev-snapshot",
+                                      "s:node", disk->src->nodeformat,
+                                      "s:overlay", newsrc->nodeformat,
+                                      NULL) < 0)
+        return -1;
+
+    return 0;
+}
+
+
 /**
  * qemuBlockStorageGetCopyOnReadProps:
  * @disk: disk with copy-on-read enabled
diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h
index a5f6a3c75b..5fe5319ab9 100644
--- a/src/qemu/qemu_block.h
+++ b/src/qemu/qemu_block.h
@@ -163,6 +163,11 @@ qemuBlockSnapshotAddLegacy(virJSONValuePtr actions,
                            virStorageSourcePtr newsrc,
                            bool reuse);

+int
+qemuBlockSnapshotAddBlockdev(virJSONValuePtr actions,
+                             virDomainDiskDefPtr disk,
+                             virStorageSourcePtr newsrc);
+
 int
 qemuBlockStorageSourceCreateGetFormatProps(virStorageSourcePtr src,
                                            virStorageSourcePtr backing,
-- 
2.21.0

--
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]

  Powered by Linux