virStorageFileSupportsSecurityDriver ends up initializing the storage
file backend which after the recent changes to the daemon architecture
may end up dlopening of the backend modules.
Since this is required only for remote storage we can optimize the call
by moving the check whether the backend is supported to the branch which
deals with remote storage.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Mores <pmores@redhat.com>
int rv;
g_autoptr(virStorageSource) cpy = NULL;
- rv = virStorageFileSupportsSecurityDriver(src);
- if (rv <= 0)
- return rv;
-
if (virStorageSourceIsLocalStorage(src)) {
/* use direct chown for local files so that the file doesn't
* need to be initialized */
return 0;
}
+ if ((rv = virStorageFileSupportsSecurityDriver(src)) <= 0)
+ return rv;
+
if (!(cpy = virStorageSourceCopy(src, false)))
return -1;