Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZFS native snapshotting ability #362

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ AC_PATH_PROG([LVSBIN], [lvs], [/sbin/lvs])
AC_PATH_PROG([LVCHANGEBIN], [lvchange], [/sbin/lvchange])
AC_PATH_PROG([LVMBIN], [lvm], [/sbin/lvm])
AC_PATH_PROG([LVRENAMEBIN], [lvrename], [/sbin/lvrename])
AC_PATH_PROG([ZFSBIN], [zfs], [/sbin/zfs])
AC_PATH_PROG([ZPOOLBIN], [zpool], [/sbin/zpool])

AC_DEFINE_UNQUOTED([CHSNAPBIN], ["$CHSNAPBIN"], [Path of chsnap program.])
AC_DEFINE_UNQUOTED([CPBIN], ["$CPBIN"], [Path of cp program.])
Expand All @@ -50,6 +52,8 @@ AC_DEFINE_UNQUOTED([LVSBIN], ["$LVSBIN"], [Path of lvs program.])
AC_DEFINE_UNQUOTED([LVCHANGEBIN], ["$LVCHANGEBIN"], [Path of lvchange program.])
AC_DEFINE_UNQUOTED([LVMBIN], ["$LVMBIN"], [Path of lvm program.])
AC_DEFINE_UNQUOTED([LVRENAMEBIN], ["$LVRENAMEBIN"], [Path of lvrename program.])
AC_DEFINE_UNQUOTED([ZFSBIN], ["$ZFSBIN"], [Path of zfs program.])
AC_DEFINE_UNQUOTED([ZPOOLBIN], ["$ZPOOLBIN"], [Path of zpool program.])

dnl Automake 1.11 enables silent compilation
dnl Disable it by "configure --disable-silent-rules" or "make V=1"
Expand Down Expand Up @@ -93,7 +97,16 @@ if test "x$with_lvm" = "xyes"; then
AC_DEFINE(ENABLE_LVM, 1, [Enable LVM thin-provisioned snapshots support])
fi

if test "x$with_btrfs" != "xyes" -a "x$with_lvm" != "xyes" -a "x$with_ext4" != "xyes"; then
AC_ARG_ENABLE([zfs], AC_HELP_STRING([--disable-zfs],[Disable Zfs internal snapshots support]),
[with_zfs=$enableval],[with_zfs=yes])

AM_CONDITIONAL(ENABLE_ZFS, [test "x$with_zfs" = "xyes"])

if test "x$with_zfs" = "xyes"; then
AC_DEFINE(ENABLE_ZFS, 1, [Enable Zfs internal snapshots support])
fi

if test "x$with_btrfs" != "xyes" -a "x$with_lvm" != "xyes" -a "x$with_ext4" != "xyes" -a "x$with_zfs" != "xyes"; then
AC_MSG_ERROR([You have to enable at least one snapshot type (remove some --disable-xxx parameter)])
fi

Expand Down
6 changes: 6 additions & 0 deletions snapper/Filesystem.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@
#ifdef ENABLE_LVM
#include "snapper/Lvm.h"
#endif
#ifdef ENABLE_ZFS
#include "snapper/Zfs.h"
#endif
#include "snapper/Snapper.h"
#include "snapper/SnapperTmpl.h"
#include "snapper/SnapperDefines.h"
Expand Down Expand Up @@ -106,6 +109,9 @@ namespace snapper
#endif
#ifdef ENABLE_LVM
&Lvm::create,
#endif
#ifdef ENABLE_ZFS
&Zfs::create,
#endif
NULL
};
Expand Down
6 changes: 6 additions & 0 deletions snapper/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ libsnapper_la_SOURCES += \
LvmCache.cc LvmCache.h
endif

if ENABLE_ZFS
libsnapper_la_SOURCES += \
Zfs.cc Zfs.h \
ZfsUtils.cc ZfsUtils.h
endif

if ENABLE_ROLLBACK
libsnapper_la_SOURCES += \
MntTable.cc MntTable.h
Expand Down
7 changes: 7 additions & 0 deletions snapper/Snapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#include "config.h"

#include "snapper/ZfsUtils.h"
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/statvfs.h>
Expand All @@ -48,6 +49,7 @@
#include "snapper/Hooks.h"
#include "snapper/Btrfs.h"
#include "snapper/BtrfsUtils.h"
#include "snapper/ZfsUtils.h"
#ifdef ENABLE_SELINUX
#include "snapper/Selinux.h"
#include "snapper/Regex.h"
Expand Down Expand Up @@ -943,6 +945,11 @@ namespace snapper
#endif
"ext4,"

#ifndef ENABLE_ZFS
"no-"
#endif
"zfs,"

#ifndef ENABLE_XATTRS
"no-"
#endif
Expand Down
Loading