123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- #!/bin/bash
-
- . <(ffoom init)
- FFOO_INIPATH="__FFOO_INIPATH__"
-
- ffoo import core
- ffoo import ini
- ffoo import recon
-
- usage() {
- usage_is "[-d|--debug] [-v|--verbose] [--dry-run] [-c|--connection] domain [snapshot]"
- }
-
- FFOO_DRY_RUN=false
- connection="qemu:///system"
-
- while true; do
- case $1 in
- -c|--connection)
- connection=$2
- shift 2
- ;;
- -d|--debug)
- FFOO_DEBUG=true
- shift 1
- ;;
- -q|--quiet)
- FFOO_VERBOSE=false
- shift 1
- ;;
- -v|--verbose)
- FFOO_VERBOSE=true
- shift 1
- ;;
- --dry-run)
- FFOO_DRY_RUN=true
- shift 1
- ;;
- "")
- usage
- ;;
- --)
- shift 1
- break
- ;;
- *)
- break
- ;;
- esac
- done
-
- domain="$1"
- snapshot="$2"
-
- FFOO_DATA_DIR=/home/amahdal/.eecc
-
- test -z "$snapshot" && {
- think "looking for $domain in revert.ini"
- snapshot=$(iniread -1 -p revert.to.snapshot.$domain revert.ini)
- }
- test -z "$snapshot" && {
- think "looking for default snapshot name in revert.ini"
- snapshot=$(iniread -1 -p revert.to.snapshot._default_ revert.ini)
- }
- test -z "$snapshot" && {
- die "could not determine snapshot for $domain"
- }
-
- think "reverting $domain to $snapshot"
- debug "virsh -c "$connection" snapshot-revert $domain $snapshot"
- $FFOO_DRY_RUN || virsh -c "$connection" snapshot-revert $domain $snapshot
-
- think "starting $domain"
- debug "virsh -c "$connection" start $domain"
- $FFOO_DRY_RUN || virsh -c "$connection" start $domain
|