# Nothing need be done for the dir backed, but we still need some functions.
# This file can also serve as a skel file for what needs to be done to
# implement a new backend.

# Any necessary backend-specific setup
dir_setup() {
  # shellcheck disable=2039,3043
  local LXD_DIR

  LXD_DIR=$1

  echo "==> Setting up directory backend in ${LXD_DIR}"
}

# Do the API voodoo necessary to configure LXD to use this backend
dir_configure() {
  # shellcheck disable=2039,3043
  local LXD_DIR

  LXD_DIR=$1

  echo "==> Configuring directory backend in ${LXD_DIR}"

  lxc storage create "lxdtest-$(basename "${LXD_DIR}")" dir
  lxc profile device add default root disk path="/" pool="lxdtest-$(basename "${LXD_DIR}")"
}

dir_teardown() {
  # shellcheck disable=2039,3043
  local LXD_DIR

  LXD_DIR=$1

  echo "==> Tearing down directory backend in ${LXD_DIR}"
}
