[PATCH RFC 22/39] qemu: block: Add generator for the 'copy-on-read' blockdev driver

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

 



The copy on read functionality is done using a separate layer in the
backing chain. Add function to generate properties for it.

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

diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index 66e6301210..5016c9ba83 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -1743,3 +1743,25 @@ qemuBlockSnapshotAddLegacy(virJSONValuePtr actions,
     VIR_FREE(source);
     return ret;
 }
+
+
+/**
+ * qemuBlockStorageGetCopyOnReadProps:
+ * @disk: disk with copy-on-read enabled
+ *
+ * Creates blockdev properties for a disk copy-on-read layer.
+ */
+virJSONValuePtr
+qemuBlockStorageGetCopyOnReadProps(virDomainDiskDefPtr disk)
+{
+    qemuDomainDiskPrivatePtr priv = QEMU_DOMAIN_DISK_PRIVATE(disk);
+    virJSONValuePtr ret = NULL;
+
+    ignore_value(virJSONValueObjectCreate(&ret,
+                                          "s:driver", "copy-on-read",
+                                          "s:node-name", priv->nodeCopyOnRead,
+                                          "s:file", disk->src->nodeformat,
+                                          NULL));
+
+    return ret;
+}
diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h
index fd8984e60b..62ed5027cb 100644
--- a/src/qemu/qemu_block.h
+++ b/src/qemu/qemu_block.h
@@ -67,6 +67,8 @@ qemuBlockStorageSourceGetURI(virStorageSourcePtr src);
 virJSONValuePtr
 qemuBlockStorageSourceGetBlockdevProps(virStorageSourcePtr src);

+virJSONValuePtr
+qemuBlockStorageGetCopyOnReadProps(virDomainDiskDefPtr disk);

 typedef struct qemuBlockStorageSourceAttachData qemuBlockStorageSourceAttachData;
 typedef qemuBlockStorageSourceAttachData *qemuBlockStorageSourceAttachDataPtr;
-- 
2.16.2

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