support disk snapshots with emulator
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
android (Ubuntu) |
Fix Released
|
High
|
Ricardo Salveti |
Bug Description
Being able to create a snapshot and roll back to it is very useful for developers. Eg, developers can
* develop features, etc on the image, then package them up, roll back the image and test on a pristine image
* save time on system-image upgrade testing
* do multiple test runs, reverting to the pristine image between runs to cut down on variances
* verify bugs in the image easily
* etc
Snapshotting can be complicated, but most of the time you just want to have a pristine snapshot that you can rollback to with the option of committing changes. Attached is an updated run-emulator.sh script to achieve this:
$ ./run-emulator.sh help
Usage: run-emulator.sh
Commands:
use-disk-snapshots Convert images to qcow2 and create 'pristine' snapshot
convert-disk DISK Convert DISK to qcow2 and create 'pristine' snapshot
snapshot-disks Update 'pristine' snapshot to current state
revert-disks Revert current images to 'pristine' snapshot
info-disks Show disk information for current images
Without arguments, run the emulated image.
Note: these commands only manipulate the qemu qcow2 disk images and are
unrelated to the -snapshot* and -no-snapshot* emulator command line
options
Basic workflow is:
$ ./build-
$ ./run-emulator.sh use-disk-snapshots
$ ./run-emulator.sh
<do work>
$ ./run-emulator.sh revert-disks
$ ./run-emulator.sh
<perform tests in pristine environment>
$ ./run-emulator.sh revert-disks
Once system-image is supported, can update the image like so:
$ ./run-emulator.sh revert-disks
$ ./run-emulator.sh
<run system-image>
$ ./run-emulator.sh snapshot-disks
The emulator is based on qemu 0.12 and the default disk compatibility option for qcow2 images is 0.10 (though I explicitly use compat=0.10 in the script). The script continues to run as before with raw images and snapshotting is only usable after running 'use-disk-
Note that this script only deals with the disk files themselves and adds a dependency on qemu-utils. It does not require advanced functionality with the emulator and is lightly tested. The emulator itself has other snapshot commands that might be interesting to expose to users (eg, /usr/share/
Feel free to adjust as desired.
Changed in android (Ubuntu): | |
status: | New → In Progress |
importance: | Undecided → High |
assignee: | nobody → Ricardo Salveti (rsalveti) |
Updated run_emulator.sh to add 'convert-disk'.