]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
nspawn: add ability to configure overlay mounts to .nspawn files
authorLennart Poettering <lennart@poettering.net>
Tue, 29 Nov 2016 22:55:04 +0000 (23:55 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 1 Dec 2016 11:41:17 +0000 (12:41 +0100)
Fixes: #4634
man/systemd.nspawn.xml
src/nspawn/nspawn-gperf.gperf
src/nspawn/nspawn-settings.c
src/nspawn/nspawn-settings.h

index b1344d6c10f11531edcba2c3a7fb3d8693a57f3b..714318835646b549e1968bd552038bfb7f21c384 100644 (file)
         is privileged (see above).</para></listitem>
       </varlistentry>
 
+      <varlistentry>
+        <term><varname>Overlay=</varname></term>
+        <term><varname>OverlayReadOnly=</varname></term>
+
+        <listitem><para>Adds an overlay mount point. Takes a colon-separated list of paths.  This option may be used
+        multiple times to configure multiple overlay mounts. This option is equivalent to the command line switches
+        <option>--overlay=</option> and <option>--overlay-ro=</option>, see
+        <citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry> for details
+        about the specific options supported. This setting is privileged (see above).</para></listitem>
+      </varlistentry>
+
       <varlistentry>
         <term><varname>PrivateUsersChown=</varname></term>
 
index 3231a48d5a756042facfcaea8291c251d3d78565..c0fa4bfa1f39d7686106ce59e559b0902678f383 100644 (file)
@@ -33,6 +33,8 @@ Files.Volatile,               config_parse_volatile_mode, 0, offsetof(Settings,
 Files.Bind,                   config_parse_bind,          0, 0
 Files.BindReadOnly,           config_parse_bind,          1, 0
 Files.TemporaryFileSystem,    config_parse_tmpfs,         0, 0
+Files.Overlay,                config_parse_overlay,       0, 0
+Files.OverlayReadOnly,        config_parse_overlay,       1, 0
 Files.PrivateUsersChown,      config_parse_tristate,      0, offsetof(Settings, userns_chown)
 Network.Private,              config_parse_tristate,      0, offsetof(Settings, private_network)
 Network.Interface,            config_parse_strv,          0, offsetof(Settings, network_interfaces)
index 09c8f070baaaf0adbddcb6679194e7ca17c9bf4d..22b74d88e46a84f907122ced2fa3af332a5128d7 100644 (file)
@@ -293,6 +293,32 @@ int config_parse_tmpfs(
         return 0;
 }
 
+int config_parse_overlay(
+                const char *unit,
+                const char *filename,
+                unsigned line,
+                const char *section,
+                unsigned section_line,
+                const char *lvalue,
+                int ltype,
+                const char *rvalue,
+                void *data,
+                void *userdata) {
+
+        Settings *settings = data;
+        int r;
+
+        assert(filename);
+        assert(lvalue);
+        assert(rvalue);
+
+        r = overlay_mount_parse(&settings->custom_mounts, &settings->n_custom_mounts, rvalue, ltype);
+        if (r < 0)
+                log_syntax(unit, LOG_ERR, filename, line, r, "Invalid overlay file system specification %s, ignoring: %m", rvalue);
+
+        return 0;
+}
+
 int config_parse_veth_extra(
                 const char *unit,
                 const char *filename,
index 231e6d72663df817746f69f498b63159cba18800..4bd0c642df554c1877990936d10fb5a31336c460 100644 (file)
@@ -111,6 +111,7 @@ int config_parse_expose_port(const char *unit, const char *filename, unsigned li
 int config_parse_volatile_mode(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
 int config_parse_bind(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
 int config_parse_tmpfs(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
+int config_parse_overlay(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
 int config_parse_veth_extra(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
 int config_parse_network_zone(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
 int config_parse_boot(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);