render / rpms / libvirt

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