]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
network: create statedir during driver initialization
authorLaine Stump <laine@laine.org>
Fri, 4 Apr 2014 11:21:13 +0000 (14:21 +0300)
committerLaine Stump <laine@laine.org>
Sun, 27 Apr 2014 09:19:13 +0000 (12:19 +0300)
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.

src/network/bridge_driver.c

index 652bccca57ef70c6d4674063cd16b6a835bc26a2..44c63a784b94f1c5e2e76a7853f100cfb839ca1a 100644 (file)
@@ -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)))