]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: block: Add function to check if storage source allows concurrent access
authorPeter Krempa <pkrempa@redhat.com>
Tue, 14 Nov 2017 14:34:46 +0000 (15:34 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 23 Nov 2017 17:26:25 +0000 (18:26 +0100)
Storage source format backing a shared device (e.g. running a cluster
filesystem) needs to support the sharing so that metadata are not
corrupted. Add a central function for checking this.

src/qemu/qemu_block.c
src/qemu/qemu_block.h

index 8b23df8227ef2e81ccbafe8aea049e3d5f589f71..29a341f149502ddb885ea74a9cf77962694fdb0e 100644 (file)
@@ -390,6 +390,21 @@ qemuBlockGetNodeData(virJSONValuePtr data)
 }
 
 
+/**
+ * qemuBlockStorageSourceSupportsConcurrentAccess:
+ * @src: disk storage source
+ *
+ * Returns true if the given storage format supports concurrent access from two
+ * separate processes.
+ */
+bool
+qemuBlockStorageSourceSupportsConcurrentAccess(virStorageSourcePtr src)
+{
+    /* no need to check in backing chain since only RAW storage supports this */
+    return src->format == VIR_STORAGE_FILE_RAW;
+}
+
+
 /**
  * qemuBlockStorageSourceGetURI:
  * @src: disk storage source
index b9ee97f488725c2d402c03cfa96359c90890cd03..45485733fc887ed36711c11fcc42c09b5565028c 100644 (file)
@@ -54,6 +54,9 @@ qemuBlockNodeNamesDetect(virQEMUDriverPtr driver,
 virHashTablePtr
 qemuBlockGetNodeData(virJSONValuePtr data);
 
+bool
+qemuBlockStorageSourceSupportsConcurrentAccess(virStorageSourcePtr src);
+
 virJSONValuePtr
 qemuBlockStorageSourceGetBackendProps(virStorageSourcePtr src);