mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 07:17:44 +00:00
storage: Add witness for checking storage volume use in security driver
With my intended use of storage driver assist to chown files on remote storage we will need a witness that will tell us whether the given storage volume supports operations needed by the storage driver.
This commit is contained in:
parent
50f09651df
commit
222860cd36
@ -2357,6 +2357,37 @@ virStorageFileSupportsBackingChainTraversal(virStorageSourcePtr src)
|
|||||||
backend->storageFileAccess;
|
backend->storageFileAccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* virStorageFileSupportsSecurityDriver:
|
||||||
|
*
|
||||||
|
* @src: a storage file structure
|
||||||
|
*
|
||||||
|
* Check if a storage file supports operations needed by the security
|
||||||
|
* driver to perform labelling
|
||||||
|
*/
|
||||||
|
bool
|
||||||
|
virStorageFileSupportsSecurityDriver(virStorageSourcePtr src)
|
||||||
|
{
|
||||||
|
int actualType = virStorageSourceGetActualType(src);
|
||||||
|
virStorageFileBackendPtr backend;
|
||||||
|
|
||||||
|
if (!src)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (src->drv) {
|
||||||
|
backend = src->drv->backend;
|
||||||
|
} else {
|
||||||
|
if (!(backend = virStorageFileBackendForTypeInternal(actualType,
|
||||||
|
src->protocol,
|
||||||
|
false)))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return !!backend->storageFileChown;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
virStorageFileDeinit(virStorageSourcePtr src)
|
virStorageFileDeinit(virStorageSourcePtr src)
|
||||||
{
|
{
|
||||||
|
@ -45,6 +45,8 @@ const char *virStorageFileGetUniqueIdentifier(virStorageSourcePtr src);
|
|||||||
int virStorageFileAccess(virStorageSourcePtr src, int mode);
|
int virStorageFileAccess(virStorageSourcePtr src, int mode);
|
||||||
int virStorageFileChown(virStorageSourcePtr src, uid_t uid, gid_t gid);
|
int virStorageFileChown(virStorageSourcePtr src, uid_t uid, gid_t gid);
|
||||||
|
|
||||||
|
bool virStorageFileSupportsSecurityDriver(virStorageSourcePtr src);
|
||||||
|
|
||||||
int virStorageFileGetMetadata(virStorageSourcePtr src,
|
int virStorageFileGetMetadata(virStorageSourcePtr src,
|
||||||
uid_t uid, gid_t gid,
|
uid_t uid, gid_t gid,
|
||||||
bool allow_probe)
|
bool allow_probe)
|
||||||
|
Loading…
Reference in New Issue
Block a user