From: Lubomir Rintel Date: Wed, 8 Apr 2015 17:16:52 +0000 (+0200) Subject: lxc: create the required directories upon driver start X-Git-Tag: v1.2.13.1~104 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ed1cf00af88490b6398bfafee1bcacee64b72128;p=thirdparty%2Flibvirt.git lxc: create the required directories upon driver start /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 (cherry picked from commit da33a1ac1f6c0ae2ebe72bc385bbc7c407026956) --- diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 3a28dd55e3..8a0072115a 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -1650,6 +1650,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,