]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
tree-wide: remove aufs storage driver
authorChristian Brauner <christian.brauner@ubuntu.com>
Sun, 11 Mar 2018 09:22:42 +0000 (10:22 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Thu, 15 Mar 2018 16:24:49 +0000 (17:24 +0100)
We've announced quite a while back and printed out errors and warning everytime
someone used the aufs driver.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
14 files changed:
doc/lxc-copy.sgml.in
doc/lxc-snapshot.sgml.in
doc/lxc.container.conf.sgml.in
src/lxc/Makefile.am
src/lxc/conf.c
src/lxc/confile.c
src/lxc/lxccontainer.c
src/lxc/storage/aufs.c [deleted file]
src/lxc/storage/aufs.h [deleted file]
src/lxc/storage/overlay.c
src/lxc/storage/storage.c
src/lxc/storage/storage_utils.c
src/lxc/tools/lxc_copy.c
src/lxc/tools/lxc_create.c

index 467af116aef9eaf32218217d6f68a566f47a5950..921a073192947bb2c31c20e9f434ddefdfa28acf 100644 (file)
@@ -113,13 +113,13 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
       root filesystem of the container is simply copied to the new container. Or
       they can be snapshots, i.e. small copy-on-write copies of the original
       container. In this case the specified backing storage for the copy must
-      support snapshots. This currently includes aufs, btrfs, lvm (lvm devices
+      support snapshots. This currently includes btrfs, lvm (lvm devices
       do not support snapshots of snapshots.), overlay, and zfs.
     </para>
       
     <para>
     The copy's backing storage will be of the same type as the original
-    container. aufs or overlayfs snapshots of directory backed containers are
+    container. overlay snapshots of directory backed containers are
     exempted from this rule.
     </para>
 
@@ -145,21 +145,22 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
     Containers created and started with <replaceable>-e</replaceable> can have
     custom mounts. These are specified with the <replaceable>-m</replaceable>
     flag. Currently three types of mounts are supported:
-    <replaceable>aufs</replaceable>, <replaceable>bind</replaceable>, and
+    <replaceable>bind</replaceable>, and
     <replaceable>overlay</replaceable>. Mount types are specified as suboptions
     to the <replaceable>-m</replaceable> flag and can be specified multiple
-    times separated by commas. <replaceable>aufs</replaceable> and
-    <replaceable>overlay</replaceable> mounts are currently specified in the
-    format <replaceable>-m overlay=/src:/dest</replaceable>.  When no
-    destination <replaceable>dest</replaceable> is specified
+    times separated by commas. <replaceable>overlay</replaceable> mounts are
+    currently specified in the format <replaceable>-m
+    overlay=/src:/dest</replaceable>.  When no destination
+    <replaceable>dest</replaceable> is specified
     <replaceable>dest</replaceable> will be identical to
     <replaceable>src</replaceable>. Read-only <replaceable>bind</replaceable>
     mounts are specified <replaceable>-m bind=/src:/dest:ro</replaceable> and
     read-write <replaceable>bind</replaceable> mounts <replaceable>-m
-    bind=/src:/dest:rw</replaceable>. Read-write <replaceable>bind</replaceable>
-    mounts are the default and <replaceable>rw</replaceable> can be missing when
-    a read-write mount is wanted. When <replaceable>dest</replaceable> is
-    missing <replaceable>dest</replaceable> will be identical to
+    bind=/src:/dest:rw</replaceable>. Read-write
+    <replaceable>bind</replaceable> mounts are the default and
+    <replaceable>rw</replaceable> can be missing when a read-write mount is
+    wanted. When <replaceable>dest</replaceable> is missing
+    <replaceable>dest</replaceable> will be identical to
     <replaceable>src</replaceable>. An example for multiple mounts would be
     <replaceable>-m
     bind=/src1:/dest1:ro,bind=/src2:ro,overlay=/src3:/dest3</replaceable>.
@@ -203,7 +204,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
           <listitem>
             <para> Create a snapshot of the original container. The backing
             storage for the copy must support snapshots. This currently includes
-            aufs, btrfs, lvm, overlay, and zfs. </para>
+            btrfs, lvm, overlay, and zfs. </para>
           </listitem>
          </varlistentry>
 
@@ -234,7 +235,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
           <listitem>
             <para>  Specify a mount for a snapshot  The
             <replaceable>opts</replaceable> argument for the mount type can by
-            of type {aufs, bind, overlay}. For example <option>-m
+            of type {bind, overlay}. For example <option>-m
             bind=/src:/dest:ro,overlay=/src:/dest</option> (This option can
             currently only be specified in conjunction with
             <replaceable>-e</replaceable>.).</para>
@@ -258,7 +259,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
            <term> <option>-B, --backingstorage <replaceable>backingstorage</replaceable></option></term>
           <listitem>
             <para>Specify the backing storage type to be used for the copy
-            where 'backingstorage' is of type 'aufs', 'btrfs', 'dir', 'lvm', 'loop',
+            where 'backingstorage' is of type 'btrfs', 'dir', 'lvm', 'loop',
             'overlay', or 'zfs'. </para>
           </listitem>
          </varlistentry>
index 2986a3be52ff2497e79218e23283dc4868811d60..f40b9220ae0cbc39a4c8ef2a9ecee80e49fc2968 100644 (file)
@@ -129,7 +129,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
          <varlistentry>
            <term> <option>-N, --newname</option> </term>
           <listitem>
-            <para> When restoring a snapshot, the last optional argument if not given explicitly via <command>--newname</command> is the name to use for the restored container.  If the newname is identical to the original name of the container, then the original container will be destroyed and the restored container will take its place. Note that deleting the original snapshot is not possible in the case of aufs, overlayfs or zfs backed snapshots.</para>
+            <para> When restoring a snapshot, the last optional argument if not given explicitly via <command>--newname</command> is the name to use for the restored container.  If the newname is identical to the original name of the container, then the original container will be destroyed and the restored container will take its place. Note that deleting the original snapshot is not possible in the case of overlayfs or zfs backed snapshots.</para>
           </listitem>
          </varlistentry>
 
index 665d67ef90bb0a7111e58e6486eb28de4f3e6b55..bd4195d9dfc7bd4c29317d9cc9b95d6c82002413 100644 (file)
@@ -1365,9 +1365,7 @@ dev/null proc/kcore none bind,relative 0 0
           itself should be mounted.  <filename>overlayfs:/lower:/upper</filename>
           specifies that the rootfs should be an overlay with <filename>/upper</filename>
           being mounted read-write over a read-only mount of <filename>/lower</filename>.
-          <filename>aufs:/lower:/upper</filename> does the same using aufs in place
-          of overlayfs. For both <filename>overlayfs</filename> and
-          <filename>aufs</filename> multiple <filename>/lower</filename>
+          For <filename>overlay</filename> multiple <filename>/lower</filename>
           directories can be specified. <filename>loop:/file</filename> tells lxc to attach
           <filename>/file</filename> to a loop device and mount the loop device.
             </para>
index e56784bb9dfdf9f18ec81d425c4b55a9640ae76f..86dfc93e3b85b4705a73a7a0e94e8516bf1ac052 100644 (file)
@@ -6,7 +6,6 @@ pkginclude_HEADERS = \
 noinst_HEADERS = \
        attach.h \
        storage/storage.h \
-       storage/aufs.h \
        storage/btrfs.h \
        storage/dir.h \
        storage/loop.h \
@@ -81,7 +80,6 @@ endif
 lib_LTLIBRARIES = liblxc.la
 liblxc_la_SOURCES = \
        storage/storage.c storage/storage.h \
-       storage/aufs.c storage/aufs.h \
        storage/btrfs.c storage/btrfs.h \
        storage/dir.c storage/dir.h \
        storage/loop.c storage/loop.h \
index 71e6be88fb4ee33530b7609efc964930bd254d41..383504b4786371ecdb6095422a9f4f5acb2b5b98 100644 (file)
 #include "parse.h"
 #include "ringbuf.h"
 #include "storage.h"
-#include "storage/aufs.h"
 #include "storage/overlay.h"
 #include "terminal.h"
 #include "utils.h"
@@ -2001,14 +2000,14 @@ static int mount_entry_create_dir_file(const struct mntent *mntent,
                                       const char *lxc_name,
                                       const char *lxc_path)
 {
-       int ret = 0;
+       int fd, ret;
+       char *p1, *p2;
 
-       if (!strncmp(mntent->mnt_type, "overlay", 7))
+       if (strncmp(mntent->mnt_type, "overlay", 7) == 0) {
                ret = ovl_mkdir(mntent, rootfs, lxc_name, lxc_path);
-       else if (!strncmp(mntent->mnt_type, "aufs", 4))
-               ret = aufs_mkdir(mntent, rootfs, lxc_name, lxc_path);
-       if (ret < 0)
-               return -1;
+               if (ret < 0)
+                       return -1;
+       }
 
        if (hasmntopt(mntent, "create=dir")) {
                ret = mkdir_p(path, 0755);
index a7fef897d563fa8056fc0432163d2f9b59a7accd..c1b4638d9b113f8d4abd9d6cb3ba841d5b2a1c6c 100644 (file)
@@ -2582,17 +2582,16 @@ bool clone_update_unexp_ovl_paths(struct lxc_conf *conf, const char *oldpath,
                if (p >= lend)
                        goto next;
 
-               /* Whenever an lxc.mount.entry entry is found in a line we check
-               *  if the substring " overlay" or the substring " aufs" is
-               *  present before doing any further work. We check for "
-               *  overlay" and " aufs" since both substrings need to have at
-               *  least one space before them in a valid overlay
+               /* Whenever a lxc.mount.entry entry is found in a line we check
+               *  if the substring "overlay" is present before doing any
+               *  further work. We check for "overlay" because substrings need
+               *  to have at least one space before them in a valid overlay
                *  lxc.mount.entry (/A B overlay).  When the space before is
                *  missing it is very likely that these substrings are part of a
                *  path or something else. (Checking q >= lend ensures that we
                *  only count matches in the current line.) */
-               if ((!(q = strstr(p, " overlay")) || q >= lend) &&
-                   (!(q = strstr(p, " aufs")) || q >= lend))
+               q = strstr(p, " overlay");
+               if (!q || q >= lend)
                        goto next;
 
                if (!(q = strstr(p, olddir)) || (q >= lend))
index ecb770f484880ec483e9b7a202b5056161dfbba3..076c68472b48c12067a1863bcbb547d36acd638c 100644 (file)
@@ -3548,7 +3548,6 @@ sudo lxc-clone -o o1 -n n1 -s -L|-fssize fssize -v|--vgname vgname \
 
 -s [ implies overlay]
 -s -B overlay
--s -B aufs
 
 only rootfs gets converted (copied/snapshotted) on clone.
 */
@@ -3935,7 +3934,7 @@ static int do_lxcapi_snapshot(struct lxc_container *c, const char *commentfile)
        if (storage_is_dir(c->lxc_conf)) {
                ERROR("Snapshot of directory-backed container requested.");
                ERROR("Making a copy-clone.  If you do want snapshots, then");
-               ERROR("please create an aufs or overlay clone first, snapshot that");
+               ERROR("please create overlay clone first, snapshot that");
                ERROR("and keep the original container pristine.");
                flags &= ~LXC_CLONE_SNAPSHOT | LXC_CLONE_MAYBE_SNAPSHOT;
        }
diff --git a/src/lxc/storage/aufs.c b/src/lxc/storage/aufs.c
deleted file mode 100644 (file)
index c275f88..0000000
+++ /dev/null
@@ -1,455 +0,0 @@
-/*
- * lxc: linux Container library
- *
- * (C) Copyright IBM Corp. 2007, 2008
- *
- * Authors:
- * Daniel Lezcano <daniel.lezcano at free.fr>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#define _GNU_SOURCE
-#include <errno.h>
-#include <stdint.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-
-#include "aufs.h"
-#include "log.h"
-#include "rsync.h"
-#include "storage.h"
-#include "utils.h"
-
-lxc_log_define(aufs, lxc);
-
-/* the bulk of this needs to become a common helper */
-extern char *dir_new_path(char *src, const char *oldname, const char *name,
-               const char *oldpath, const char *lxcpath);
-
-int lxc_rsync_delta(struct rsync_data_char *data)
-{
-       int ret;
-
-       ret = lxc_switch_uid_gid(0, 0);
-       if (ret < 0)
-               return -1;
-
-       ret = lxc_setgroups(0, NULL);
-       if (ret < 0)
-               return -1;
-
-       ret = lxc_rsync_exec(data->src, data->dest);
-       if (ret < 0) {
-               ERROR("Failed to rsync from \"%s\" into \"%s\"", data->src,
-                     data->dest);
-               return -1;
-       }
-
-       return 0;
-}
-
-int lxc_rsync_delta_wrapper(void *data)
-{
-       struct rsync_data_char *arg = data;
-       return lxc_rsync_delta(arg);
-}
-
-int aufs_clonepaths(struct lxc_storage *orig, struct lxc_storage *new,
-                   const char *oldname, const char *cname, const char *oldpath,
-                   const char *lxcpath, int snap, uint64_t newsize,
-                   struct lxc_conf *conf)
-{
-       char cmd_output[MAXPATHLEN];
-
-       if (!snap) {
-               ERROR("aufs is only for snapshot clones");
-               return -22;
-       }
-
-       if (!orig->src || !orig->dest)
-               return -1;
-
-       new->dest = dir_new_path(orig->dest, oldname, cname, oldpath, lxcpath);
-       if (!new->dest)
-               return -1;
-       if (mkdir_p(new->dest, 0755) < 0)
-               return -1;
-
-       if (am_guest_unpriv() && chown_mapped_root(new->dest, conf) < 0)
-               WARN("Failed to update ownership of %s", new->dest);
-
-       if (strcmp(orig->type, "dir") == 0) {
-               char *delta, *lastslash;
-               int ret, len, lastslashidx;
-
-               // if we have /var/lib/lxc/c2/rootfs, then delta will be
-               //            /var/lib/lxc/c2/delta0
-               lastslash = strrchr(new->dest, '/');
-               if (!lastslash)
-                       return -22;
-               if (strlen(lastslash) < 7)
-                       return -22;
-               lastslash++;
-               lastslashidx = lastslash - new->dest;
-
-               delta = malloc(lastslashidx + 7);
-               if (!delta)
-                       return -1;
-               strncpy(delta, new->dest, lastslashidx+1);
-               strcpy(delta+lastslashidx, "delta0");
-               if ((ret = mkdir(delta, 0755)) < 0) {
-                       SYSERROR("error: mkdir %s", delta);
-                       free(delta);
-                       return -1;
-               }
-               if (am_guest_unpriv() && chown_mapped_root(delta, conf) < 0)
-                       WARN("Failed to update ownership of %s", delta);
-
-               // the src will be 'aufs:lowerdir:upperdir'
-               len = strlen(delta) + strlen(orig->src) + 12;
-               new->src = malloc(len);
-               if (!new->src) {
-                       free(delta);
-                       return -ENOMEM;
-               }
-               ret = snprintf(new->src, len, "aufs:%s:%s", orig->src, delta);
-               free(delta);
-               if (ret < 0 || ret >= len)
-                       return -ENOMEM;
-       } else if (strcmp(orig->type, "aufs") == 0) {
-               // What exactly do we want to do here?
-               // I think we want to use the original lowerdir, with a
-               // private delta which is originally rsynced from the
-               // original delta
-               char *osrc, *odelta, *nsrc, *ndelta;
-               int len, ret;
-               if (!(osrc = strdup(orig->src)))
-                       return -22;
-               nsrc = strchr(osrc, ':') + 1;
-               if (nsrc != osrc + 5 || (odelta = strchr(nsrc, ':')) == NULL) {
-                       free(osrc);
-                       return -22;
-               }
-               *odelta = '\0';
-               odelta++;
-               ndelta = dir_new_path(odelta, oldname, cname, oldpath, lxcpath);
-               if (!ndelta) {
-                       free(osrc);
-                       return -ENOMEM;
-               }
-               if ((ret = mkdir(ndelta, 0755)) < 0 && errno != EEXIST) {
-                       SYSERROR("error: mkdir %s", ndelta);
-                       free(osrc);
-                       free(ndelta);
-                       return -1;
-               }
-               if (am_guest_unpriv() && chown_mapped_root(ndelta, conf) < 0)
-                       WARN("Failed to update ownership of %s", ndelta);
-
-               struct rsync_data_char rdata;
-               rdata.src = odelta;
-               rdata.dest = ndelta;
-               if (am_guest_unpriv())
-                       ret = userns_exec_full(conf, lxc_rsync_delta_wrapper,
-                                              &rdata, "lxc_rsync_delta_wrapper");
-               else
-                       ret = run_command(cmd_output, sizeof(cmd_output),
-                                         lxc_rsync_delta_wrapper,
-                                         (void *)&rdata);
-               if (ret) {
-                       free(osrc);
-                       free(ndelta);
-                       ERROR("copying aufs delta");
-                       return -1;
-               }
-               len = strlen(nsrc) + strlen(ndelta) + 12;
-               new->src = malloc(len);
-               if (!new->src) {
-                       free(osrc);
-                       free(ndelta);
-                       return -ENOMEM;
-               }
-               ret = snprintf(new->src, len, "aufs:%s:%s", nsrc, ndelta);
-               free(osrc);
-               free(ndelta);
-               if (ret < 0 || ret >= len)
-                       return -ENOMEM;
-       } else {
-               ERROR("aufs clone of %s container is not yet supported",
-                       orig->type);
-               // Note, supporting this will require aufs_mount supporting
-               // mounting of the underlay.  No big deal, just needs to be done.
-               return -1;
-       }
-
-       return 0;
-}
-
-/*
- * to say 'lxc-create -t ubuntu -n o1 -B aufs' means you want
- * $lxcpath/$lxcname/rootfs to have the created container, while all
- * changes after starting the container are written to
- * $lxcpath/$lxcname/delta0
- */
-int aufs_create(struct lxc_storage *bdev, const char *dest, const char *n,
-               struct bdev_specs *specs)
-{
-       char *delta;
-       int ret, len = strlen(dest), newlen;
-
-       if (len < 8 || strcmp(dest+len-7, "/rootfs") != 0)
-               return -1;
-
-       if (!(bdev->dest = strdup(dest))) {
-               ERROR("Out of memory");
-               return -1;
-       }
-
-       delta = alloca(strlen(dest)+1);
-       strcpy(delta, dest);
-       strcpy(delta+len-6, "delta0");
-
-       if (mkdir_p(delta, 0755) < 0) {
-               ERROR("Error creating %s", delta);
-               return -1;
-       }
-
-       /* aufs:lower:upper */
-       newlen = (2 * len) + strlen("aufs:") + 2;
-       bdev->src = malloc(newlen);
-       if (!bdev->src) {
-               ERROR("Out of memory");
-               return -1;
-       }
-       ret = snprintf(bdev->src, newlen, "aufs:%s:%s", dest, delta);
-       if (ret < 0 || ret >= newlen)
-               return -1;
-
-       if (mkdir_p(bdev->dest, 0755) < 0) {
-               ERROR("Error creating %s", bdev->dest);
-               return -1;
-       }
-
-       return 0;
-}
-
-int aufs_destroy(struct lxc_storage *orig)
-{
-       char *upper;
-
-       if (strncmp(orig->src, "aufs:", 5) != 0)
-               return -22;
-       upper = strchr(orig->src + 5, ':');
-       if (!upper)
-               return -22;
-       upper++;
-       return lxc_rmdir_onedev(upper, NULL);
-}
-
-bool aufs_detect(const char *path)
-{
-       if (!strncmp(path, "aufs:", 5))
-               return true;
-
-       return false;
-}
-
-int aufs_mount(struct lxc_storage *bdev)
-{
-       char *tmp, *options, *dup, *lower, *upper;
-       int len;
-       unsigned long mntflags;
-       char *mntdata;
-       int ret;
-       const char *xinopath = "/dev/shm/aufs.xino";
-
-       if (strcmp(bdev->type, "aufs"))
-               return -22;
-       if (!bdev->src || !bdev->dest)
-               return -22;
-
-       //  separately mount it first
-       //  mount -t aufs -obr=${upper}=rw:${lower}=ro lower dest
-       dup = alloca(strlen(bdev->src)+1);
-       strcpy(dup, bdev->src);
-       /* support multiple lower layers */
-       if (!(lower = strstr(dup, ":/")))
-                       return -22;
-       lower++;
-       upper = lower;
-       while ((tmp = strstr(++upper, ":/"))) {
-               upper = tmp;
-       }
-       if (--upper == lower)
-               return -22;
-       *upper = '\0';
-       upper++;
-
-       if (parse_mntopts(bdev->mntopts, &mntflags, &mntdata) < 0) {
-               free(mntdata);
-               return -22;
-       }
-
-       // TODO We should check whether bdev->src is a blockdev, and if so
-       // but for now, only support aufs of a basic directory
-
-       // AUFS does not work on top of certain filesystems like (XFS or Btrfs)
-       // so add xino=/dev/shm/aufs.xino parameter to mount options.
-       // The same xino option can be specified to multiple aufs mounts, and
-       // a xino file is not shared among multiple aufs mounts.
-       //
-       // see http://www.mail-archive.com/aufs-users@lists.sourceforge.net/msg02587.html
-       //     http://www.mail-archive.com/aufs-users@lists.sourceforge.net/msg05126.html
-       if (mntdata) {
-               len = strlen(lower) + strlen(upper) + strlen(xinopath) + strlen("br==rw:=ro,,xino=") + strlen(mntdata) + 1;
-               options = alloca(len);
-               ret = snprintf(options, len, "br=%s=rw:%s=ro,%s,xino=%s", upper, lower, mntdata, xinopath);
-       }
-       else {
-               len = strlen(lower) + strlen(upper) + strlen(xinopath) + strlen("br==rw:=ro,xino=") + 1;
-               options = alloca(len);
-               ret = snprintf(options, len, "br=%s=rw:%s=ro,xino=%s", upper, lower, xinopath);
-       }
-
-       if (ret < 0 || ret >= len) {
-               free(mntdata);
-               return -1;
-       }
-
-       ret = mount(lower, bdev->dest, "aufs", MS_MGC_VAL | mntflags, options);
-       if (ret < 0)
-               SYSERROR("aufs: error mounting %s onto %s options %s",
-                       lower, bdev->dest, options);
-       else
-               INFO("aufs: mounted %s onto %s options %s",
-                       lower, bdev->dest, options);
-       return ret;
-}
-
-int aufs_umount(struct lxc_storage *bdev)
-{
-       if (strcmp(bdev->type, "aufs"))
-               return -22;
-       if (!bdev->src || !bdev->dest)
-               return -22;
-       return umount(bdev->dest);
-}
-
-char *aufs_get_rootfs(const char *rootfs_path, size_t *rootfslen)
-{
-       char *rootfsdir = NULL;
-       char *s1 = NULL;
-       char *s2 = NULL;
-       char *s3 = NULL;
-
-       if (!rootfs_path || !rootfslen)
-               return NULL;
-
-       s1 = strdup(rootfs_path);
-       if (!s1)
-               return NULL;
-
-       if ((s2 = strstr(s1, ":/"))) {
-               s2 = s2 + 1;
-               if ((s3 = strstr(s2, ":/")))
-                       *s3 = '\0';
-               rootfsdir = strdup(s2);
-               if (!rootfsdir) {
-                       free(s1);
-                       return NULL;
-               }
-       }
-
-       if (!rootfsdir)
-               rootfsdir = s1;
-       else
-               free(s1);
-
-       *rootfslen = strlen(rootfsdir);
-
-       return rootfsdir;
-}
-
-int aufs_mkdir(const struct mntent *mntent, const struct lxc_rootfs *rootfs,
-               const char *lxc_name, const char *lxc_path)
-{
-       char lxcpath[MAXPATHLEN];
-       char *rootfs_path = NULL;
-       char *rootfsdir = NULL;
-       char *scratch = NULL;
-       char *tmp = NULL;
-       char *upperdir = NULL;
-       char **opts = NULL;
-       int fret = -1;
-       int ret = 0;
-       size_t arrlen = 0;
-       size_t i;
-       size_t len = 0;
-       size_t rootfslen = 0;
-
-       /* When rootfs == NULL we have a container without a rootfs. */
-       if (rootfs && rootfs->path)
-               rootfs_path = rootfs->path;
-
-       opts = lxc_string_split(mntent->mnt_opts, ',');
-       if (opts)
-               arrlen = lxc_array_len((void **)opts);
-       else
-               goto err;
-
-       for (i = 0; i < arrlen; i++) {
-               if (strstr(opts[i], "br=") && (strlen(opts[i]) > (len = strlen("br="))))
-                       tmp = opts[i] + len;
-       }
-       if (!tmp)
-               goto err;
-
-       upperdir = strtok_r(tmp, ":=", &scratch);
-       if (!upperdir)
-               goto err;
-
-       if (rootfs_path) {
-               ret = snprintf(lxcpath, MAXPATHLEN, "%s/%s", lxc_path, lxc_name);
-               if (ret < 0 || ret >= MAXPATHLEN)
-                       goto err;
-
-               rootfsdir = aufs_get_rootfs(rootfs->path, &rootfslen);
-               if (!rootfsdir)
-                       goto err;
-       }
-
-       /*
-        * We neither allow users to create upperdirs and workdirs outside the
-        * containerdir nor inside the rootfs. The latter might be debatable.
-        * When we have a container without a rootfs we skip the checks.
-        */
-       ret = 0;
-       if (!rootfs_path)
-               ret = mkdir_p(upperdir, 0755);
-       else if ((strncmp(upperdir, lxcpath, strlen(lxcpath)) == 0) && (strncmp(upperdir, rootfsdir, rootfslen) != 0))
-               ret = mkdir_p(upperdir, 0755);
-       if (ret < 0)
-               WARN("Failed to create upperdir");
-
-       fret = 0;
-
-err:
-       free(rootfsdir);
-       lxc_free_array((void **)opts, free);
-       return fret;
-}
-
diff --git a/src/lxc/storage/aufs.h b/src/lxc/storage/aufs.h
deleted file mode 100644 (file)
index 7960a3a..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * lxc: linux Container library
- *
- * (C) Copyright IBM Corp. 2007, 2008
- *
- * Authors:
- * Daniel Lezcano <daniel.lezcano at free.fr>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __LXC_AUFS_H
-#define __LXC_AUFS_H
-
-#define _GNU_SOURCE
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdint.h>
-
-#include "storage.h"
-
-struct lxc_storage;
-
-struct bdev_specs;
-
-struct lxc_conf;
-
-struct lxc_rootfs;
-
-int aufs_clonepaths(struct lxc_storage *orig, struct lxc_storage *new,
-                   const char *oldname, const char *cname, const char *oldpath,
-                   const char *lxcpath, int snap, uint64_t newsize,
-                   struct lxc_conf *conf);
-int aufs_create(struct lxc_storage *bdev, const char *dest, const char *n,
-               struct bdev_specs *specs);
-int aufs_destroy(struct lxc_storage *orig);
-bool aufs_detect(const char *path);
-int aufs_mount(struct lxc_storage *bdev);
-int aufs_umount(struct lxc_storage *bdev);
-
-/* Get rootfs path for aufs backed containers. Allocated memory must be freed by
- * caller.
- */
-char *aufs_get_rootfs(const char *rootfs_path, size_t *rootfslen);
-
-/*
- * Create directories for aufs mounts.
- */
-int aufs_mkdir(const struct mntent *mntent, const struct lxc_rootfs *rootfs,
-               const char *lxc_name, const char *lxc_path);
-
-#endif /* __LXC_AUFS_H */
index 35214af524961604ccc06c289ad9b00bf749c889..7acb9eac1c888b8ebc53576f4a51b7007b69232e 100644 (file)
@@ -866,9 +866,6 @@ int ovl_update_abs_paths(struct lxc_conf *lxc_conf, const char *lxc_path,
 
                if (strstr(mnt_entry, "overlay"))
                        tmp = "upperdir";
-               else if (strstr(mnt_entry, "aufs"))
-                       tmp = "br";
-
                if (!tmp)
                        continue;
 
index c453fe7440ce4a0431147992f2b41976723a6662..cac08584609beada4f8e65329a11a12513626460 100644 (file)
@@ -39,7 +39,6 @@
 #include <sys/stat.h>
 #include <sys/wait.h>
 
-#include "aufs.h"
 #include "btrfs.h"
 #include "conf.h"
 #include "config.h"
 
 lxc_log_define(storage, lxc);
 
-/* aufs */
-static const struct lxc_storage_ops aufs_ops = {
-    .detect = &aufs_detect,
-    .mount = &aufs_mount,
-    .umount = &aufs_umount,
-    .clone_paths = &aufs_clonepaths,
-    .destroy = &aufs_destroy,
-    .create = &aufs_create,
-    .copy = NULL,
-    .snapshot = NULL,
-    .can_snapshot = true,
-    .can_backup = true,
-};
-
 /* btrfs */
 static const struct lxc_storage_ops btrfs_ops = {
     .detect = &btrfs_detect,
@@ -204,7 +189,6 @@ static const struct lxc_storage_type bdevs[] = {
        { .name = "lvm",       .ops = &lvm_ops,   },
        { .name = "rbd",       .ops = &rbd_ops,   },
        { .name = "btrfs",     .ops = &btrfs_ops, },
-       { .name = "aufs",      .ops = &aufs_ops,  },
        { .name = "overlay",   .ops = &ovl_ops,   },
        { .name = "overlayfs", .ops = &ovl_ops,   },
        { .name = "loop",      .ops = &loop_ops,  },
@@ -284,11 +268,6 @@ struct lxc_storage *storage_get(const char *type)
        bdev->ops = bdevs[i].ops;
        bdev->type = bdevs[i].name;
 
-       if (strcmp(bdev->type, "aufs") == 0)
-               WARN("The \"aufs\" driver will is deprecated and will soon be "
-                    "removed. For similar functionality see the \"overlay\" "
-                    "storage driver");
-
        return bdev;
 }
 
@@ -655,11 +634,6 @@ struct lxc_storage *storage_init(struct lxc_conf *conf)
        if (strcmp(bdev->type, "nbd") == 0)
                bdev->nbd_idx = conf->nbd_idx;
 
-       if (strcmp(bdev->type, "aufs") == 0)
-               WARN("The \"aufs\" driver will is deprecated and will soon be "
-                    "removed. For similar functionality see the \"overlay\" "
-                    "storage driver");
-
        return bdev;
 }
 
index 3cae81a59014c2d6e9f66512195aa657b65bd209..1a67b6de081531284812f0a73a77f9425555d038 100644 (file)
@@ -423,7 +423,6 @@ bool unpriv_snap_allowed(struct lxc_storage *b, const char *t, bool snap,
                 * allowed).
                 */
                if (strcmp(b->type, "dir") == 0 ||
-                   strcmp(b->type, "aufs") == 0 ||
                    strcmp(b->type, "overlay") == 0 ||
                    strcmp(b->type, "overlayfs") == 0 ||
                    strcmp(b->type, "btrfs") == 0 ||
@@ -437,7 +436,6 @@ bool unpriv_snap_allowed(struct lxc_storage *b, const char *t, bool snap,
         * In particular, not zfs, btrfs, or lvm.
         */
        if (strcmp(t, "dir") == 0 ||
-           strcmp(t, "aufs") == 0 ||
            strcmp(t, "overlay") == 0 ||
            strcmp(t, "overlayfs") == 0 ||
            strcmp(t, "btrfs") == 0 ||
@@ -451,7 +449,6 @@ bool is_valid_storage_type(const char *type)
 {
        if (strcmp(type, "dir") == 0 ||
            strcmp(type, "btrfs") == 0 ||
-           strcmp(type, "aufs") == 0 ||
            strcmp(type, "loop") == 0 ||
            strcmp(type, "lvm") == 0 ||
            strcmp(type, "nbd") == 0 ||
index d9db9a7875b6c4218ca664402110608e71b3f3be..b4e1178fd1806dfd5119d6c1e4919df08970e679 100644 (file)
@@ -44,7 +44,6 @@
 
 enum mnttype {
        LXC_MNT_BIND,
-       LXC_MNT_AUFS,
        LXC_MNT_OVL,
 };
 
@@ -84,7 +83,6 @@ static const struct option my_longopts[] = {
 /* mount keys */
 static char *const keys[] = {
        [LXC_MNT_BIND] = "bind",
-       [LXC_MNT_AUFS] = "aufs",
        [LXC_MNT_OVL] = "overlay",
        NULL
 };
@@ -93,7 +91,7 @@ static struct lxc_arguments my_args = {
        .progname = "lxc-copy",
        .help = "\n\
 --name=NAME [-P lxcpath] -N newname [-p newpath] [-B backingstorage] [-s] [-K] [-M] [-L size [unit]] -- hook options\n\
---name=NAME [-P lxcpath] [-N newname] [-p newpath] [-B backingstorage] -e [-d] [-D] [-K] [-M] [-m {bind,aufs,overlay}=/src:/dest] -- hook options\n\
+--name=NAME [-P lxcpath] [-N newname] [-p newpath] [-B backingstorage] -e [-d] [-D] [-K] [-M] [-m {bind,overlay}=/src:/dest] -- hook options\n\
 --name=NAME [-P lxcpath] -N newname -R\n\
 \n\
 lxc-copy clone a container\n\
@@ -108,7 +106,7 @@ Options :\n\
   -d, --daemon              daemonize the container (default)\n\
   -e, --ephemeral           start ephemeral container\n\
   -m, --mount               directory to mount into container, either \n\
-                            {bind,aufs,overlay}=/src-path or {bind,aufs,overlay}=/src-path:/dst-path\n\
+                            {bind,overlay}=/src-path or {bind,overlay}=/src-path:/dst-path\n\
   -B, --backingstorage=TYPE backingstorage type for the container\n\
   -t, --tmpfs               place ephemeral container on a tmpfs\n\
                             (WARNING: On reboot all changes made to the container will be lost.)\n\
@@ -146,13 +144,12 @@ static uint64_t get_fssize(char *s);
 
 /* Place an ephemeral container started with -e flag on a tmpfs. Restrictions
  * are that you cannot request the data to be kept while placing the container
- * on a tmpfs and that either overlay or aufs backing storage must be used.
+ * on a tmpfs and that either overlay storage driver must be used.
  */
 static char *mount_tmpfs(const char *oldname, const char *newname,
                         const char *path, struct lxc_arguments *arg);
 static int parse_mntsubopts(char *subopts, char *const *keys,
                            char *mntparameters);
-static int parse_aufs_mnt(char *mntstring, enum mnttype type);
 static int parse_bind_mnt(char *mntstring, enum mnttype type);
 static int parse_ovl_mnt(char *mntstring, enum mnttype type);
 
@@ -268,7 +265,7 @@ static int mk_rand_ovl_dirs(struct mnts *mnts, unsigned int num, struct lxc_argu
        struct mnts *m = NULL;
 
        for (i = 0, m = mnts; i < num; i++, m++) {
-               if ((m->mnt_type == LXC_MNT_OVL) || (m->mnt_type == LXC_MNT_AUFS)) {
+               if (m->mnt_type == LXC_MNT_OVL) {
                        ret = snprintf(upperdir, TOOL_MAXPATHLEN, "%s/%s/delta#XXXXXX",
                                        arg->newpath, arg->newname);
                        if (ret < 0 || ret >= TOOL_MAXPATHLEN)
@@ -317,20 +314,7 @@ static char *set_mnt_entry(struct mnts *m)
        int ret = 0;
        size_t len = 0;
 
-       if (m->mnt_type == LXC_MNT_AUFS) {
-               len = strlen("  aufs br==rw:=ro,xino=,create=dir") +
-                     2 * strlen(m->src) + strlen(m->dest) + strlen(m->upper) +
-                     strlen(m->workdir) + 1;
-
-               mntentry = malloc(len);
-               if (!mntentry)
-                       goto err;
-
-               ret = snprintf(mntentry, len, "%s %s aufs br=%s=rw:%s=ro,xino=%s,create=dir",
-                              m->src, m->dest, m->upper, m->src, m->workdir);
-               if (ret < 0 || (size_t)ret >= len)
-                       goto err;
-       } else if (m->mnt_type == LXC_MNT_OVL) {
+       if (m->mnt_type == LXC_MNT_OVL) {
                len = strlen("  overlay lowerdir=,upperdir=,workdir=,create=dir") +
                      2 * strlen(m->src) + strlen(m->dest) + strlen(m->upper) +
                      strlen(m->workdir) + 1;
@@ -631,49 +615,6 @@ static int my_parser(struct lxc_arguments *args, int c, char *arg)
        return 0;
 }
 
-static int parse_aufs_mnt(char *mntstring, enum mnttype type)
-{
-       int len = 0;
-       const char *xinopath = "/dev/shm/aufs.xino";
-       char **mntarray = NULL;
-       struct mnts *m = NULL;
-
-       m = add_mnt(&mnt_table, &mnt_table_size, type);
-       if (!m)
-               goto err;
-
-       mntarray = lxc_string_split(mntstring, ':');
-       if (!mntarray)
-               goto err;
-
-       m->src = construct_path(mntarray[0], true);
-       if (!m->src)
-               goto err;
-
-       len = lxc_array_len((void **)mntarray);
-       if (len == 1) /* aufs=src */
-               m->dest = construct_path(mntarray[0], false);
-       else if (len == 2) /* aufs=src:dest */
-               m->dest = construct_path(mntarray[1], false);
-       else
-               printf("Excess elements in mount specification\n");
-
-       if (!m->dest)
-               goto err;
-
-       m->workdir = strdup(xinopath);
-       if (!m->workdir)
-               goto err;
-
-       lxc_free_array((void **)mntarray, free);
-       return 0;
-
-err:
-       free_mnts();
-       lxc_free_array((void **)mntarray, free);
-       return -1;
-}
-
 static int parse_bind_mnt(char *mntstring, enum mnttype type)
 {
        int len = 0;
@@ -744,10 +685,6 @@ static int parse_mntsubopts(char *subopts, char *const *keys, char *mntparameter
                        if (parse_ovl_mnt(mntparameters, LXC_MNT_OVL) < 0)
                                return -1;
                        break;
-               case LXC_MNT_AUFS:
-                       if (parse_aufs_mnt(mntparameters, LXC_MNT_AUFS) < 0)
-                               return -1;
-                       break;
                default:
                        break;
                }
@@ -793,7 +730,7 @@ err:
        return -1;
 }
 
-/* For ephemeral snapshots backed by overlay or aufs filesystems, this function
+/* For ephemeral snapshots backed by the overlay filesystem, this function
  * mounts a fresh tmpfs over the containers directory if the user requests it.
  * Because we mount a fresh tmpfs over the directory of the container the
  * updated /etc/hostname file created during the clone residing in the upperdir
@@ -811,18 +748,19 @@ static char *mount_tmpfs(const char *oldname, const char *newname,
        FILE *fp;
 
        if (arg->tmpfs && arg->keepdata) {
-               fprintf(stderr, "%s\n", "A container can only be placed on a "
-                                       "tmpfs when storage backend is overlay "
-                                       "or aufs.");
+               fprintf(stderr, "%s\n",
+                       "A container can only be placed on a tmpfs when the "
+                       "overlay storage driver is used");
                goto err_free;
        }
 
        if (arg->tmpfs && !arg->bdevtype) {
                arg->bdevtype = "overlayfs";
-       } else if (arg->tmpfs && arg->bdevtype && strcmp(arg->bdevtype, "overlayfs") && strcmp(arg->bdevtype, "aufs")) {
-               fprintf(stderr, "%s\n", "A container can only be placed on a "
-                                       "tmpfs when storage backend is overlay "
-                                       "or aufs.");
+       } else if (arg->tmpfs && arg->bdevtype &&
+                  strcmp(arg->bdevtype, "overlayfs") != 0) {
+               fprintf(stderr, "%s\n",
+                       "A container can only be placed on a tmpfs when the "
+                       "overlay storage driver is used");
                goto err_free;
        }
 
index f0c9caab1c3e23eeb51ca8bf19b5dd2b70500284..3b0c4d401505e88dd8e97141a1d6609b04b314b0 100644 (file)
@@ -205,7 +205,6 @@ static bool is_valid_storage_type(const char *type)
 {
        if (strcmp(type, "dir") == 0 ||
            strcmp(type, "btrfs") == 0 ||
-           strcmp(type, "aufs") == 0 ||
            strcmp(type, "loop") == 0 ||
            strcmp(type, "lvm") == 0 ||
            strcmp(type, "nbd") == 0 ||