[PATCH v2 12/13] nwfilter: Move creation of configDir to driver initialization

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

 



Rather than "wait" for the first config file to be created, force creation
of the configDir during driver state initialization.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/conf/nwfilter_conf.c       | 7 -------
 src/nwfilter/nwfilter_driver.c | 7 +++++++
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c
index 752d4e1..032700c 100644
--- a/src/conf/nwfilter_conf.c
+++ b/src/conf/nwfilter_conf.c
@@ -2778,13 +2778,6 @@ virNWFilterSaveXML(const char *configDir,
     if (!(configFile = virFileBuildPath(configDir, def->name, ".xml")))
         goto cleanup;
 
-    if (virFileMakePath(configDir) < 0) {
-        virReportSystemError(errno,
-                             _("cannot create config directory '%s'"),
-                             configDir);
-        goto cleanup;
-    }
-
     virUUIDFormat(def->uuid, uuidstr);
     ret = virXMLSaveFile(configFile,
                          virXMLPickShellSafeComment(def->name, uuidstr),
diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c
index faa4fe8..5e62023 100644
--- a/src/nwfilter/nwfilter_driver.c
+++ b/src/nwfilter/nwfilter_driver.c
@@ -40,6 +40,7 @@
 #include "nwfilter_driver.h"
 #include "nwfilter_gentech_driver.h"
 #include "configmake.h"
+#include "virfile.h"
 #include "virstring.h"
 #include "viraccessapicheck.h"
 
@@ -237,6 +238,12 @@ nwfilterStateInitialize(bool privileged,
 
     VIR_FREE(base);
 
+    if (virFileMakePathWithMode(driver->configDir, S_IRWXU) < 0) {
+        virReportSystemError(errno, _("cannot create config directory '%s'"),
+                             driver->configDir);
+        goto error;
+    }
+
     if (!(driver->nwfilters = virNWFilterObjListNew()))
         goto error;
 
-- 
2.9.3

--
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]
  Powered by Linux