#!/bin/bash #================================================= # LXD HELPERS #================================================= ynh_lxc_snapshot_exists () { local snapname=$1 lxc list --format json \ | jq -e --arg LXC_NAME $LXC_NAME --arg snapname $snapname \ '.[] | select(.name==$LXC_NAME) | .snapshots[] | select(.name==$snapname)' \ >/dev/null } ynh_lxc_snapshot_load () { local snapname=$1 log_debug "Loading snapshot $snapname ..." # Remove swap files before restoring the snapshot. CLEAN_SWAPFILES LXC_STOP $LXC_NAME lxc restore $LXC_NAME $snapname lxc start $LXC_NAME _LXC_START_AND_WAIT $LXC_NAME }