Re: [libvirt] [PATCH 02/12] storage: Add feature check for storage file backend supporting access check

2017-10-26 Thread John Ferlan


On 10/20/2017 09:47 AM, Peter Krempa wrote:
> When the user provides backing chain, we don't need the full support for
> traversing the backing chain. This patch adds a feature check for the
> virStorageSourceAccess API.
> ---
>  src/storage/storage_source.c | 20 
>  src/storage/storage_source.h |  1 +
>  2 files changed, 21 insertions(+)
> 

Reviewed-by: John Ferlan 

John

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 02/12] storage: Add feature check for storage file backend supporting access check

2017-10-20 Thread Peter Krempa
When the user provides backing chain, we don't need the full support for
traversing the backing chain. This patch adds a feature check for the
virStorageSourceAccess API.
---
 src/storage/storage_source.c | 20 
 src/storage/storage_source.h |  1 +
 2 files changed, 21 insertions(+)

diff --git a/src/storage/storage_source.c b/src/storage/storage_source.c
index e3c5c3285..cced5308c 100644
--- a/src/storage/storage_source.c
+++ b/src/storage/storage_source.c
@@ -95,6 +95,26 @@ virStorageFileSupportsSecurityDriver(const virStorageSource 
*src)
 }


+/**
+ * virStorageFileSupportsAccess:
+ *
+ * @src: a storage file structure
+ *
+ * Check if a storage file supports checking if the storage source is 
accessible
+ * for the given vm.
+ */
+bool
+virStorageFileSupportsAccess(const virStorageSource *src)
+{
+virStorageFileBackendPtr backend;
+
+if (!(backend = virStorageFileGetBackendForSupportCheck(src)))
+return false;
+
+return !!backend->storageFileAccess;
+}
+
+
 void
 virStorageFileDeinit(virStorageSourcePtr src)
 {
diff --git a/src/storage/storage_source.h b/src/storage/storage_source.h
index 6462baf6a..320ea3cab 100644
--- a/src/storage/storage_source.h
+++ b/src/storage/storage_source.h
@@ -41,6 +41,7 @@ int virStorageFileAccess(virStorageSourcePtr src, int mode);
 int virStorageFileChown(const virStorageSource *src, uid_t uid, gid_t gid);

 bool virStorageFileSupportsSecurityDriver(const virStorageSource *src);
+bool virStorageFileSupportsAccess(const virStorageSource *src);

 int virStorageFileGetMetadata(virStorageSourcePtr src,
   uid_t uid, gid_t gid,
-- 
2.14.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list