[libvirt] [PATCH 6/7] lxc: Verify root fs exists before mounting

Cole Robinson crobinso at redhat.com
Thu Jun 2 19:40:25 UTC 2011


Otherwise the following virFileMakePath will create the directory for
us and fail further ahead, which probably isn't intended.

Signed-off-by: Cole Robinson <crobinso at redhat.com>
---
 src/lxc/lxc_controller.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index c94d0d0..7d60090 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -664,6 +664,14 @@ lxcControllerRun(virDomainDefPtr def,
      */
     if (root) {
         VIR_DEBUG("Setting up private /dev/pts");
+
+        if (!virFileExists(root->src)) {
+            virReportSystemError(errno,
+                                 _("root source %s does not exist"),
+                                 root->src);
+            goto cleanup;
+        }
+
         if (unshare(CLONE_NEWNS) < 0) {
             virReportSystemError(errno, "%s",
                                  _("Cannot unshare mount namespace"));
-- 
1.7.4.4




More information about the libvir-list mailing list