[PATCH] lxc: create the required directories upon driver start

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

 



/var/run may reside on a tmpfs and we fail to create the PID file if
/var/run/lxc does not exist.

Other drivers (well, BHYVE) seem to do the same thing.

Signed-off-by: Lubomir Rintel <lkundrak@xxxxx>
---
 src/lxc/lxc_driver.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 245000d..4363898 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -1648,6 +1648,20 @@ static int lxcStateInitialize(bool privileged,
     if (!(caps = virLXCDriverGetCapabilities(lxc_driver, false)))
         goto cleanup;
 
+    if (virFileMakePath(LXC_LOG_DIR) < 0) {
+        virReportSystemError(errno,
+                             _("Failed to mkdir %s"),
+                             LXC_LOG_DIR);
+        goto cleanup;
+    }
+
+    if (virFileMakePath(LXC_STATE_DIR) < 0) {
+        virReportSystemError(errno,
+                             _("Failed to mkdir %s"),
+                             LXC_STATE_DIR);
+        goto cleanup;
+    }
+
     /* Get all the running persistent or transient configs first */
     if (virDomainObjListLoadAllConfigs(lxc_driver->domains,
                                        cfg->stateDir,
-- 
2.1.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]