12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- #!/bin/bash
-
- . <(ffoom init)
-
- ffoo import core
- ffoo import recon
-
- FFOO_VERBOSE=${FFOO_VERBOSE:-true}
-
- usage() {
- usage_is "[--dry-run] [-c|--connection] domain [snapshot]"
- }
-
- DRY_RUN=false
- connection="qemu:///system"
-
- while true; do
- case $1 in
- -c|--connection)
- connection=$2
- shift 2
- ;;
- --dry-run)
- 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=$(saturnin ini -1 -p revert.to.snapshot.$domain)
- }
- test -z "$snapshot" && {
- think "looking for default snapshot name in revert.ini"
- snapshot=$(saturnin ini -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"
- $DRY_RUN || virsh -c "$connection" snapshot-revert $domain $snapshot
-
- think "starting $domain"
- debug "virsh -c "$connection" start $domain"
- $DRY_RUN || virsh -c "$connection" start $domain
|