12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- #!/bin/bash
-
- . <(ffoom init)
- FFOO_INI_PATH="__EECC_INI_PATH__"
-
- 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"
-
- test -z "$snapshot" && {
- think "looking for $domain in revert.ini"
- snapshot=$(iniread -1 -p revert.to.snapshot.$domain)
- }
- test -z "$snapshot" && {
- think "looking for default snapshot name in revert.ini"
- snapshot=$(iniread -1 -p revert.to.snapshot._default_)
- }
- 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
|