[PATCH 03/17] qemu: block: Introduce helper for deciding when a 'format' layer is needed

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

 



The 'format' layer is not required in certain cases. As the logic for
this will be a bit more involved create a helper function to do the
decision.

For now we'll keep to always format the 'format' -blockdev layer.

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

diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index 1a718ae82b..123e764e63 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -3281,6 +3281,25 @@ qemuBlockStorageSourceNeedsStorageSliceLayer(const virStorageSource *src)
 }


+/**
+ * qemuBlockStorageSourceNeedsFormatLayer:
+ * @src: storage source
+ *
+ * Returns true if configuration of @src requires a 'format' layer -blockdev.
+ *
+ * Important: This helper must be used only for decisions when setting up a
+ * '-blockdev' backend in which case the format layer node name will be populated.
+ * Any cases when the backend can be already in use must decide based on the
+ * existence of the format layer nodename.
+ */
+bool
+qemuBlockStorageSourceNeedsFormatLayer(const virStorageSource *src G_GNUC_UNUSED)
+{
+    /* Currently we always create a 'format' layer */
+    return true;
+}
+
+
 /**
  * qemuBlockStorageSourceGetCookieString:
  * @src: storage source
diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h
index 85616a140d..dcd8a6ed6c 100644
--- a/src/qemu/qemu_block.h
+++ b/src/qemu/qemu_block.h
@@ -280,6 +280,9 @@ qemuBlockReopenReadOnly(virDomainObj *vm,
 bool
 qemuBlockStorageSourceNeedsStorageSliceLayer(const virStorageSource *src);

+bool
+qemuBlockStorageSourceNeedsFormatLayer(const virStorageSource *src);
+
 char *
 qemuBlockStorageSourceGetCookieString(virStorageSource *src);

-- 
2.42.0
_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx




[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