[PATCH v2 17/19] qemu: Filter uninteresting paths for virUdevMgr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In case of udev, it will never try to reset security label on say
domain monitor socket, or some other channel. Therefore, it makes
sense to filter those paths out and keep the state file on the
disk small. The only paths that udev will handle are those
prefixed with "/dev/".

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/qemu/qemu_driver.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 7848a4e..7773d73 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -370,6 +370,15 @@ qemuSecurityChownCallback(virStorageSourcePtr src,
 
 
 static int
+qemuUdevFilter(const char *devpath,
+               const virSecurityDeviceLabelDef *seclabel ATTRIBUTE_UNUSED,
+               void *opaque ATTRIBUTE_UNUSED)
+{
+    return STRPREFIX(devpath, "/dev/") ? 1 : 0;
+}
+
+
+static int
 qemuSecurityInit(virQEMUDriverPtr driver)
 {
     char **names;
@@ -390,6 +399,8 @@ qemuSecurityInit(virQEMUDriverPtr driver)
             if (!(driver->udevMgr = virUdevMgrNew()))
                 goto error;
         }
+
+        virUdevMgrSetFilter(driver->udevMgr, qemuUdevFilter, NULL);
     }
 
     if (cfg->allowDiskFormatProbing)
-- 
2.8.4

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



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]