[systemd-commits] 2 commits - TODO src/fstab-generator

Lennart Poettering lennart at kemper.freedesktop.org
Tue Mar 11 10:03:06 PDT 2014


 TODO                                  |    2 --
 src/fstab-generator/fstab-generator.c |   11 +++++++++++
 2 files changed, 11 insertions(+), 2 deletions(-)

New commits:
commit 2be56ff1e49c8954a0899da701233acf053e95a4
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Mar 11 18:02:17 2014 +0100

    update TODO

diff --git a/TODO b/TODO
index 3b0e027..1e13f0f 100644
--- a/TODO
+++ b/TODO
@@ -27,8 +27,6 @@ External:
 
 Features:
 
-* fstab-generator: in a container, simply skip entries referencing physical devices
-
 * mount /sys/fs/cgroup read-only (but leave the subdirs writable)
 
 * gpt-auto-generator:

commit 689aede8c622ba68d9060e4edee27364445b2007
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Mar 11 17:57:15 2014 +0100

    fstab-generator: when running in a container, ignore fstab entries referring to device nodes
    
    Since these device nodes will never appear in the container anyway
    there's no point in waiting for them.
    
    This makes it easier to boot images generated with general purpose
    installers like Anaconda which unconditionally populate /etc/fstab to
    boot in containers.

diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
index 34cd720..a9a5c02 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
@@ -35,6 +35,7 @@
 #include "fileio.h"
 #include "generator.h"
 #include "strv.h"
+#include "virt.h"
 
 static const char *arg_dest = "/tmp";
 static bool arg_fstab_enabled = true;
@@ -77,6 +78,11 @@ static int add_swap(const char *what, struct mntent *me) {
         assert(what);
         assert(me);
 
+        if (detect_container(NULL) > 0) {
+                log_info("Running in a container, ignoring fstab swap entry for %s.", what);
+                return 0;
+        }
+
         r = mount_find_pri(me, &pri);
         if (r < 0) {
                 log_error("Failed to parse priority");
@@ -341,6 +347,11 @@ static int parse_fstab(bool initrd) {
                 if (!what)
                         return log_oom();
 
+                if (detect_container(NULL) > 0 && is_device_path(what)) {
+                        log_info("Running in a container, ignoring fstab device entry for %s.", what);
+                        continue;
+                }
+
                 where = initrd ? strappend("/sysroot/", me->mnt_dir) : strdup(me->mnt_dir);
                 if (!where)
                         return log_oom();



More information about the systemd-commits mailing list