[PATCHv2 1/4] network: create statedir during driver initialization

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

 



This directory should be created when the network driver is first
started up, not just when a dhcp daemon is run. This hasn't posed a
problem in the past, because the directory has always been
pre-existing.
---
Change from V1: mistakenly went to "cleanup" on error rather than "error" :-P

 src/network/bridge_driver.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index eb276cd..4ca3de5 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -487,6 +487,13 @@ networkStateInitialize(bool privileged,
         }
     }
 
+    if (virFileMakePath(driverState->stateDir) < 0) {
+        virReportSystemError(errno,
+                             _("cannot create directory %s"),
+                             driverState->stateDir);
+        goto error;
+    }
+
     /* if this fails now, it will be retried later with dnsmasqCapsRefresh() */
     driverState->dnsmasqCaps = dnsmasqCapsNewFromBinary(DNSMASQ);
 
@@ -1171,12 +1178,6 @@ networkStartDhcpDaemon(virNetworkDriverStatePtr driver,
                              driverState->pidDir);
         goto cleanup;
     }
-    if (virFileMakePath(driverState->stateDir) < 0) {
-        virReportSystemError(errno,
-                             _("cannot create directory %s"),
-                             driverState->stateDir);
-        goto cleanup;
-    }
 
     if (!(pidfile = virPidFileBuildPath(driverState->pidDir,
                                         network->def->name)))
-- 
1.9.0

--
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]