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.
This commit is contained in:
parent
588e5de640
commit
65735c9c8d
@ -88,6 +88,7 @@ You can also pass optional parameters
|
|||||||
--snapshot create <tag> : Create a snapshot.
|
--snapshot create <tag> : Create a snapshot.
|
||||||
--snapshot delete <tag> : Delete a snapshot.
|
--snapshot delete <tag> : Delete a snapshot.
|
||||||
--snapshot info : Show disk/snapshot info.
|
--snapshot info : Show disk/snapshot info.
|
||||||
|
--status-quo : Do not commit any changes to disk/snapshot.
|
||||||
```
|
```
|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
|
12
quickemu
12
quickemu
@ -143,6 +143,11 @@ function vm_boot() {
|
|||||||
fi
|
fi
|
||||||
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 cores="1"
|
||||||
local allcores=$(nproc --all)
|
local allcores=$(nproc --all)
|
||||||
if [ ${allcores} -ge 8 ]; then
|
if [ ${allcores} -ge 8 ]; then
|
||||||
@ -228,7 +233,7 @@ function vm_boot() {
|
|||||||
-object rng-random,id=rng0,filename=/dev/urandom \
|
-object rng-random,id=rng0,filename=/dev/urandom \
|
||||||
-device virtio-rng-pci,rng=rng0 \
|
-device virtio-rng-pci,rng=rng0 \
|
||||||
-device virtio-vga,virgl=${VIRGL},xres=${xres},yres=${yres} \
|
-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 create <tag> : Create a snapshot."
|
||||||
echo " --snapshot delete <tag> : Delete a snapshot."
|
echo " --snapshot delete <tag> : Delete a snapshot."
|
||||||
echo " --snapshot info : Show disk/snapshot info."
|
echo " --snapshot info : Show disk/snapshot info."
|
||||||
|
echo " --status-quo : Do not commit any changes to disk/snapshot."
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -254,6 +260,7 @@ readonly QEMU_IMG="/snap/bin/qemu-virgil.qemu-img"
|
|||||||
readonly LAUNCHER=$(basename $0)
|
readonly LAUNCHER=$(basename $0)
|
||||||
SNAPSHOT_ACTION=""
|
SNAPSHOT_ACTION=""
|
||||||
SNAPSHOT_TAG=""
|
SNAPSHOT_TAG=""
|
||||||
|
STATUSQUO=""
|
||||||
VM=""
|
VM=""
|
||||||
|
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
@ -278,6 +285,9 @@ while [ $# -gt 0 ]; do
|
|||||||
fi
|
fi
|
||||||
shift
|
shift
|
||||||
shift;;
|
shift;;
|
||||||
|
-status-quo|--status-quo)
|
||||||
|
STATUSQUO="-snapshot"
|
||||||
|
shift;;
|
||||||
-vm|--vm)
|
-vm|--vm)
|
||||||
VM="$2"
|
VM="$2"
|
||||||
shift
|
shift
|
||||||
|
Loading…
Reference in New Issue
Block a user