Daniel P. Berrange e3a592
From bbf8c57b06ec1b63ae814114867eaceebb7dc166 Mon Sep 17 00:00:00 2001
Daniel P. Berrange e3a592
From: Daniel P. Berrange <berrange@redhat.com>
Daniel P. Berrange e3a592
Date: Tue, 15 Jun 2010 17:44:19 +0100
Daniel P. Berrange e3a592
Subject: [PATCH 07/11] Pass security driver object into all security driver callbacks
Daniel P. Berrange e3a592
Daniel P. Berrange e3a592
The implementation of security driver callbacks often needs
Daniel P. Berrange e3a592
to access the security driver object. Currently only a handful
Daniel P. Berrange e3a592
of callbacks include the driver object as a parameter. Later
Daniel P. Berrange e3a592
patches require this is many more places.
Daniel P. Berrange e3a592
Daniel P. Berrange e3a592
* src/qemu/qemu_driver.c: Pass in the security driver object
Daniel P. Berrange e3a592
  to all callbacks
Daniel P. Berrange e3a592
* src/qemu/qemu_security_dac.c, src/qemu/qemu_security_stacked.c,
Daniel P. Berrange e3a592
  src/security/security_apparmor.c, src/security/security_driver.h,
Daniel P. Berrange e3a592
  src/security/security_selinux.c: Add a virSecurityDriverPtr
Daniel P. Berrange e3a592
  param to all security callbacks
Daniel P. Berrange e3a592
---
Daniel P. Berrange e3a592
 src/qemu/qemu_driver.c           |   88 ++++++++++++++++++++-----------
Daniel P. Berrange e3a592
 src/qemu/qemu_security_dac.c     |   44 +++++++++++-----
Daniel P. Berrange e3a592
 src/qemu/qemu_security_stacked.c |  107 +++++++++++++++++++++++++-------------
Daniel P. Berrange e3a592
 src/security/security_apparmor.c |   57 +++++++++++++-------
Daniel P. Berrange e3a592
 src/security/security_driver.h   |   40 ++++++++++----
Daniel P. Berrange e3a592
 src/security/security_selinux.c  |   56 +++++++++++++------
Daniel P. Berrange e3a592
 6 files changed, 260 insertions(+), 132 deletions(-)
Daniel P. Berrange e3a592
Daniel P. Berrange e3a592
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
Daniel P. Berrange e3a592
index 99aeffa..616547c 100644
Daniel P. Berrange e3a592
--- a/src/qemu/qemu_driver.c
Daniel P. Berrange e3a592
+++ b/src/qemu/qemu_driver.c
Daniel P. Berrange e3a592
@@ -1278,7 +1278,8 @@ qemuReconnectDomain(void *payload, const char *name ATTRIBUTE_UNUSED, void *opaq
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     if (driver->securityDriver &&
Daniel P. Berrange e3a592
         driver->securityDriver->domainReserveSecurityLabel &&
Daniel P. Berrange e3a592
-        driver->securityDriver->domainReserveSecurityLabel(obj) < 0)
Daniel P. Berrange e3a592
+        driver->securityDriver->domainReserveSecurityLabel(driver->securityDriver,
Daniel P. Berrange e3a592
+                                                           obj) < 0)
Daniel P. Berrange e3a592
         goto error;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     if (obj->def->id >= driver->nextvmid)
Daniel P. Berrange e3a592
@@ -3401,13 +3402,15 @@ static int qemudStartVMDaemon(virConnectPtr conn,
Daniel P. Berrange e3a592
     DEBUG0("Generating domain security label (if required)");
Daniel P. Berrange e3a592
     if (driver->securityDriver &&
Daniel P. Berrange e3a592
         driver->securityDriver->domainGenSecurityLabel &&
Daniel P. Berrange e3a592
-        driver->securityDriver->domainGenSecurityLabel(vm) < 0)
Daniel P. Berrange e3a592
+        driver->securityDriver->domainGenSecurityLabel(driver->securityDriver,
Daniel P. Berrange e3a592
+                                                       vm) < 0)
Daniel P. Berrange e3a592
         goto cleanup;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     DEBUG0("Generating setting domain security labels (if required)");
Daniel P. Berrange e3a592
     if (driver->securityDriver &&
Daniel P. Berrange e3a592
         driver->securityDriver->domainSetSecurityAllLabel &&
Daniel P. Berrange e3a592
-        driver->securityDriver->domainSetSecurityAllLabel(vm, stdin_path) < 0) {
Daniel P. Berrange e3a592
+        driver->securityDriver->domainSetSecurityAllLabel(driver->securityDriver,
Daniel P. Berrange e3a592
+                                                          vm, stdin_path) < 0) {
Daniel P. Berrange e3a592
         if (stdin_path && virStorageFileIsSharedFS(stdin_path) != 1)
Daniel P. Berrange e3a592
             goto cleanup;
Daniel P. Berrange e3a592
     }
Daniel P. Berrange e3a592
@@ -3766,10 +3769,12 @@ static void qemudShutdownVMDaemon(struct qemud_driver *driver,
Daniel P. Berrange e3a592
     /* Reset Security Labels */
Daniel P. Berrange e3a592
     if (driver->securityDriver &&
Daniel P. Berrange e3a592
         driver->securityDriver->domainRestoreSecurityAllLabel)
Daniel P. Berrange e3a592
-        driver->securityDriver->domainRestoreSecurityAllLabel(vm, migrated);
Daniel P. Berrange e3a592
+        driver->securityDriver->domainRestoreSecurityAllLabel(driver->securityDriver,
Daniel P. Berrange e3a592
+                                                              vm, migrated);
Daniel P. Berrange e3a592
     if (driver->securityDriver &&
Daniel P. Berrange e3a592
         driver->securityDriver->domainReleaseSecurityLabel)
Daniel P. Berrange e3a592
-        driver->securityDriver->domainReleaseSecurityLabel(vm);
Daniel P. Berrange e3a592
+        driver->securityDriver->domainReleaseSecurityLabel(driver->securityDriver,
Daniel P. Berrange e3a592
+                                                           vm);
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     /* Clear out dynamically assigned labels */
Daniel P. Berrange e3a592
     if (vm->def->seclabel.type == VIR_DOMAIN_SECLABEL_DYNAMIC) {
Daniel P. Berrange e3a592
@@ -5171,7 +5176,8 @@ static int qemudDomainSaveFlag(virDomainPtr dom, const char *path,
Daniel P. Berrange e3a592
     if ((!bypassSecurityDriver) &&
Daniel P. Berrange e3a592
         driver->securityDriver &&
Daniel P. Berrange e3a592
         driver->securityDriver->domainSetSavedStateLabel &&
Daniel P. Berrange e3a592
-        driver->securityDriver->domainSetSavedStateLabel(vm, path) == -1)
Daniel P. Berrange e3a592
+        driver->securityDriver->domainSetSavedStateLabel(driver->securityDriver,
Daniel P. Berrange e3a592
+                                                         vm, path) == -1)
Daniel P. Berrange e3a592
         goto endjob;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     if (header.compressed == QEMUD_SAVE_FORMAT_RAW) {
Daniel P. Berrange e3a592
@@ -5206,7 +5212,8 @@ static int qemudDomainSaveFlag(virDomainPtr dom, const char *path,
Daniel P. Berrange e3a592
     if ((!bypassSecurityDriver) &&
Daniel P. Berrange e3a592
         driver->securityDriver &&
Daniel P. Berrange e3a592
         driver->securityDriver->domainRestoreSavedStateLabel &&
Daniel P. Berrange e3a592
-        driver->securityDriver->domainRestoreSavedStateLabel(vm, path) == -1)
Daniel P. Berrange e3a592
+        driver->securityDriver->domainRestoreSavedStateLabel(driver->securityDriver,
Daniel P. Berrange e3a592
+                                                             vm, path) == -1)
Daniel P. Berrange e3a592
         VIR_WARN("failed to restore save state label on %s", path);
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     if (cgroup != NULL) {
Daniel P. Berrange e3a592
@@ -5253,7 +5260,8 @@ endjob:
Daniel P. Berrange e3a592
             if ((!bypassSecurityDriver) &&
Daniel P. Berrange e3a592
                 driver->securityDriver &&
Daniel P. Berrange e3a592
                 driver->securityDriver->domainRestoreSavedStateLabel &&
Daniel P. Berrange e3a592
-                driver->securityDriver->domainRestoreSavedStateLabel(vm, path) == -1)
Daniel P. Berrange e3a592
+                driver->securityDriver->domainRestoreSavedStateLabel(driver->securityDriver,
Daniel P. Berrange e3a592
+                                                                     vm, path) == -1)
Daniel P. Berrange e3a592
                 VIR_WARN("failed to restore save state label on %s", path);
Daniel P. Berrange e3a592
         }
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
@@ -5488,7 +5496,8 @@ static int qemudDomainCoreDump(virDomainPtr dom,
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     if (driver->securityDriver &&
Daniel P. Berrange e3a592
         driver->securityDriver->domainSetSavedStateLabel &&
Daniel P. Berrange e3a592
-        driver->securityDriver->domainSetSavedStateLabel(vm, path) == -1)
Daniel P. Berrange e3a592
+        driver->securityDriver->domainSetSavedStateLabel(driver->securityDriver,
Daniel P. Berrange e3a592
+                                                         vm, path) == -1)
Daniel P. Berrange e3a592
         goto endjob;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     /* Migrate will always stop the VM, so the resume condition is
Daniel P. Berrange e3a592
@@ -5531,7 +5540,8 @@ static int qemudDomainCoreDump(virDomainPtr dom,
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     if (driver->securityDriver &&
Daniel P. Berrange e3a592
         driver->securityDriver->domainRestoreSavedStateLabel &&
Daniel P. Berrange e3a592
-        driver->securityDriver->domainRestoreSavedStateLabel(vm, path) == -1)
Daniel P. Berrange e3a592
+        driver->securityDriver->domainRestoreSavedStateLabel(driver->securityDriver,
Daniel P. Berrange e3a592
+                                                             vm, path) == -1)
Daniel P. Berrange e3a592
         goto endjob;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 endjob:
Daniel P. Berrange e3a592
@@ -5914,12 +5924,13 @@ static int qemudDomainGetSecurityLabel(virDomainPtr dom, virSecurityLabelPtr sec
Daniel P. Berrange e3a592
      *   QEMU monitor hasn't seen SIGHUP/ERR on poll().
Daniel P. Berrange e3a592
      */
Daniel P. Berrange e3a592
     if (virDomainObjIsActive(vm)) {
Daniel P. Berrange e3a592
-        if (driver->securityDriver && driver->securityDriver->domainGetSecurityProcessLabel) {
Daniel P. Berrange e3a592
-            if (driver->securityDriver->domainGetSecurityProcessLabel(vm, seclabel) == -1) {
Daniel P. Berrange e3a592
-                qemuReportError(VIR_ERR_INTERNAL_ERROR,
Daniel P. Berrange e3a592
-                                "%s", _("Failed to get security label"));
Daniel P. Berrange e3a592
-                goto cleanup;
Daniel P. Berrange e3a592
-            }
Daniel P. Berrange e3a592
+        if (driver->securityDriver &&
Daniel P. Berrange e3a592
+            driver->securityDriver->domainGetSecurityProcessLabel &&
Daniel P. Berrange e3a592
+            driver->securityDriver->domainGetSecurityProcessLabel(driver->securityDriver,
Daniel P. Berrange e3a592
+                                                                  vm, seclabel) < 0) {
Daniel P. Berrange e3a592
+            qemuReportError(VIR_ERR_INTERNAL_ERROR,
Daniel P. Berrange e3a592
+                            "%s", _("Failed to get security label"));
Daniel P. Berrange e3a592
+            goto cleanup;
Daniel P. Berrange e3a592
         }
Daniel P. Berrange e3a592
     }
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
@@ -6325,7 +6336,8 @@ qemudDomainSaveImageStartVM(virConnectPtr conn,
Daniel P. Berrange e3a592
 out:
Daniel P. Berrange e3a592
     if (driver->securityDriver &&
Daniel P. Berrange e3a592
         driver->securityDriver->domainRestoreSavedStateLabel &&
Daniel P. Berrange e3a592
-        driver->securityDriver->domainRestoreSavedStateLabel(vm, path) == -1)
Daniel P. Berrange e3a592
+        driver->securityDriver->domainRestoreSavedStateLabel(driver->securityDriver,
Daniel P. Berrange e3a592
+                                                             vm, path) == -1)
Daniel P. Berrange e3a592
         VIR_WARN("failed to restore save state label on %s", path);
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     return ret;
Daniel P. Berrange e3a592
@@ -7039,7 +7051,8 @@ static int qemudDomainChangeEjectableMedia(struct qemud_driver *driver,
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     if (driver->securityDriver &&
Daniel P. Berrange e3a592
         driver->securityDriver->domainSetSecurityImageLabel &&
Daniel P. Berrange e3a592
-        driver->securityDriver->domainSetSecurityImageLabel(vm, disk) < 0)
Daniel P. Berrange e3a592
+        driver->securityDriver->domainSetSecurityImageLabel(driver->securityDriver,
Daniel P. Berrange e3a592
+                                                            vm, disk) < 0)
Daniel P. Berrange e3a592
         return -1;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     if (!(driveAlias = qemuDeviceDriveHostAlias(origdisk, qemuCmdFlags)))
Daniel P. Berrange e3a592
@@ -7068,7 +7081,8 @@ static int qemudDomainChangeEjectableMedia(struct qemud_driver *driver,
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     if (driver->securityDriver &&
Daniel P. Berrange e3a592
         driver->securityDriver->domainRestoreSecurityImageLabel &&
Daniel P. Berrange e3a592
-        driver->securityDriver->domainRestoreSecurityImageLabel(vm, origdisk) < 0)
Daniel P. Berrange e3a592
+        driver->securityDriver->domainRestoreSecurityImageLabel(driver->securityDriver,
Daniel P. Berrange e3a592
+                                                                vm, origdisk) < 0)
Daniel P. Berrange e3a592
         VIR_WARN("Unable to restore security label on ejected image %s", origdisk->src);
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     VIR_FREE(origdisk->src);
Daniel P. Berrange e3a592
@@ -7086,7 +7100,8 @@ error:
Daniel P. Berrange e3a592
     VIR_FREE(driveAlias);
Daniel P. Berrange e3a592
     if (driver->securityDriver &&
Daniel P. Berrange e3a592
         driver->securityDriver->domainRestoreSecurityImageLabel &&
Daniel P. Berrange e3a592
-        driver->securityDriver->domainRestoreSecurityImageLabel(vm, disk) < 0)
Daniel P. Berrange e3a592
+        driver->securityDriver->domainRestoreSecurityImageLabel(driver->securityDriver,
Daniel P. Berrange e3a592
+                                                                vm, disk) < 0)
Daniel P. Berrange e3a592
         VIR_WARN("Unable to restore security label on new media %s", disk->src);
Daniel P. Berrange e3a592
     return -1;
Daniel P. Berrange e3a592
 }
Daniel P. Berrange e3a592
@@ -7113,7 +7128,8 @@ static int qemudDomainAttachPciDiskDevice(struct qemud_driver *driver,
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     if (driver->securityDriver &&
Daniel P. Berrange e3a592
         driver->securityDriver->domainSetSecurityImageLabel &&
Daniel P. Berrange e3a592
-        driver->securityDriver->domainSetSecurityImageLabel(vm, disk) < 0)
Daniel P. Berrange e3a592
+        driver->securityDriver->domainSetSecurityImageLabel(driver->securityDriver,
Daniel P. Berrange e3a592
+                                                            vm, disk) < 0)
Daniel P. Berrange e3a592
         return -1;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     if (qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE) {
Daniel P. Berrange e3a592
@@ -7180,7 +7196,8 @@ error:
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     if (driver->securityDriver &&
Daniel P. Berrange e3a592
         driver->securityDriver->domainRestoreSecurityImageLabel &&
Daniel P. Berrange e3a592
-        driver->securityDriver->domainRestoreSecurityImageLabel(vm, disk) < 0)
Daniel P. Berrange e3a592
+        driver->securityDriver->domainRestoreSecurityImageLabel(driver->securityDriver,
Daniel P. Berrange e3a592
+                                                                vm, disk) < 0)
Daniel P. Berrange e3a592
         VIR_WARN("Unable to restore security label on %s", disk->src);
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     return -1;
Daniel P. Berrange e3a592
@@ -7322,7 +7339,8 @@ static int qemudDomainAttachSCSIDisk(struct qemud_driver *driver,
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     if (driver->securityDriver &&
Daniel P. Berrange e3a592
         driver->securityDriver->domainSetSecurityImageLabel &&
Daniel P. Berrange e3a592
-        driver->securityDriver->domainSetSecurityImageLabel(vm, disk) < 0)
Daniel P. Berrange e3a592
+        driver->securityDriver->domainSetSecurityImageLabel(driver->securityDriver,
Daniel P. Berrange e3a592
+                                                            vm, disk) < 0)
Daniel P. Berrange e3a592
         return -1;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     /* We should have an address already, so make sure */
Daniel P. Berrange e3a592
@@ -7408,7 +7426,8 @@ error:
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     if (driver->securityDriver &&
Daniel P. Berrange e3a592
         driver->securityDriver->domainRestoreSecurityImageLabel &&
Daniel P. Berrange e3a592
-        driver->securityDriver->domainRestoreSecurityImageLabel(vm, disk) < 0)
Daniel P. Berrange e3a592
+        driver->securityDriver->domainRestoreSecurityImageLabel(driver->securityDriver,
Daniel P. Berrange e3a592
+                                                                vm, disk) < 0)
Daniel P. Berrange e3a592
         VIR_WARN("Unable to restore security label on %s", disk->src);
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     return -1;
Daniel P. Berrange e3a592
@@ -7435,7 +7454,8 @@ static int qemudDomainAttachUsbMassstorageDevice(struct qemud_driver *driver,
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     if (driver->securityDriver &&
Daniel P. Berrange e3a592
         driver->securityDriver->domainSetSecurityImageLabel &&
Daniel P. Berrange e3a592
-        driver->securityDriver->domainSetSecurityImageLabel(vm, disk) < 0)
Daniel P. Berrange e3a592
+        driver->securityDriver->domainSetSecurityImageLabel(driver->securityDriver,
Daniel P. Berrange e3a592
+                                                            vm, disk) < 0)
Daniel P. Berrange e3a592
         return -1;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     if (!disk->src) {
Daniel P. Berrange e3a592
@@ -7491,7 +7511,8 @@ error:
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     if (driver->securityDriver &&
Daniel P. Berrange e3a592
         driver->securityDriver->domainRestoreSecurityImageLabel &&
Daniel P. Berrange e3a592
-        driver->securityDriver->domainRestoreSecurityImageLabel(vm, disk) < 0)
Daniel P. Berrange e3a592
+        driver->securityDriver->domainRestoreSecurityImageLabel(driver->securityDriver,
Daniel P. Berrange e3a592
+                                                                vm, disk) < 0)
Daniel P. Berrange e3a592
         VIR_WARN("Unable to restore security label on %s", disk->src);
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     return -1;
Daniel P. Berrange e3a592
@@ -7928,7 +7949,8 @@ static int qemudDomainAttachHostDevice(struct qemud_driver *driver,
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     if (driver->securityDriver &&
Daniel P. Berrange e3a592
         driver->securityDriver->domainSetSecurityHostdevLabel &&
Daniel P. Berrange e3a592
-        driver->securityDriver->domainSetSecurityHostdevLabel(vm, hostdev) < 0)
Daniel P. Berrange e3a592
+        driver->securityDriver->domainSetSecurityHostdevLabel(driver->securityDriver,
Daniel P. Berrange e3a592
+                                                              vm, hostdev) < 0)
Daniel P. Berrange e3a592
         return -1;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     switch (hostdev->source.subsys.type) {
Daniel P. Berrange e3a592
@@ -7956,7 +7978,8 @@ static int qemudDomainAttachHostDevice(struct qemud_driver *driver,
Daniel P. Berrange e3a592
 error:
Daniel P. Berrange e3a592
     if (driver->securityDriver &&
Daniel P. Berrange e3a592
         driver->securityDriver->domainRestoreSecurityHostdevLabel &&
Daniel P. Berrange e3a592
-        driver->securityDriver->domainRestoreSecurityHostdevLabel(vm, hostdev) < 0)
Daniel P. Berrange e3a592
+        driver->securityDriver->domainRestoreSecurityHostdevLabel(driver->securityDriver,
Daniel P. Berrange e3a592
+                                                                  vm, hostdev) < 0)
Daniel P. Berrange e3a592
         VIR_WARN0("Unable to restore host device labelling on hotplug fail");
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     return -1;
Daniel P. Berrange e3a592
@@ -8401,7 +8424,8 @@ static int qemudDomainDetachPciDiskDevice(struct qemud_driver *driver,
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     if (driver->securityDriver &&
Daniel P. Berrange e3a592
         driver->securityDriver->domainRestoreSecurityImageLabel &&
Daniel P. Berrange e3a592
-        driver->securityDriver->domainRestoreSecurityImageLabel(vm, dev->data.disk) < 0)
Daniel P. Berrange e3a592
+        driver->securityDriver->domainRestoreSecurityImageLabel(driver->securityDriver,
Daniel P. Berrange e3a592
+                                                                vm, dev->data.disk) < 0)
Daniel P. Berrange e3a592
         VIR_WARN("Unable to restore security label on %s", dev->data.disk->src);
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     if (cgroup != NULL) {
Daniel P. Berrange e3a592
@@ -8464,7 +8488,8 @@ static int qemudDomainDetachSCSIDiskDevice(struct qemud_driver *driver,
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     if (driver->securityDriver &&
Daniel P. Berrange e3a592
         driver->securityDriver->domainRestoreSecurityImageLabel &&
Daniel P. Berrange e3a592
-        driver->securityDriver->domainRestoreSecurityImageLabel(vm, dev->data.disk) < 0)
Daniel P. Berrange e3a592
+        driver->securityDriver->domainRestoreSecurityImageLabel(driver->securityDriver,
Daniel P. Berrange e3a592
+                                                                vm, dev->data.disk) < 0)
Daniel P. Berrange e3a592
         VIR_WARN("Unable to restore security label on %s", dev->data.disk->src);
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     if (cgroup != NULL) {
Daniel P. Berrange e3a592
@@ -8889,7 +8914,8 @@ static int qemudDomainDetachHostDevice(struct qemud_driver *driver,
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     if (driver->securityDriver &&
Daniel P. Berrange e3a592
         driver->securityDriver->domainRestoreSecurityHostdevLabel &&
Daniel P. Berrange e3a592
-        driver->securityDriver->domainRestoreSecurityHostdevLabel(vm, dev->data.hostdev) < 0)
Daniel P. Berrange e3a592
+        driver->securityDriver->domainRestoreSecurityHostdevLabel(driver->securityDriver,
Daniel P. Berrange e3a592
+                                                                  vm, dev->data.hostdev) < 0)
Daniel P. Berrange e3a592
         VIR_WARN0("Failed to restore host device labelling");
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     return ret;
Daniel P. Berrange e3a592
diff --git a/src/qemu/qemu_security_dac.c b/src/qemu/qemu_security_dac.c
Daniel P. Berrange e3a592
index 770010d..0bbcf69 100644
Daniel P. Berrange e3a592
--- a/src/qemu/qemu_security_dac.c
Daniel P. Berrange e3a592
+++ b/src/qemu/qemu_security_dac.c
Daniel P. Berrange e3a592
@@ -108,7 +108,8 @@ qemuSecurityDACSetSecurityFileLabel(virDomainDiskDefPtr disk ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-qemuSecurityDACSetSecurityImageLabel(virDomainObjPtr vm ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
+qemuSecurityDACSetSecurityImageLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
+                                     virDomainObjPtr vm ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
                                      virDomainDiskDefPtr disk)
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
@@ -124,7 +125,8 @@ qemuSecurityDACSetSecurityImageLabel(virDomainObjPtr vm ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-qemuSecurityDACRestoreSecurityImageLabelInt(virDomainObjPtr vm ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
+qemuSecurityDACRestoreSecurityImageLabelInt(virSecurityDriverPtr drv ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
+                                            virDomainObjPtr vm ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
                                             virDomainDiskDefPtr disk,
Daniel P. Berrange e3a592
                                             int migrated)
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
@@ -166,10 +168,11 @@ qemuSecurityDACRestoreSecurityImageLabelInt(virDomainObjPtr vm ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-qemuSecurityDACRestoreSecurityImageLabel(virDomainObjPtr vm,
Daniel P. Berrange e3a592
+qemuSecurityDACRestoreSecurityImageLabel(virSecurityDriverPtr drv,
Daniel P. Berrange e3a592
+                                         virDomainObjPtr vm,
Daniel P. Berrange e3a592
                                          virDomainDiskDefPtr disk)
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
-    return qemuSecurityDACRestoreSecurityImageLabelInt(vm, disk, 0);
Daniel P. Berrange e3a592
+    return qemuSecurityDACRestoreSecurityImageLabelInt(drv, vm, disk, 0);
Daniel P. Berrange e3a592
 }
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
@@ -192,7 +195,8 @@ qemuSecurityDACSetSecurityUSBLabel(usbDevice *dev ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-qemuSecurityDACSetSecurityHostdevLabel(virDomainObjPtr vm,
Daniel P. Berrange e3a592
+qemuSecurityDACSetSecurityHostdevLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
+                                       virDomainObjPtr vm,
Daniel P. Berrange e3a592
                                        virDomainHostdevDefPtr dev)
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
@@ -261,7 +265,8 @@ qemuSecurityDACRestoreSecurityUSBLabel(usbDevice *dev ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-qemuSecurityDACRestoreSecurityHostdevLabel(virDomainObjPtr vm ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
+qemuSecurityDACRestoreSecurityHostdevLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
+                                           virDomainObjPtr vm ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
                                            virDomainHostdevDefPtr dev)
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
@@ -407,7 +412,8 @@ qemuSecurityDACRestoreChardevCallback(virDomainDefPtr def ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-qemuSecurityDACRestoreSecurityAllLabel(virDomainObjPtr vm,
Daniel P. Berrange e3a592
+qemuSecurityDACRestoreSecurityAllLabel(virSecurityDriverPtr drv,
Daniel P. Berrange e3a592
+                                       virDomainObjPtr vm,
Daniel P. Berrange e3a592
                                        int migrated)
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
     int i;
Daniel P. Berrange e3a592
@@ -420,12 +426,14 @@ qemuSecurityDACRestoreSecurityAllLabel(virDomainObjPtr vm,
Daniel P. Berrange e3a592
               vm->def->name, migrated);
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     for (i = 0 ; i < vm->def->nhostdevs ; i++) {
Daniel P. Berrange e3a592
-        if (qemuSecurityDACRestoreSecurityHostdevLabel(vm,
Daniel P. Berrange e3a592
+        if (qemuSecurityDACRestoreSecurityHostdevLabel(drv,
Daniel P. Berrange e3a592
+                                                       vm,
Daniel P. Berrange e3a592
                                                        vm->def->hostdevs[i]) < 0)
Daniel P. Berrange e3a592
             rc = -1;
Daniel P. Berrange e3a592
     }
Daniel P. Berrange e3a592
     for (i = 0 ; i < vm->def->ndisks ; i++) {
Daniel P. Berrange e3a592
-        if (qemuSecurityDACRestoreSecurityImageLabelInt(vm,
Daniel P. Berrange e3a592
+        if (qemuSecurityDACRestoreSecurityImageLabelInt(drv,
Daniel P. Berrange e3a592
+                                                        vm,
Daniel P. Berrange e3a592
                                                         vm->def->disks[i],
Daniel P. Berrange e3a592
                                                         migrated) < 0)
Daniel P. Berrange e3a592
             rc = -1;
Daniel P. Berrange e3a592
@@ -461,7 +469,9 @@ qemuSecurityDACSetChardevCallback(virDomainDefPtr def ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-qemuSecurityDACSetSecurityAllLabel(virDomainObjPtr vm, const char *stdin_path ATTRIBUTE_UNUSED)
Daniel P. Berrange e3a592
+qemuSecurityDACSetSecurityAllLabel(virSecurityDriverPtr drv,
Daniel P. Berrange e3a592
+                                   virDomainObjPtr vm,
Daniel P. Berrange e3a592
+                                   const char *stdin_path ATTRIBUTE_UNUSED)
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
     int i;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
@@ -472,11 +482,15 @@ qemuSecurityDACSetSecurityAllLabel(virDomainObjPtr vm, const char *stdin_path AT
Daniel P. Berrange e3a592
         /* XXX fixme - we need to recursively label the entriy tree :-( */
Daniel P. Berrange e3a592
         if (vm->def->disks[i]->type == VIR_DOMAIN_DISK_TYPE_DIR)
Daniel P. Berrange e3a592
             continue;
Daniel P. Berrange e3a592
-        if (qemuSecurityDACSetSecurityImageLabel(vm, vm->def->disks[i]) < 0)
Daniel P. Berrange e3a592
+        if (qemuSecurityDACSetSecurityImageLabel(drv,
Daniel P. Berrange e3a592
+                                                 vm,
Daniel P. Berrange e3a592
+                                                 vm->def->disks[i]) < 0)
Daniel P. Berrange e3a592
             return -1;
Daniel P. Berrange e3a592
     }
Daniel P. Berrange e3a592
     for (i = 0 ; i < vm->def->nhostdevs ; i++) {
Daniel P. Berrange e3a592
-        if (qemuSecurityDACSetSecurityHostdevLabel(vm, vm->def->hostdevs[i]) < 0)
Daniel P. Berrange e3a592
+        if (qemuSecurityDACSetSecurityHostdevLabel(drv,
Daniel P. Berrange e3a592
+                                                   vm,
Daniel P. Berrange e3a592
+                                                   vm->def->hostdevs[i]) < 0)
Daniel P. Berrange e3a592
             return -1;
Daniel P. Berrange e3a592
     }
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
@@ -503,7 +517,8 @@ qemuSecurityDACSetSecurityAllLabel(virDomainObjPtr vm, const char *stdin_path AT
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-qemuSecurityDACSetSavedStateLabel(virDomainObjPtr vm ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
+qemuSecurityDACSetSavedStateLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
+                                  virDomainObjPtr vm ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
                                   const char *savefile)
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
     if (!driver->privileged)
Daniel P. Berrange e3a592
@@ -514,7 +529,8 @@ qemuSecurityDACSetSavedStateLabel(virDomainObjPtr vm ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-qemuSecurityDACRestoreSavedStateLabel(virDomainObjPtr vm ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
+qemuSecurityDACRestoreSavedStateLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
+                                      virDomainObjPtr vm ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
                                       const char *savefile)
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
     if (!driver->privileged)
Daniel P. Berrange e3a592
diff --git a/src/qemu/qemu_security_stacked.c b/src/qemu/qemu_security_stacked.c
Daniel P. Berrange e3a592
index df76135..432d095 100644
Daniel P. Berrange e3a592
--- a/src/qemu/qemu_security_stacked.c
Daniel P. Berrange e3a592
+++ b/src/qemu/qemu_security_stacked.c
Daniel P. Berrange e3a592
@@ -57,18 +57,21 @@ qemuSecurityStackedVerify(virDomainDefPtr def)
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-qemuSecurityStackedGenLabel(virDomainObjPtr vm)
Daniel P. Berrange e3a592
+qemuSecurityStackedGenLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
+                            virDomainObjPtr vm)
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
     int rc = 0;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     if (driver->securitySecondaryDriver &&
Daniel P. Berrange e3a592
         driver->securitySecondaryDriver->domainGenSecurityLabel &&
Daniel P. Berrange e3a592
-        driver->securitySecondaryDriver->domainGenSecurityLabel(vm) < 0)
Daniel P. Berrange e3a592
+        driver->securitySecondaryDriver->domainGenSecurityLabel(driver->securitySecondaryDriver,
Daniel P. Berrange e3a592
+                                                                vm) < 0)
Daniel P. Berrange e3a592
         rc = -1;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     if (driver->securityPrimaryDriver &&
Daniel P. Berrange e3a592
         driver->securityPrimaryDriver->domainGenSecurityLabel &&
Daniel P. Berrange e3a592
-        driver->securityPrimaryDriver->domainGenSecurityLabel(vm) < 0)
Daniel P. Berrange e3a592
+        driver->securityPrimaryDriver->domainGenSecurityLabel(driver->securityPrimaryDriver,
Daniel P. Berrange e3a592
+                                                              vm) < 0)
Daniel P. Berrange e3a592
         rc = -1;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     return rc;
Daniel P. Berrange e3a592
@@ -76,18 +79,21 @@ qemuSecurityStackedGenLabel(virDomainObjPtr vm)
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-qemuSecurityStackedReleaseLabel(virDomainObjPtr vm)
Daniel P. Berrange e3a592
+qemuSecurityStackedReleaseLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
+                                virDomainObjPtr vm)
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
     int rc = 0;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     if (driver->securitySecondaryDriver &&
Daniel P. Berrange e3a592
         driver->securitySecondaryDriver->domainReleaseSecurityLabel &&
Daniel P. Berrange e3a592
-        driver->securitySecondaryDriver->domainReleaseSecurityLabel(vm) < 0)
Daniel P. Berrange e3a592
+        driver->securitySecondaryDriver->domainReleaseSecurityLabel(driver->securitySecondaryDriver,
Daniel P. Berrange e3a592
+                                                                    vm) < 0)
Daniel P. Berrange e3a592
         rc = -1;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     if (driver->securityPrimaryDriver &&
Daniel P. Berrange e3a592
         driver->securityPrimaryDriver->domainReleaseSecurityLabel &&
Daniel P. Berrange e3a592
-        driver->securityPrimaryDriver->domainReleaseSecurityLabel(vm) < 0)
Daniel P. Berrange e3a592
+        driver->securityPrimaryDriver->domainReleaseSecurityLabel(driver->securityPrimaryDriver,
Daniel P. Berrange e3a592
+                                                                  vm) < 0)
Daniel P. Berrange e3a592
         rc = -1;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     return rc;
Daniel P. Berrange e3a592
@@ -95,18 +101,21 @@ qemuSecurityStackedReleaseLabel(virDomainObjPtr vm)
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-qemuSecurityStackedReserveLabel(virDomainObjPtr vm)
Daniel P. Berrange e3a592
+qemuSecurityStackedReserveLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
+                                virDomainObjPtr vm)
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
     int rc = 0;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     if (driver->securitySecondaryDriver &&
Daniel P. Berrange e3a592
         driver->securitySecondaryDriver->domainReserveSecurityLabel &&
Daniel P. Berrange e3a592
-        driver->securitySecondaryDriver->domainReserveSecurityLabel(vm) < 0)
Daniel P. Berrange e3a592
+        driver->securitySecondaryDriver->domainReserveSecurityLabel(driver->securitySecondaryDriver,
Daniel P. Berrange e3a592
+                                                                    vm) < 0)
Daniel P. Berrange e3a592
         rc = -1;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     if (driver->securityPrimaryDriver &&
Daniel P. Berrange e3a592
         driver->securityPrimaryDriver->domainReserveSecurityLabel &&
Daniel P. Berrange e3a592
-        driver->securityPrimaryDriver->domainReserveSecurityLabel(vm) < 0)
Daniel P. Berrange e3a592
+        driver->securityPrimaryDriver->domainReserveSecurityLabel(driver->securityPrimaryDriver,
Daniel P. Berrange e3a592
+                                                                  vm) < 0)
Daniel P. Berrange e3a592
         rc = -1;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     return rc;
Daniel P. Berrange e3a592
@@ -114,19 +123,22 @@ qemuSecurityStackedReserveLabel(virDomainObjPtr vm)
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-qemuSecurityStackedSetSecurityImageLabel(virDomainObjPtr vm,
Daniel P. Berrange e3a592
+qemuSecurityStackedSetSecurityImageLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
+                                         virDomainObjPtr vm,
Daniel P. Berrange e3a592
                                          virDomainDiskDefPtr disk)
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
     int rc = 0;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     if (driver->securitySecondaryDriver &&
Daniel P. Berrange e3a592
         driver->securitySecondaryDriver->domainSetSecurityImageLabel &&
Daniel P. Berrange e3a592
-        driver->securitySecondaryDriver->domainSetSecurityImageLabel(vm, disk) < 0)
Daniel P. Berrange e3a592
+        driver->securitySecondaryDriver->domainSetSecurityImageLabel(driver->securitySecondaryDriver,
Daniel P. Berrange e3a592
+                                                                     vm, disk) < 0)
Daniel P. Berrange e3a592
         rc = -1;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     if (driver->securityPrimaryDriver &&
Daniel P. Berrange e3a592
         driver->securityPrimaryDriver->domainSetSecurityImageLabel &&
Daniel P. Berrange e3a592
-        driver->securityPrimaryDriver->domainSetSecurityImageLabel(vm, disk) < 0)
Daniel P. Berrange e3a592
+        driver->securityPrimaryDriver->domainSetSecurityImageLabel(driver->securityPrimaryDriver,
Daniel P. Berrange e3a592
+                                                                   vm, disk) < 0)
Daniel P. Berrange e3a592
         rc = -1;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     return rc;
Daniel P. Berrange e3a592
@@ -134,19 +146,22 @@ qemuSecurityStackedSetSecurityImageLabel(virDomainObjPtr vm,
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-qemuSecurityStackedRestoreSecurityImageLabel(virDomainObjPtr vm,
Daniel P. Berrange e3a592
+qemuSecurityStackedRestoreSecurityImageLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
+                                             virDomainObjPtr vm,
Daniel P. Berrange e3a592
                                              virDomainDiskDefPtr disk)
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
     int rc = 0;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     if (driver->securitySecondaryDriver &&
Daniel P. Berrange e3a592
         driver->securitySecondaryDriver->domainRestoreSecurityImageLabel &&
Daniel P. Berrange e3a592
-        driver->securitySecondaryDriver->domainRestoreSecurityImageLabel(vm, disk) < 0)
Daniel P. Berrange e3a592
+        driver->securitySecondaryDriver->domainRestoreSecurityImageLabel(driver->securitySecondaryDriver,
Daniel P. Berrange e3a592
+                                                                         vm, disk) < 0)
Daniel P. Berrange e3a592
         rc = -1;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     if (driver->securityPrimaryDriver &&
Daniel P. Berrange e3a592
         driver->securityPrimaryDriver->domainRestoreSecurityImageLabel &&
Daniel P. Berrange e3a592
-        driver->securityPrimaryDriver->domainRestoreSecurityImageLabel(vm, disk) < 0)
Daniel P. Berrange e3a592
+        driver->securityPrimaryDriver->domainRestoreSecurityImageLabel(driver->securityPrimaryDriver,
Daniel P. Berrange e3a592
+                                                                       vm, disk) < 0)
Daniel P. Berrange e3a592
         rc = -1;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     return rc;
Daniel P. Berrange e3a592
@@ -154,7 +169,8 @@ qemuSecurityStackedRestoreSecurityImageLabel(virDomainObjPtr vm,
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-qemuSecurityStackedSetSecurityHostdevLabel(virDomainObjPtr vm,
Daniel P. Berrange e3a592
+qemuSecurityStackedSetSecurityHostdevLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
+                                           virDomainObjPtr vm,
Daniel P. Berrange e3a592
                                            virDomainHostdevDefPtr dev)
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
@@ -162,12 +178,14 @@ qemuSecurityStackedSetSecurityHostdevLabel(virDomainObjPtr vm,
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     if (driver->securitySecondaryDriver &&
Daniel P. Berrange e3a592
         driver->securitySecondaryDriver->domainSetSecurityHostdevLabel &&
Daniel P. Berrange e3a592
-        driver->securitySecondaryDriver->domainSetSecurityHostdevLabel(vm, dev) < 0)
Daniel P. Berrange e3a592
+        driver->securitySecondaryDriver->domainSetSecurityHostdevLabel(driver->securitySecondaryDriver,
Daniel P. Berrange e3a592
+                                                                       vm, dev) < 0)
Daniel P. Berrange e3a592
         rc = -1;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     if (driver->securityPrimaryDriver &&
Daniel P. Berrange e3a592
         driver->securityPrimaryDriver->domainSetSecurityHostdevLabel &&
Daniel P. Berrange e3a592
-        driver->securityPrimaryDriver->domainSetSecurityHostdevLabel(vm, dev) < 0)
Daniel P. Berrange e3a592
+        driver->securityPrimaryDriver->domainSetSecurityHostdevLabel(driver->securityPrimaryDriver,
Daniel P. Berrange e3a592
+                                                                     vm, dev) < 0)
Daniel P. Berrange e3a592
         rc = -1;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     return rc;
Daniel P. Berrange e3a592
@@ -175,20 +193,22 @@ qemuSecurityStackedSetSecurityHostdevLabel(virDomainObjPtr vm,
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-qemuSecurityStackedRestoreSecurityHostdevLabel(virDomainObjPtr vm,
Daniel P. Berrange e3a592
+qemuSecurityStackedRestoreSecurityHostdevLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
+                                               virDomainObjPtr vm,
Daniel P. Berrange e3a592
                                                virDomainHostdevDefPtr dev)
Daniel P. Berrange e3a592
-
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
     int rc = 0;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     if (driver->securitySecondaryDriver &&
Daniel P. Berrange e3a592
         driver->securitySecondaryDriver->domainRestoreSecurityHostdevLabel &&
Daniel P. Berrange e3a592
-        driver->securitySecondaryDriver->domainRestoreSecurityHostdevLabel(vm, dev) < 0)
Daniel P. Berrange e3a592
+        driver->securitySecondaryDriver->domainRestoreSecurityHostdevLabel(driver->securitySecondaryDriver,
Daniel P. Berrange e3a592
+                                                                           vm, dev) < 0)
Daniel P. Berrange e3a592
         rc = -1;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     if (driver->securityPrimaryDriver &&
Daniel P. Berrange e3a592
         driver->securityPrimaryDriver->domainRestoreSecurityHostdevLabel &&
Daniel P. Berrange e3a592
-        driver->securityPrimaryDriver->domainRestoreSecurityHostdevLabel(vm, dev) < 0)
Daniel P. Berrange e3a592
+        driver->securityPrimaryDriver->domainRestoreSecurityHostdevLabel(driver->securityPrimaryDriver,
Daniel P. Berrange e3a592
+                                                                         vm, dev) < 0)
Daniel P. Berrange e3a592
         rc = -1;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     return rc;
Daniel P. Berrange e3a592
@@ -196,18 +216,22 @@ qemuSecurityStackedRestoreSecurityHostdevLabel(virDomainObjPtr vm,
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-qemuSecurityStackedSetSecurityAllLabel(virDomainObjPtr vm, const char *stdin_path)
Daniel P. Berrange e3a592
+qemuSecurityStackedSetSecurityAllLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
+                                       virDomainObjPtr vm,
Daniel P. Berrange e3a592
+                                       const char *stdin_path)
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
     int rc = 0;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     if (driver->securitySecondaryDriver &&
Daniel P. Berrange e3a592
         driver->securitySecondaryDriver->domainSetSecurityAllLabel &&
Daniel P. Berrange e3a592
-        driver->securitySecondaryDriver->domainSetSecurityAllLabel(vm, stdin_path) < 0)
Daniel P. Berrange e3a592
+        driver->securitySecondaryDriver->domainSetSecurityAllLabel(driver->securitySecondaryDriver,
Daniel P. Berrange e3a592
+                                                                   vm, stdin_path) < 0)
Daniel P. Berrange e3a592
         rc = -1;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     if (driver->securityPrimaryDriver &&
Daniel P. Berrange e3a592
         driver->securityPrimaryDriver->domainSetSecurityAllLabel &&
Daniel P. Berrange e3a592
-        driver->securityPrimaryDriver->domainSetSecurityAllLabel(vm, stdin_path) < 0)
Daniel P. Berrange e3a592
+        driver->securityPrimaryDriver->domainSetSecurityAllLabel(driver->securityPrimaryDriver,
Daniel P. Berrange e3a592
+                                                                 vm, stdin_path) < 0)
Daniel P. Berrange e3a592
         rc = -1;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     return rc;
Daniel P. Berrange e3a592
@@ -215,19 +239,22 @@ qemuSecurityStackedSetSecurityAllLabel(virDomainObjPtr vm, const char *stdin_pat
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-qemuSecurityStackedRestoreSecurityAllLabel(virDomainObjPtr vm,
Daniel P. Berrange e3a592
+qemuSecurityStackedRestoreSecurityAllLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
+                                           virDomainObjPtr vm,
Daniel P. Berrange e3a592
                                            int migrated)
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
     int rc = 0;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     if (driver->securitySecondaryDriver &&
Daniel P. Berrange e3a592
         driver->securitySecondaryDriver->domainRestoreSecurityAllLabel &&
Daniel P. Berrange e3a592
-        driver->securitySecondaryDriver->domainRestoreSecurityAllLabel(vm, migrated) < 0)
Daniel P. Berrange e3a592
+        driver->securitySecondaryDriver->domainRestoreSecurityAllLabel(driver->securitySecondaryDriver,
Daniel P. Berrange e3a592
+                                                                       vm, migrated) < 0)
Daniel P. Berrange e3a592
         rc = -1;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     if (driver->securityPrimaryDriver &&
Daniel P. Berrange e3a592
         driver->securityPrimaryDriver->domainRestoreSecurityAllLabel &&
Daniel P. Berrange e3a592
-        driver->securityPrimaryDriver->domainRestoreSecurityAllLabel(vm, migrated) < 0)
Daniel P. Berrange e3a592
+        driver->securityPrimaryDriver->domainRestoreSecurityAllLabel(driver->securityPrimaryDriver,
Daniel P. Berrange e3a592
+                                                                     vm, migrated) < 0)
Daniel P. Berrange e3a592
         rc = -1;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     return rc;
Daniel P. Berrange e3a592
@@ -235,19 +262,22 @@ qemuSecurityStackedRestoreSecurityAllLabel(virDomainObjPtr vm,
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-qemuSecurityStackedSetSavedStateLabel(virDomainObjPtr vm,
Daniel P. Berrange e3a592
+qemuSecurityStackedSetSavedStateLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
+                                      virDomainObjPtr vm,
Daniel P. Berrange e3a592
                                       const char *savefile)
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
     int rc = 0;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     if (driver->securitySecondaryDriver &&
Daniel P. Berrange e3a592
         driver->securitySecondaryDriver->domainSetSavedStateLabel &&
Daniel P. Berrange e3a592
-        driver->securitySecondaryDriver->domainSetSavedStateLabel(vm, savefile) < 0)
Daniel P. Berrange e3a592
+        driver->securitySecondaryDriver->domainSetSavedStateLabel(driver->securitySecondaryDriver,
Daniel P. Berrange e3a592
+                                                                  vm, savefile) < 0)
Daniel P. Berrange e3a592
         rc = -1;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     if (driver->securityPrimaryDriver &&
Daniel P. Berrange e3a592
         driver->securityPrimaryDriver->domainSetSavedStateLabel &&
Daniel P. Berrange e3a592
-        driver->securityPrimaryDriver->domainSetSavedStateLabel(vm, savefile) < 0)
Daniel P. Berrange e3a592
+        driver->securityPrimaryDriver->domainSetSavedStateLabel(driver->securityPrimaryDriver,
Daniel P. Berrange e3a592
+                                                                vm, savefile) < 0)
Daniel P. Berrange e3a592
         rc = -1;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     return rc;
Daniel P. Berrange e3a592
@@ -255,19 +285,22 @@ qemuSecurityStackedSetSavedStateLabel(virDomainObjPtr vm,
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-qemuSecurityStackedRestoreSavedStateLabel(virDomainObjPtr vm,
Daniel P. Berrange e3a592
+qemuSecurityStackedRestoreSavedStateLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
+                                          virDomainObjPtr vm,
Daniel P. Berrange e3a592
                                           const char *savefile)
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
     int rc = 0;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     if (driver->securitySecondaryDriver &&
Daniel P. Berrange e3a592
         driver->securitySecondaryDriver->domainRestoreSavedStateLabel &&
Daniel P. Berrange e3a592
-        driver->securitySecondaryDriver->domainRestoreSavedStateLabel(vm, savefile) < 0)
Daniel P. Berrange e3a592
+        driver->securitySecondaryDriver->domainRestoreSavedStateLabel(driver->securitySecondaryDriver,
Daniel P. Berrange e3a592
+                                                                      vm, savefile) < 0)
Daniel P. Berrange e3a592
         rc = -1;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     if (driver->securityPrimaryDriver &&
Daniel P. Berrange e3a592
         driver->securityPrimaryDriver->domainRestoreSavedStateLabel &&
Daniel P. Berrange e3a592
-        driver->securityPrimaryDriver->domainRestoreSavedStateLabel(vm, savefile) < 0)
Daniel P. Berrange e3a592
+        driver->securityPrimaryDriver->domainRestoreSavedStateLabel(driver->securityPrimaryDriver,
Daniel P. Berrange e3a592
+                                                                    vm, savefile) < 0)
Daniel P. Berrange e3a592
         rc = -1;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     return rc;
Daniel P. Berrange e3a592
@@ -296,14 +329,16 @@ qemuSecurityStackedSetProcessLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
 }
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-qemuSecurityStackedGetProcessLabel(virDomainObjPtr vm,
Daniel P. Berrange e3a592
+qemuSecurityStackedGetProcessLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
+                                   virDomainObjPtr vm,
Daniel P. Berrange e3a592
                                    virSecurityLabelPtr seclabel)
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
     int rc = 0;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     if (driver->securityPrimaryDriver &&
Daniel P. Berrange e3a592
         driver->securityPrimaryDriver->domainGetSecurityProcessLabel &&
Daniel P. Berrange e3a592
-        driver->securityPrimaryDriver->domainGetSecurityProcessLabel(vm,
Daniel P. Berrange e3a592
+        driver->securityPrimaryDriver->domainGetSecurityProcessLabel(driver->securityPrimaryDriver,
Daniel P. Berrange e3a592
+                                                                     vm,
Daniel P. Berrange e3a592
                                                                      seclabel) < 0)
Daniel P. Berrange e3a592
         rc = -1;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
diff --git a/src/security/security_apparmor.c b/src/security/security_apparmor.c
Daniel P. Berrange e3a592
index e883f69..cb5c739 100644
Daniel P. Berrange e3a592
--- a/src/security/security_apparmor.c
Daniel P. Berrange e3a592
+++ b/src/security/security_apparmor.c
Daniel P. Berrange e3a592
@@ -148,7 +148,8 @@ profile_status_file(const char *str)
Daniel P. Berrange e3a592
  * load (add) a profile. Will create one if necessary
Daniel P. Berrange e3a592
  */
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-load_profile(const char *profile, virDomainObjPtr vm,
Daniel P. Berrange e3a592
+load_profile(virSecurityDriverPtr drv,
Daniel P. Berrange e3a592
+             const char *profile, virDomainObjPtr vm,
Daniel P. Berrange e3a592
              const char *fn)
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
     int rc = -1, status, ret;
Daniel P. Berrange e3a592
@@ -281,7 +282,8 @@ cleanup:
Daniel P. Berrange e3a592
  * NULL.
Daniel P. Berrange e3a592
  */
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-reload_profile(virDomainObjPtr vm, const char *fn)
Daniel P. Berrange e3a592
+reload_profile(virSecurityDriverPtr drv,
Daniel P. Berrange e3a592
+               virDomainObjPtr vm, const char *fn)
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
     const virSecurityLabelDefPtr secdef = &vm->def->seclabel;
Daniel P. Berrange e3a592
     int rc = -1;
Daniel P. Berrange e3a592
@@ -295,7 +297,7 @@ reload_profile(virDomainObjPtr vm, const char *fn)
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     /* Update the profile only if it is loaded */
Daniel P. Berrange e3a592
     if (profile_loaded(secdef->imagelabel) >= 0) {
Daniel P. Berrange e3a592
-        if (load_profile(secdef->imagelabel, vm, fn) < 0) {
Daniel P. Berrange e3a592
+        if (load_profile(drv, secdef->imagelabel, vm, fn) < 0) {
Daniel P. Berrange e3a592
             virSecurityReportError(VIR_ERR_INTERNAL_ERROR,
Daniel P. Berrange e3a592
                                    _("cannot update AppArmor profile "
Daniel P. Berrange e3a592
                                      "\'%s\'"),
Daniel P. Berrange e3a592
@@ -357,7 +359,8 @@ AppArmorSecurityDriverOpen(virSecurityDriverPtr drv)
Daniel P. Berrange e3a592
  * called on shutdown.
Daniel P. Berrange e3a592
 */
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-AppArmorGenSecurityLabel(virDomainObjPtr vm)
Daniel P. Berrange e3a592
+AppArmorGenSecurityLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
+                         virDomainObjPtr vm)
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
     int rc = -1;
Daniel P. Berrange e3a592
     char *profile_name = NULL;
Daniel P. Berrange e3a592
@@ -411,14 +414,15 @@ AppArmorGenSecurityLabel(virDomainObjPtr vm)
Daniel P. Berrange e3a592
 }
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-AppArmorSetSecurityAllLabel(virDomainObjPtr vm, const char *stdin_path)
Daniel P. Berrange e3a592
+AppArmorSetSecurityAllLabel(virSecurityDriverPtr drv,
Daniel P. Berrange e3a592
+                            virDomainObjPtr vm, const char *stdin_path)
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
     if (vm->def->seclabel.type == VIR_DOMAIN_SECLABEL_STATIC)
Daniel P. Berrange e3a592
         return 0;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     /* if the profile is not already loaded, then load one */
Daniel P. Berrange e3a592
     if (profile_loaded(vm->def->seclabel.label) < 0) {
Daniel P. Berrange e3a592
-        if (load_profile(vm->def->seclabel.label, vm, stdin_path) < 0) {
Daniel P. Berrange e3a592
+        if (load_profile(drv, vm->def->seclabel.label, vm, stdin_path) < 0) {
Daniel P. Berrange e3a592
             virSecurityReportError(VIR_ERR_INTERNAL_ERROR,
Daniel P. Berrange e3a592
                                    _("cannot generate AppArmor profile "
Daniel P. Berrange e3a592
                                    "\'%s\'"), vm->def->seclabel.label);
Daniel P. Berrange e3a592
@@ -433,7 +437,9 @@ AppArmorSetSecurityAllLabel(virDomainObjPtr vm, const char *stdin_path)
Daniel P. Berrange e3a592
  * running.
Daniel P. Berrange e3a592
  */
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-AppArmorGetSecurityProcessLabel(virDomainObjPtr vm, virSecurityLabelPtr sec)
Daniel P. Berrange e3a592
+AppArmorGetSecurityProcessLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
+                                virDomainObjPtr vm,
Daniel P. Berrange e3a592
+                                virSecurityLabelPtr sec)
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
     int rc = -1;
Daniel P. Berrange e3a592
     char *profile_name = NULL;
Daniel P. Berrange e3a592
@@ -465,7 +471,8 @@ AppArmorGetSecurityProcessLabel(virDomainObjPtr vm, virSecurityLabelPtr sec)
Daniel P. Berrange e3a592
  * more details. Currently called via qemudShutdownVMDaemon.
Daniel P. Berrange e3a592
  */
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-AppArmorReleaseSecurityLabel(virDomainObjPtr vm)
Daniel P. Berrange e3a592
+AppArmorReleaseSecurityLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
+                             virDomainObjPtr vm)
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
     const virSecurityLabelDefPtr secdef = &vm->def->seclabel;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
@@ -478,7 +485,8 @@ AppArmorReleaseSecurityLabel(virDomainObjPtr vm)
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-AppArmorRestoreSecurityAllLabel(virDomainObjPtr vm,
Daniel P. Berrange e3a592
+AppArmorRestoreSecurityAllLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
+                                virDomainObjPtr vm,
Daniel P. Berrange e3a592
                                 int migrated ATTRIBUTE_UNUSED)
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
     const virSecurityLabelDefPtr secdef = &vm->def->seclabel;
Daniel P. Berrange e3a592
@@ -533,15 +541,17 @@ AppArmorSetSecurityProcessLabel(virSecurityDriverPtr drv, virDomainObjPtr vm)
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 /* Called when hotplugging */
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-AppArmorRestoreSecurityImageLabel(virDomainObjPtr vm,
Daniel P. Berrange e3a592
+AppArmorRestoreSecurityImageLabel(virSecurityDriverPtr drv,
Daniel P. Berrange e3a592
+                                  virDomainObjPtr vm,
Daniel P. Berrange e3a592
                                   virDomainDiskDefPtr disk ATTRIBUTE_UNUSED)
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
-    return reload_profile(vm, NULL);
Daniel P. Berrange e3a592
+    return reload_profile(drv, vm, NULL);
Daniel P. Berrange e3a592
 }
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 /* Called when hotplugging */
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-AppArmorSetSecurityImageLabel(virDomainObjPtr vm, virDomainDiskDefPtr disk)
Daniel P. Berrange e3a592
+AppArmorSetSecurityImageLabel(virSecurityDriverPtr drv,
Daniel P. Berrange e3a592
+                              virDomainObjPtr vm, virDomainDiskDefPtr disk)
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
     const virSecurityLabelDefPtr secdef = &vm->def->seclabel;
Daniel P. Berrange e3a592
     int rc = -1;
Daniel P. Berrange e3a592
@@ -566,7 +576,7 @@ AppArmorSetSecurityImageLabel(virDomainObjPtr vm, virDomainDiskDefPtr disk)
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
         /* update the profile only if it is loaded */
Daniel P. Berrange e3a592
         if (profile_loaded(secdef->imagelabel) >= 0) {
Daniel P. Berrange e3a592
-            if (load_profile(secdef->imagelabel, vm, disk->src) < 0) {
Daniel P. Berrange e3a592
+            if (load_profile(drv, secdef->imagelabel, vm, disk->src) < 0) {
Daniel P. Berrange e3a592
                 virSecurityReportError(VIR_ERR_INTERNAL_ERROR,
Daniel P. Berrange e3a592
                                      _("cannot update AppArmor profile "
Daniel P. Berrange e3a592
                                      "\'%s\'"),
Daniel P. Berrange e3a592
@@ -600,14 +610,16 @@ AppArmorSecurityVerify(virDomainDefPtr def)
Daniel P. Berrange e3a592
 }
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-AppArmorReserveSecurityLabel(virDomainObjPtr vm ATTRIBUTE_UNUSED)
Daniel P. Berrange e3a592
+AppArmorReserveSecurityLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
+                             virDomainObjPtr vm ATTRIBUTE_UNUSED)
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
     /* NOOP. Nothing to reserve with AppArmor */
Daniel P. Berrange e3a592
     return 0;
Daniel P. Berrange e3a592
 }
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-AppArmorSetSecurityHostdevLabel(virDomainObjPtr vm,
Daniel P. Berrange e3a592
+AppArmorSetSecurityHostdevLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
+                                virDomainObjPtr vm,
Daniel P. Berrange e3a592
                                 virDomainHostdevDefPtr dev ATTRIBUTE_UNUSED)
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
@@ -621,7 +633,8 @@ AppArmorSetSecurityHostdevLabel(virDomainObjPtr vm,
Daniel P. Berrange e3a592
 }
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-AppArmorRestoreSecurityHostdevLabel(virDomainObjPtr vm,
Daniel P. Berrange e3a592
+AppArmorRestoreSecurityHostdevLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
+                                    virDomainObjPtr vm,
Daniel P. Berrange e3a592
                                     virDomainHostdevDefPtr dev ATTRIBUTE_UNUSED)
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
@@ -634,18 +647,20 @@ AppArmorRestoreSecurityHostdevLabel(virDomainObjPtr vm,
Daniel P. Berrange e3a592
 }
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-AppArmorSetSavedStateLabel(virDomainObjPtr vm,
Daniel P. Berrange e3a592
-                          const char *savefile)
Daniel P. Berrange e3a592
+AppArmorSetSavedStateLabel(virSecurityDriverPtr drv,
Daniel P. Berrange e3a592
+                           virDomainObjPtr vm,
Daniel P. Berrange e3a592
+                           const char *savefile)
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
-    return reload_profile(vm, savefile);
Daniel P. Berrange e3a592
+    return reload_profile(drv, vm, savefile);
Daniel P. Berrange e3a592
 }
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-AppArmorRestoreSavedStateLabel(virDomainObjPtr vm,
Daniel P. Berrange e3a592
+AppArmorRestoreSavedStateLabel(virSecurityDriverPtr drv,
Daniel P. Berrange e3a592
+                               virDomainObjPtr vm,
Daniel P. Berrange e3a592
                                const char *savefile ATTRIBUTE_UNUSED)
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
-    return reload_profile(vm, NULL);
Daniel P. Berrange e3a592
+    return reload_profile(drv, vm, NULL);
Daniel P. Berrange e3a592
 }
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 virSecurityDriver virAppArmorSecurityDriver = {
Daniel P. Berrange e3a592
diff --git a/src/security/security_driver.h b/src/security/security_driver.h
Daniel P. Berrange e3a592
index 99260a4..61c9eb0 100644
Daniel P. Berrange e3a592
--- a/src/security/security_driver.h
Daniel P. Berrange e3a592
+++ b/src/security/security_driver.h
Daniel P. Berrange e3a592
@@ -28,32 +28,48 @@ typedef enum {
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 typedef struct _virSecurityDriver virSecurityDriver;
Daniel P. Berrange e3a592
 typedef virSecurityDriver *virSecurityDriverPtr;
Daniel P. Berrange e3a592
+
Daniel P. Berrange e3a592
+typedef struct _virSecurityDriverState virSecurityDriverState;
Daniel P. Berrange e3a592
+typedef virSecurityDriverState *virSecurityDriverStatePtr;
Daniel P. Berrange e3a592
+
Daniel P. Berrange e3a592
 typedef virSecurityDriverStatus (*virSecurityDriverProbe) (void);
Daniel P. Berrange e3a592
 typedef int (*virSecurityDriverOpen) (virSecurityDriverPtr drv);
Daniel P. Berrange e3a592
-typedef int (*virSecurityDomainRestoreImageLabel) (virDomainObjPtr vm,
Daniel P. Berrange e3a592
+typedef int (*virSecurityDomainRestoreImageLabel) (virSecurityDriverPtr drv,
Daniel P. Berrange e3a592
+                                                   virDomainObjPtr vm,
Daniel P. Berrange e3a592
                                                    virDomainDiskDefPtr disk);
Daniel P. Berrange e3a592
 typedef int (*virSecurityDomainSetSocketLabel) (virSecurityDriverPtr drv,
Daniel P. Berrange e3a592
                                                 virDomainObjPtr vm);
Daniel P. Berrange e3a592
 typedef int (*virSecurityDomainClearSocketLabel)(virSecurityDriverPtr drv,
Daniel P. Berrange e3a592
                                                 virDomainObjPtr vm);
Daniel P. Berrange e3a592
-typedef int (*virSecurityDomainSetImageLabel) (virDomainObjPtr vm,
Daniel P. Berrange e3a592
+typedef int (*virSecurityDomainSetImageLabel) (virSecurityDriverPtr drv,
Daniel P. Berrange e3a592
+                                               virDomainObjPtr vm,
Daniel P. Berrange e3a592
                                                virDomainDiskDefPtr disk);
Daniel P. Berrange e3a592
-typedef int (*virSecurityDomainRestoreHostdevLabel) (virDomainObjPtr vm,
Daniel P. Berrange e3a592
+typedef int (*virSecurityDomainRestoreHostdevLabel) (virSecurityDriverPtr drv,
Daniel P. Berrange e3a592
+                                                     virDomainObjPtr vm,
Daniel P. Berrange e3a592
                                                      virDomainHostdevDefPtr dev);
Daniel P. Berrange e3a592
-typedef int (*virSecurityDomainSetHostdevLabel) (virDomainObjPtr vm,
Daniel P. Berrange e3a592
+typedef int (*virSecurityDomainSetHostdevLabel) (virSecurityDriverPtr drv,
Daniel P. Berrange e3a592
+                                                 virDomainObjPtr vm,
Daniel P. Berrange e3a592
                                                  virDomainHostdevDefPtr dev);
Daniel P. Berrange e3a592
-typedef int (*virSecurityDomainSetSavedStateLabel) (virDomainObjPtr vm,
Daniel P. Berrange e3a592
+typedef int (*virSecurityDomainSetSavedStateLabel) (virSecurityDriverPtr drv,
Daniel P. Berrange e3a592
+                                                    virDomainObjPtr vm,
Daniel P. Berrange e3a592
                                                     const char *savefile);
Daniel P. Berrange e3a592
-typedef int (*virSecurityDomainRestoreSavedStateLabel) (virDomainObjPtr vm,
Daniel P. Berrange e3a592
+typedef int (*virSecurityDomainRestoreSavedStateLabel) (virSecurityDriverPtr drv,
Daniel P. Berrange e3a592
+                                                        virDomainObjPtr vm,
Daniel P. Berrange e3a592
                                                         const char *savefile);
Daniel P. Berrange e3a592
-typedef int (*virSecurityDomainGenLabel) (virDomainObjPtr sec);
Daniel P. Berrange e3a592
-typedef int (*virSecurityDomainReserveLabel) (virDomainObjPtr sec);
Daniel P. Berrange e3a592
-typedef int (*virSecurityDomainReleaseLabel) (virDomainObjPtr sec);
Daniel P. Berrange e3a592
-typedef int (*virSecurityDomainSetAllLabel) (virDomainObjPtr sec,
Daniel P. Berrange e3a592
+typedef int (*virSecurityDomainGenLabel) (virSecurityDriverPtr drv,
Daniel P. Berrange e3a592
+                                          virDomainObjPtr sec);
Daniel P. Berrange e3a592
+typedef int (*virSecurityDomainReserveLabel) (virSecurityDriverPtr drv,
Daniel P. Berrange e3a592
+                                              virDomainObjPtr sec);
Daniel P. Berrange e3a592
+typedef int (*virSecurityDomainReleaseLabel) (virSecurityDriverPtr drv,
Daniel P. Berrange e3a592
+                                              virDomainObjPtr sec);
Daniel P. Berrange e3a592
+typedef int (*virSecurityDomainSetAllLabel) (virSecurityDriverPtr drv,
Daniel P. Berrange e3a592
+                                             virDomainObjPtr sec,
Daniel P. Berrange e3a592
                                              const char *stdin_path);
Daniel P. Berrange e3a592
-typedef int (*virSecurityDomainRestoreAllLabel) (virDomainObjPtr vm,
Daniel P. Berrange e3a592
+typedef int (*virSecurityDomainRestoreAllLabel) (virSecurityDriverPtr drv,
Daniel P. Berrange e3a592
+                                                 virDomainObjPtr vm,
Daniel P. Berrange e3a592
                                                  int migrated);
Daniel P. Berrange e3a592
-typedef int (*virSecurityDomainGetProcessLabel) (virDomainObjPtr vm,
Daniel P. Berrange e3a592
+typedef int (*virSecurityDomainGetProcessLabel) (virSecurityDriverPtr drv,
Daniel P. Berrange e3a592
+                                                 virDomainObjPtr vm,
Daniel P. Berrange e3a592
                                                  virSecurityLabelPtr sec);
Daniel P. Berrange e3a592
 typedef int (*virSecurityDomainSetProcessLabel) (virSecurityDriverPtr drv,
Daniel P. Berrange e3a592
                                                  virDomainObjPtr vm);
Daniel P. Berrange e3a592
diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
Daniel P. Berrange e3a592
index d191118..cc3812b 100644
Daniel P. Berrange e3a592
--- a/src/security/security_selinux.c
Daniel P. Berrange e3a592
+++ b/src/security/security_selinux.c
Daniel P. Berrange e3a592
@@ -156,7 +156,8 @@ SELinuxInitialize(void)
Daniel P. Berrange e3a592
 }
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-SELinuxGenSecurityLabel(virDomainObjPtr vm)
Daniel P. Berrange e3a592
+SELinuxGenSecurityLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
+                        virDomainObjPtr vm)
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
     int rc = -1;
Daniel P. Berrange e3a592
     char mcs[1024];
Daniel P. Berrange e3a592
@@ -220,7 +221,8 @@ done:
Daniel P. Berrange e3a592
 }
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-SELinuxReserveSecurityLabel(virDomainObjPtr vm)
Daniel P. Berrange e3a592
+SELinuxReserveSecurityLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
+                            virDomainObjPtr vm)
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
     security_context_t pctx;
Daniel P. Berrange e3a592
     context_t ctx = NULL;
Daniel P. Berrange e3a592
@@ -275,7 +277,8 @@ SELinuxSecurityDriverOpen(virSecurityDriverPtr drv)
Daniel P. Berrange e3a592
 }
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-SELinuxGetSecurityProcessLabel(virDomainObjPtr vm,
Daniel P. Berrange e3a592
+SELinuxGetSecurityProcessLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
+                               virDomainObjPtr vm,
Daniel P. Berrange e3a592
                                virSecurityLabelPtr sec)
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
     security_context_t ctx;
Daniel P. Berrange e3a592
@@ -387,7 +390,8 @@ err:
Daniel P. Berrange e3a592
 }
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-SELinuxRestoreSecurityImageLabelInt(virDomainObjPtr vm,
Daniel P. Berrange e3a592
+SELinuxRestoreSecurityImageLabelInt(virSecurityDriverPtr drv ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
+                                    virDomainObjPtr vm,
Daniel P. Berrange e3a592
                                     virDomainDiskDefPtr disk,
Daniel P. Berrange e3a592
                                     int migrated)
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
@@ -431,10 +435,11 @@ SELinuxRestoreSecurityImageLabelInt(virDomainObjPtr vm,
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-SELinuxRestoreSecurityImageLabel(virDomainObjPtr vm,
Daniel P. Berrange e3a592
+SELinuxRestoreSecurityImageLabel(virSecurityDriverPtr drv,
Daniel P. Berrange e3a592
+                                 virDomainObjPtr vm,
Daniel P. Berrange e3a592
                                  virDomainDiskDefPtr disk)
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
-    return SELinuxRestoreSecurityImageLabelInt(vm, disk, 0);
Daniel P. Berrange e3a592
+    return SELinuxRestoreSecurityImageLabelInt(drv, vm, disk, 0);
Daniel P. Berrange e3a592
 }
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
@@ -462,7 +467,8 @@ SELinuxSetSecurityFileLabel(virDomainDiskDefPtr disk,
Daniel P. Berrange e3a592
 }
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-SELinuxSetSecurityImageLabel(virDomainObjPtr vm,
Daniel P. Berrange e3a592
+SELinuxSetSecurityImageLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
+                             virDomainObjPtr vm,
Daniel P. Berrange e3a592
                              virDomainDiskDefPtr disk)
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
@@ -500,7 +506,8 @@ SELinuxSetSecurityUSBLabel(usbDevice *dev ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
 }
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-SELinuxSetSecurityHostdevLabel(virDomainObjPtr vm,
Daniel P. Berrange e3a592
+SELinuxSetSecurityHostdevLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
+                               virDomainObjPtr vm,
Daniel P. Berrange e3a592
                                virDomainHostdevDefPtr dev)
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
@@ -568,7 +575,8 @@ SELinuxRestoreSecurityUSBLabel(usbDevice *dev ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
 }
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-SELinuxRestoreSecurityHostdevLabel(virDomainObjPtr vm,
Daniel P. Berrange e3a592
+SELinuxRestoreSecurityHostdevLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
+                                   virDomainObjPtr vm,
Daniel P. Berrange e3a592
                                    virDomainHostdevDefPtr dev)
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
@@ -715,7 +723,8 @@ SELinuxRestoreSecurityChardevCallback(virDomainDefPtr def ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-SELinuxRestoreSecurityAllLabel(virDomainObjPtr vm,
Daniel P. Berrange e3a592
+SELinuxRestoreSecurityAllLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
+                               virDomainObjPtr vm,
Daniel P. Berrange e3a592
                                int migrated ATTRIBUTE_UNUSED)
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
     const virSecurityLabelDefPtr secdef = &vm->def->seclabel;
Daniel P. Berrange e3a592
@@ -728,11 +737,14 @@ SELinuxRestoreSecurityAllLabel(virDomainObjPtr vm,
Daniel P. Berrange e3a592
         return 0;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
     for (i = 0 ; i < vm->def->nhostdevs ; i++) {
Daniel P. Berrange e3a592
-        if (SELinuxRestoreSecurityHostdevLabel(vm, vm->def->hostdevs[i]) < 0)
Daniel P. Berrange e3a592
+        if (SELinuxRestoreSecurityHostdevLabel(drv,
Daniel P. Berrange e3a592
+                                               vm,
Daniel P. Berrange e3a592
+                                               vm->def->hostdevs[i]) < 0)
Daniel P. Berrange e3a592
             rc = -1;
Daniel P. Berrange e3a592
     }
Daniel P. Berrange e3a592
     for (i = 0 ; i < vm->def->ndisks ; i++) {
Daniel P. Berrange e3a592
-        if (SELinuxRestoreSecurityImageLabelInt(vm,
Daniel P. Berrange e3a592
+        if (SELinuxRestoreSecurityImageLabelInt(drv,
Daniel P. Berrange e3a592
+                                                vm,
Daniel P. Berrange e3a592
                                                 vm->def->disks[i],
Daniel P. Berrange e3a592
                                                 migrated) < 0)
Daniel P. Berrange e3a592
             rc = -1;
Daniel P. Berrange e3a592
@@ -756,7 +768,8 @@ SELinuxRestoreSecurityAllLabel(virDomainObjPtr vm,
Daniel P. Berrange e3a592
 }
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-SELinuxReleaseSecurityLabel(virDomainObjPtr vm)
Daniel P. Berrange e3a592
+SELinuxReleaseSecurityLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
+                            virDomainObjPtr vm)
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
     const virSecurityLabelDefPtr secdef = &vm->def->seclabel;
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
@@ -779,7 +792,8 @@ SELinuxReleaseSecurityLabel(virDomainObjPtr vm)
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-SELinuxSetSavedStateLabel(virDomainObjPtr vm,
Daniel P. Berrange e3a592
+SELinuxSetSavedStateLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
+                          virDomainObjPtr vm,
Daniel P. Berrange e3a592
                           const char *savefile)
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
     const virSecurityLabelDefPtr secdef = &vm->def->seclabel;
Daniel P. Berrange e3a592
@@ -792,7 +806,8 @@ SELinuxSetSavedStateLabel(virDomainObjPtr vm,
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-SELinuxRestoreSavedStateLabel(virDomainObjPtr vm,
Daniel P. Berrange e3a592
+SELinuxRestoreSavedStateLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
+                              virDomainObjPtr vm,
Daniel P. Berrange e3a592
                               const char *savefile)
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
     const virSecurityLabelDefPtr secdef = &vm->def->seclabel;
Daniel P. Berrange e3a592
@@ -963,7 +978,9 @@ SELinuxSetSecurityChardevCallback(virDomainDefPtr def ATTRIBUTE_UNUSED,
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
 static int
Daniel P. Berrange e3a592
-SELinuxSetSecurityAllLabel(virDomainObjPtr vm, const char *stdin_path)
Daniel P. Berrange e3a592
+SELinuxSetSecurityAllLabel(virSecurityDriverPtr drv,
Daniel P. Berrange e3a592
+                           virDomainObjPtr vm,
Daniel P. Berrange e3a592
+                           const char *stdin_path)
Daniel P. Berrange e3a592
 {
Daniel P. Berrange e3a592
     const virSecurityLabelDefPtr secdef = &vm->def->seclabel;
Daniel P. Berrange e3a592
     int i;
Daniel P. Berrange e3a592
@@ -978,11 +995,14 @@ SELinuxSetSecurityAllLabel(virDomainObjPtr vm, const char *stdin_path)
Daniel P. Berrange e3a592
                      vm->def->disks[i]->src, vm->def->disks[i]->dst);
Daniel P. Berrange e3a592
             continue;
Daniel P. Berrange e3a592
         }
Daniel P. Berrange e3a592
-        if (SELinuxSetSecurityImageLabel(vm, vm->def->disks[i]) < 0)
Daniel P. Berrange e3a592
+        if (SELinuxSetSecurityImageLabel(drv,
Daniel P. Berrange e3a592
+                                         vm, vm->def->disks[i]) < 0)
Daniel P. Berrange e3a592
             return -1;
Daniel P. Berrange e3a592
     }
Daniel P. Berrange e3a592
     for (i = 0 ; i < vm->def->nhostdevs ; i++) {
Daniel P. Berrange e3a592
-        if (SELinuxSetSecurityHostdevLabel(vm, vm->def->hostdevs[i]) < 0)
Daniel P. Berrange e3a592
+        if (SELinuxSetSecurityHostdevLabel(drv,
Daniel P. Berrange e3a592
+                                           vm,
Daniel P. Berrange e3a592
+                                           vm->def->hostdevs[i]) < 0)
Daniel P. Berrange e3a592
             return -1;
Daniel P. Berrange e3a592
     }
Daniel P. Berrange e3a592
 
Daniel P. Berrange e3a592
-- 
Daniel P. Berrange e3a592
1.7.1.1
Daniel P. Berrange e3a592