[PATCH v3 1/2] qemuxml2argvtest: Load virSecurityDriverNop

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

 



In the next patch we are gonna be playing with networks, creating
TUN/TAP devices. However, the code invokes
virSecurityManagerSetTapFDLabel() over the FDs of TUN/TAP devices
when the command line is constructed. This makes sense as we
certainly want the FDs labelled correctly. However, due to the
nature of how's the code written a security driver is required.
So we need to load a dummy security driver that always claims
success.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 tests/qemuxml2argvtest.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index c7b8ecf..b22b207 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -493,6 +493,8 @@ mymain(void)
 {
     int ret = 0;
     bool skipLegacyCPUs = false;
+    virSecurityManagerPtr mgr = NULL;
+    virSecurityManagerPtr stack = NULL;
 
     abs_top_srcdir = getenv("abs_top_srcdir");
     if (!abs_top_srcdir)
@@ -544,6 +546,10 @@ mymain(void)
     driver.config->spiceTLS = 1;
     if (VIR_STRDUP_QUIET(driver.config->spicePassword, "123456") < 0)
         return EXIT_FAILURE;
+    if (!(mgr = virSecurityManagerNew("none", QEMU_DRIVER_NAME, false, false, false)) ||
+        !(stack = virSecurityManagerNewStack(mgr)))
+        return EXIT_FAILURE;
+    driver.securityManager = stack;
 
 # define DO_TEST_FULL(name, migrateFrom, migrateFd, flags, ...)         \
     do {                                                                \
@@ -1527,6 +1533,7 @@ mymain(void)
     virObjectUnref(driver.config);
     virObjectUnref(driver.caps);
     virObjectUnref(driver.xmlopt);
+    virObjectUnref(driver.securityManager);
 
     return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
 }
-- 
2.0.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]