Add --status-quo option to preserve the existing disk state

Starting a VM with `--status-quo` will prevent any changes being committed to the disk image. However, while the VM is boot you can make changes but on next boot none will have been preserved.
pull/8/head
Martin Wimpress 5 years ago
parent 588e5de640
commit 65735c9c8d
No known key found for this signature in database
GPG Key ID: 61DF940515E06DA3
  1. 1
      README.md
  2. 12
      quickemu

@ -88,6 +88,7 @@ You can also pass optional parameters
--snapshot create <tag> : Create a snapshot.
--snapshot delete <tag> : Delete a snapshot.
--snapshot info : Show disk/snapshot info.
--status-quo : Do not commit any changes to disk/snapshot.
```
## TODO

@ -143,6 +143,11 @@ function vm_boot() {
fi
fi
# Has the status quo been requested?
if [ "${STATUSQUO}" == "-snapshot" ] && [ -z "${iso}" ]; then
echo " Existing disk state will be preserved, no writes will be committed."
fi
local cores="1"
local allcores=$(nproc --all)
if [ ${allcores} -ge 8 ]; then
@ -228,7 +233,7 @@ function vm_boot() {
-object rng-random,id=rng0,filename=/dev/urandom \
-device virtio-rng-pci,rng=rng0 \
-device virtio-vga,virgl=${VIRGL},xres=${xres},yres=${yres} \
${display} \
${display} ${STATUSQUO}\
"$@"
}
@ -244,6 +249,7 @@ function usage() {
echo " --snapshot create <tag> : Create a snapshot."
echo " --snapshot delete <tag> : Delete a snapshot."
echo " --snapshot info : Show disk/snapshot info."
echo " --status-quo : Do not commit any changes to disk/snapshot."
exit 1
}
@ -254,6 +260,7 @@ readonly QEMU_IMG="/snap/bin/qemu-virgil.qemu-img"
readonly LAUNCHER=$(basename $0)
SNAPSHOT_ACTION=""
SNAPSHOT_TAG=""
STATUSQUO=""
VM=""
while [ $# -gt 0 ]; do
@ -278,6 +285,9 @@ while [ $# -gt 0 ]; do
fi
shift
shift;;
-status-quo|--status-quo)
STATUSQUO="-snapshot"
shift;;
-vm|--vm)
VM="$2"
shift

Loading…
Cancel
Save