]> git.proxmox.com Git - mirror_lxc.git/commitdiff
pin_rootfs: be quiet and don't fail container start
authorSerge Hallyn <serge.hallyn@ubuntu.com>
Wed, 11 Sep 2013 04:17:46 +0000 (23:17 -0500)
committerSerge Hallyn <serge.hallyn@ubuntu.com>
Wed, 11 Sep 2013 04:17:46 +0000 (23:17 -0500)
It's a legitimate use case to use read-only $lxcpath.  If we can't
create the pin file, then we're not worried about marking the fs
readonly on exit.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
src/lxc/conf.c
src/lxc/start.c

index 2d95e5dad17b2fdb7df4472d920f64cefedb2537..5f9ae87e61b621bf9c38e98695d9e98c6b57dde0 100644 (file)
@@ -687,32 +687,23 @@ int pin_rootfs(const char *rootfs)
        if (rootfs == NULL || strlen(rootfs) == 0)
                return -2;
 
-       if (!realpath(rootfs, absrootfs)) {
-               INFO("failed to get real path for '%s', not pinning", rootfs);
+       if (!realpath(rootfs, absrootfs))
                return -2;
-       }
 
-       if (access(absrootfs, F_OK)) {
-               SYSERROR("'%s' is not accessible", absrootfs);
+       if (access(absrootfs, F_OK))
                return -1;
-       }
 
-       if (stat(absrootfs, &s)) {
-               SYSERROR("failed to stat '%s'", absrootfs);
+       if (stat(absrootfs, &s))
                return -1;
-       }
 
        if (!S_ISDIR(s.st_mode))
                return -2;
 
        ret = snprintf(absrootfspin, MAXPATHLEN, "%s%s", absrootfs, ".hold");
-       if (ret >= MAXPATHLEN) {
-               SYSERROR("pathname too long for rootfs hold file");
+       if (ret >= MAXPATHLEN)
                return -1;
-       }
 
        fd = open(absrootfspin, O_CREAT | O_RDWR, S_IWUSR|S_IRUSR);
-       INFO("opened %s as fd %d\n", absrootfspin, fd);
        return fd;
 }
 
index 0356fc028897746651c42649ce4cc45aa2d28a29..2d09887d24695462129649bb7207335ab24d25dc 100644 (file)
@@ -669,10 +669,8 @@ int lxc_spawn(struct lxc_handler *handler)
         */
 
        handler->pinfd = pin_rootfs(handler->conf->rootfs.path);
-       if (handler->pinfd == -1) {
-               ERROR("failed to pin the container's rootfs");
-               goto out_delete_net;
-       }
+       if (handler->pinfd == -1)
+               INFO("failed to pin the container's rootfs");
 
        /* Create a process in a new set of namespaces */
        handler->pid = lxc_clone(do_start, handler, handler->clone_flags);