Commit de09eccb by Serge Hallyn

lxc-create: zfs: consistently use zfsroot, not zfs_root

parent dc92f6c7
...@@ -32,7 +32,7 @@ verify_btrfs() { ...@@ -32,7 +32,7 @@ verify_btrfs() {
} }
verify_zfs() { verify_zfs() {
if which zfs >/dev/null 2>&1 && zfs get all "$zfs_root" >/dev/null 2>&1; then if which zfs >/dev/null 2>&1 && zfs get all "$zfsroot" >/dev/null 2>&1; then
echo zfs echo zfs
else else
echo no echo no
...@@ -198,7 +198,7 @@ while [ $# -gt 0 ]; do ...@@ -198,7 +198,7 @@ while [ $# -gt 0 ]; do
;; ;;
--zfsroot) --zfsroot)
optarg_check $opt "$1" optarg_check $opt "$1"
zfs_root=$1 zfsroot=$1
shift shift
;; ;;
--) --)
...@@ -248,8 +248,8 @@ if [ -z "$lvname" ]; then ...@@ -248,8 +248,8 @@ if [ -z "$lvname" ]; then
lvname="$lxc_name" lvname="$lxc_name"
fi fi
if [ -z "$zfs_root" ]; then if [ -z "$zfsroot" ]; then
zfs_root="tank/lxc" zfsroot="tank/lxc"
fi fi
if [ "$(id -u)" != "0" ]; then if [ "$(id -u)" != "0" ]; then
...@@ -271,7 +271,7 @@ case "$backingstore" in ...@@ -271,7 +271,7 @@ case "$backingstore" in
;; ;;
zfs) zfs)
if [ `verify_zfs` != 'zfs' ]; then if [ `verify_zfs` != 'zfs' ]; then
echo "missing 'zfs' command or $zfs_root is not zfs" >&2 echo "missing 'zfs' command or $zfsroot is not zfs" >&2
exit 1 exit 1
fi fi
;; ;;
...@@ -313,7 +313,7 @@ cleanup() { ...@@ -313,7 +313,7 @@ cleanup() {
elif [ "$backingstore" = "btrfs" ]; then elif [ "$backingstore" = "btrfs" ]; then
btrfs subvolume delete "$rootfs" || true btrfs subvolume delete "$rootfs" || true
elif [ "$backingstore" = "zfs" ]; then elif [ "$backingstore" = "zfs" ]; then
zfs destroy "$zfs_root/$lxc_name" || true zfs destroy "$zfsroot/$lxc_name" || true
fi fi
${bindir}/lxc-destroy -n $lxc_name -P "$lxc_path" ${bindir}/lxc-destroy -n $lxc_name -P "$lxc_path"
...@@ -325,7 +325,7 @@ trap cleanup HUP INT TERM ...@@ -325,7 +325,7 @@ trap cleanup HUP INT TERM
# set up container dir per backing store # set up container dir per backing store
if [ "$backingstore" = "zfs" ]; then if [ "$backingstore" = "zfs" ]; then
zfs create -omountpoint=$lxc_path/$lxc_name/rootfs "$zfs_root/$lxc_name" zfs create -omountpoint=$lxc_path/$lxc_name/rootfs "$zfsroot/$lxc_name"
elif [ "$backingstore" = "btrfs" ]; then elif [ "$backingstore" = "btrfs" ]; then
mkdir "$lxc_path/$lxc_name" mkdir "$lxc_path/$lxc_name"
if ! out=$(btrfs subvolume create "$rootfs" 2>&1); then if ! out=$(btrfs subvolume create "$rootfs" 2>&1); then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment