Blame SOURCES/libvirt-qemu-block-Add-function-to-check-if-storage-source-allows-concurrent-access.patch

c1c534
From a77029a7a8885902edbc0034c15c2a609a1093ba Mon Sep 17 00:00:00 2001
c1c534
Message-Id: <a77029a7a8885902edbc0034c15c2a609a1093ba@dist-git>
c1c534
From: Peter Krempa <pkrempa@redhat.com>
c1c534
Date: Thu, 23 Nov 2017 19:02:18 +0100
c1c534
Subject: [PATCH] qemu: block: Add function to check if storage source allows
c1c534
 concurrent access
c1c534
c1c534
Storage source format backing a shared device (e.g. running a cluster
c1c534
filesystem) needs to support the sharing so that metadata are not
c1c534
corrupted. Add a central function for checking this.
c1c534
c1c534
(cherry picked from commit 1fc3cd8731640aefc48bbd9fc489f21cb99c6f67)
c1c534
c1c534
 Conflicts:
c1c534
	src/qemu/qemu_block.c: context of one of the blockdev-add saga
c1c534
                               refactors not being backported
c1c534
c1c534
https://bugzilla.redhat.com/show_bug.cgi?id=1511480
c1c534
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
c1c534
---
c1c534
 src/qemu/qemu_block.c | 15 +++++++++++++++
c1c534
 src/qemu/qemu_block.h |  3 +++
c1c534
 2 files changed, 18 insertions(+)
c1c534
c1c534
diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
c1c534
index 0761f89913..86fa565f39 100644
c1c534
--- a/src/qemu/qemu_block.c
c1c534
+++ b/src/qemu/qemu_block.c
c1c534
@@ -390,6 +390,21 @@ qemuBlockGetNodeData(virJSONValuePtr data)
c1c534
 }
c1c534
 
c1c534
 
c1c534
+/**
c1c534
+ * qemuBlockStorageSourceSupportsConcurrentAccess:
c1c534
+ * @src: disk storage source
c1c534
+ *
c1c534
+ * Returns true if the given storage format supports concurrent access from two
c1c534
+ * separate processes.
c1c534
+ */
c1c534
+bool
c1c534
+qemuBlockStorageSourceSupportsConcurrentAccess(virStorageSourcePtr src)
c1c534
+{
c1c534
+    /* no need to check in backing chain since only RAW storage supports this */
c1c534
+    return src->format == VIR_STORAGE_FILE_RAW;
c1c534
+}
c1c534
+
c1c534
+
c1c534
 /**
c1c534
  * qemuBlockStorageSourceBuildJSONSocketAddress
c1c534
  * @host: the virStorageNetHostDefPtr definition to build
c1c534
diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h
c1c534
index f0a2c9aa7d..ebf3149ce8 100644
c1c534
--- a/src/qemu/qemu_block.h
c1c534
+++ b/src/qemu/qemu_block.h
c1c534
@@ -53,6 +53,9 @@ qemuBlockNodeNamesDetect(virQEMUDriverPtr driver,
c1c534
 virHashTablePtr
c1c534
 qemuBlockGetNodeData(virJSONValuePtr data);
c1c534
 
c1c534
+bool
c1c534
+qemuBlockStorageSourceSupportsConcurrentAccess(virStorageSourcePtr src);
c1c534
+
c1c534
 virJSONValuePtr
c1c534
 qemuBlockStorageSourceGetBackendProps(virStorageSourcePtr src);
c1c534
 
c1c534
-- 
c1c534
2.15.0
c1c534