]> xenbits.xensource.com Git - libvirt.git/commitdiff
security: apparmor: load the storage driver dynamically
authorPeter Krempa <pkrempa@redhat.com>
Wed, 26 Jul 2017 19:57:23 +0000 (21:57 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 27 Jul 2017 10:00:35 +0000 (12:00 +0200)
In commit 5e515b542d I've attempted to fix the inability to access
storage from the apparmor helper program by linking with the storage
driver. By linking with the .so the linker complains that it's not
portable. Fix this by loading the module dynamically as we are supposed
to do.

Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
src/Makefile.am
src/security/virt-aa-helper.c

index 471be40d172e8fb818c6d51f981a6c95b94b1c31..b8e875482969f01374cd2309e6e79c4ac581a178 100644 (file)
@@ -3124,7 +3124,7 @@ virt_aa_helper_LDADD =                                            \
                libvirt.la                                      \
                libvirt_conf.la                                 \
                libvirt_util.la                                 \
-               libvirt_driver_storage.la                       \
+               libvirt_driver_storage_impl.la                  \
                ../gnulib/lib/libgnu.la
 if WITH_DTRACE_PROBES
 virt_aa_helper_LDADD += libvirt_probes.lo
index a751d6debe12bd104cfee9a5106fdfe5a955e467..35dcb35bc479b922abea6745054eecccece0b714 100644 (file)
@@ -41,6 +41,7 @@
 #include "viralloc.h"
 #include "vircommand.h"
 #include "virlog.h"
+#include "driver.h"
 
 #include "security_driver.h"
 #include "security_apparmor.h"
@@ -56,7 +57,6 @@
 #include "virgettext.h"
 
 #include "storage/storage_source.h"
-#include "storage/storage_backend.h"
 
 #define VIR_FROM_THIS VIR_FROM_SECURITY
 
@@ -927,10 +927,10 @@ get_files(vahControl * ctl)
         goto cleanup;
     }
 
-    if (virStorageBackendDriversRegister(false) < 0) {
-        vah_error(ctl, 0, _("failed to register storage driver backend"));
-        goto cleanup;
-    }
+    /* load the storage driver so that backing store can be accessed */
+#ifdef WITH_STORAGE
+    virDriverLoadModule("storage", "storageRegister");
+#endif
 
     for (i = 0; i < ctl->def->ndisks; i++) {
         virDomainDiskDefPtr disk = ctl->def->disks[i];