]> xenbits.xensource.com Git - libvirt.git/commitdiff
lxc: create the required directories upon driver start
authorLubomir Rintel <lkundrak@v3.sk>
Wed, 8 Apr 2015 17:16:52 +0000 (19:16 +0200)
committerCédric Bosdonnat <cbosdonnat@suse.com>
Thu, 9 Apr 2015 09:06:26 +0000 (11:06 +0200)
/var/run may reside on a tmpfs and we fail to create the PID file if
/var/run/lxc does not exist.

Since commit 0a8addc1, the lxc driver's state directory isn't
automatically created before starting a domain. Now, the lxc driver
makes sure the state directory exists when it initializes.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
src/lxc/lxc_driver.c

index 245000d963076a0649b65dca165ec5a752625adc..8dfa686eb4e59ae0a6884c7cd4e7eee5d6bd4e5d 100644 (file)
@@ -1648,6 +1648,13 @@ static int lxcStateInitialize(bool privileged,
     if (!(caps = virLXCDriverGetCapabilities(lxc_driver, false)))
         goto cleanup;
 
+    if (virFileMakePath(cfg->stateDir) < 0) {
+        virReportSystemError(errno,
+                             _("Failed to mkdir %s"),
+                             cfg->stateDir);
+        goto cleanup;
+    }
+
     /* Get all the running persistent or transient configs first */
     if (virDomainObjListLoadAllConfigs(lxc_driver->domains,
                                        cfg->stateDir,