chiark / gitweb /
nspawn,machined: change default container image location from /var/lib/container...
authorLennart Poettering <lennart@poettering.net>
Thu, 15 Jan 2015 00:40:02 +0000 (01:40 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 15 Jan 2015 00:47:21 +0000 (01:47 +0100)
Given that this is also the place to store raw disk images which are
very much bootable with qemu/kvm it sounds like a misnomer to call the
directory "container". Hence, let's change this sooner rather than
later, and use the generic name, in particular since we otherwise try to
use the generic "machine" preferably over the more specific "container"
or "vm".

man/machinectl.xml
man/systemd-nspawn.xml
src/import/import.c
src/shared/machine-image.c
tmpfiles.d/var.conf

index 91bdb5e..1953186 100644 (file)
                                 name. <command>systemd-nspawn</command>
                                 looks for a container image by the
                                 specified name in
                                 name. <command>systemd-nspawn</command>
                                 looks for a container image by the
                                 specified name in
-                                <filename>/var/lib/container</filename>
-                                and runs it. Use
-                                <command>list-images</command> (see
-                                below), for listing available
+                                <filename>/var/lib/machines/</filename>
+                                (and other search paths, see below) and runs
+                                it. Use <command>list-images</command>
+                                (see below), for listing available
                                 container images to start.</para>
 
                                 <para>Note that
                                 container images to start.</para>
 
                                 <para>Note that
                                 images. This enumerates all raw disk
                                 images and container directories and
                                 subvolumes in
                                 images. This enumerates all raw disk
                                 images and container directories and
                                 subvolumes in
-                                <filename>/var/lib/container/</filename>. Use
+                                <filename>/var/lib/machines/</filename> (and other search paths, see below). Use
                                 <command>start</command> (see above)
                                 to run a container off one of the
                                 listed images. Note that by default
                                 <command>start</command> (see above)
                                 to run a container off one of the
                                 listed images. Note that by default
         </refsect1>
 
         <refsect1>
         </refsect1>
 
         <refsect1>
+                <title>Files and Directories</title>
+
+                <para>Machine images are preferably stored in
+                <filename>/var/lib/machines/</filename>, but are also
+                searched for in
+                <filename>/usr/local/lib/machines/</filename> and
+                <filename>/usr/lib/machines/</filename>. For
+                compatibility reasons the directory
+                <filename>/var/lib/container/</filename> is searched,
+                too. Note that images stored below
+                <filename>/usr</filename> are always considered
+                read-only. It is possible to symlink machines images
+                from other directories into
+                <filename>/var/lib/machines/</filename> to make them
+                available for control with
+                <command>machinectl</command>.</para>
+
+                <para>Disk images are understood in three formats:</para>
+
+                <itemizedlist>
+                        <listitem><para>A simple directory tree,
+                        containing the files and directories of the
+                        container to boot.</para></listitem>
+
+                        <listitem><para>A subvolume (on btrfs file
+                        systems), which are similar to the simple
+                        directories, described above. However, they
+                        have additional benefits, such as efficient
+                        cloning and quota reporting.</para></listitem>
+
+                        <listitem><para>"Raw" disk images, i.e. binary
+                        images of disks with a GPT or MBR partition
+                        table. Images of this type are regular
+                        files with the suffix
+                        <literal>.raw</literal>.</para></listitem>
+                </itemizedlist>
+
+                <para>See
+                <citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+                for more information on image formats, in particular
+                it's <option>--directory=</option> and
+                <option>--image=</option> options.</para>
+        </refsect1>
+
+        <refsect1>
                 <title>Exit status</title>
 
                 <para>On success, 0 is returned, a non-zero failure
                 <title>Exit status</title>
 
                 <para>On success, 0 is returned, a non-zero failure
index e67aeec..0c6fb00 100644 (file)
                                 <option>--directory=</option>, nor
                                 <option>--image=</option> is specified
                                 the directory is determined as
                                 <option>--directory=</option>, nor
                                 <option>--image=</option> is specified
                                 the directory is determined as
-                                <filename>/var/lib/container/</filename>
+                                <filename>/var/lib/machines/</filename>
                                 suffixed by the machine name as
                                 specified with
                                 <option>--machine=</option>. If
                                 suffixed by the machine name as
                                 specified with
                                 <option>--machine=</option>. If
                                 the root directory for the container
                                 from. Takes a path to a regular file
                                 or to a block device node. The file or
                                 the root directory for the container
                                 from. Takes a path to a regular file
                                 or to a block device node. The file or
-                                block device must contain a GUID
-                                Partition Table with a root partition
-                                which is mounted as the root directory
-                                of the container. Optionally, it may
+                                block device must contain either an
+                                MBR partition table with a single
+                                partition of type 0x83 that is marked
+                                bootable, or a GUID partition table
+                                with a root partition which is mounted
+                                as the root directory of the
+                                container. Optionally, GPT images may
                                 contain a home and/or a server data
                                 partition which are mounted to the
                                 appropriate places in the
                                 contain a home and/or a server data
                                 partition which are mounted to the
                                 appropriate places in the
                 <example>
                         <title>Enable Arch Linux container on boot</title>
 
                 <example>
                         <title>Enable Arch Linux container on boot</title>
 
-                        <programlisting># mv ~/arch-tree /var/lib/container/arch
+                        <programlisting># mv ~/arch-tree /var/lib/machines/arch
 # systemctl enable systemd-nspawn@arch.service
 # systemctl start systemd-nspawn@arch.service</programlisting>
 
 # systemctl enable systemd-nspawn@arch.service
 # systemctl start systemd-nspawn@arch.service</programlisting>
 
index 669d7c1..b4d859d 100644 (file)
@@ -29,7 +29,7 @@
 #include "import-dkr.h"
 
 static bool arg_force = false;
 #include "import-dkr.h"
 
 static bool arg_force = false;
-static const char *arg_image_root = "/var/lib/container";
+static const char *arg_image_root = "/var/lib/machines";
 
 static const char* arg_dkr_index_url = DEFAULT_DKR_INDEX_URL;
 
 
 static const char* arg_dkr_index_url = DEFAULT_DKR_INDEX_URL;
 
index a2f49e6..5112d24 100644 (file)
@@ -110,7 +110,7 @@ static int image_make(
         assert(filename);
 
         /* We explicitly *do* follow symlinks here, since we want to
         assert(filename);
 
         /* We explicitly *do* follow symlinks here, since we want to
-         * allow symlinking trees into /var/lib/container/, and treat
+         * allow symlinking trees into /var/lib/machines/, and treat
          * them normally. */
 
         if (fstatat(dfd, filename, &st, 0) < 0)
          * them normally. */
 
         if (fstatat(dfd, filename, &st, 0) < 0)
@@ -486,13 +486,13 @@ int image_clone(Image *i, const char *new_name, bool read_only) {
 
         case IMAGE_SUBVOLUME:
         case IMAGE_DIRECTORY:
 
         case IMAGE_SUBVOLUME:
         case IMAGE_DIRECTORY:
-                new_path = strappenda("/var/lib/container/", new_name);
+                new_path = strappenda("/var/lib/machines/", new_name);
 
                 r = btrfs_subvol_snapshot(i->path, new_path, read_only, true);
                 break;
 
         case IMAGE_RAW:
 
                 r = btrfs_subvol_snapshot(i->path, new_path, read_only, true);
                 break;
 
         case IMAGE_RAW:
-                new_path = strappenda("/var/lib/container/", new_name, ".raw");
+                new_path = strappenda("/var/lib/machines/", new_name, ".raw");
 
                 r = copy_file_atomic(i->path, new_path, read_only ? 0444 : 0644, false, FS_NOCOW_FL);
                 break;
 
                 r = copy_file_atomic(i->path, new_path, read_only ? 0444 : 0644, false, FS_NOCOW_FL);
                 break;
index d0c759e..9b76444 100644 (file)
@@ -18,6 +18,6 @@ f /var/log/btmp 0600 root utmp -
 d /var/cache 0755 - - -
 
 d /var/lib 0755 - - -
 d /var/cache 0755 - - -
 
 d /var/lib 0755 - - -
-v /var/lib/container 0700 - - -
+v /var/lib/machines 0700 - - -
 
 d /var/spool 0755 - - -
 
 d /var/spool 0755 - - -