A KVM based service to save snapshot of a running VM and restore VM from saved snapshot
Report Bug
Table of Contents
The project is built on the vmm-refernce codebase that serve as a starting point in the creation of tailor-made VMMs that users build according to their needs. But it does not provide the functionality to pause and resume a VM. That is motivation for our project. We take dependencies from our webserver part for communication with the backend and from our deduplication part for storing snapshots efficiently. Comprehensive report can be found here and final presentation here
The 3 basic functionalities provided are as follows:-
Let's the user to start a VM from an raw bzimage saved in the disk. Here's the complete workflow:-
Let's the user to take snapshot of a running VM and save the snapshot to disk. VM that is paused can further be exited or resumed depending on the user's request. Here's the complete workflow:-
Let's the user to run a VM from an already saved snapshot. Here's the complete workflow:-
We also provide the functionality to bypass the need of backend for testing purposes. The user can directly provide the port and bzimage/snapshot path to run the VM directly
The library is made entirely in rust. You need to install rust to use this library and packages mentioned in the Cargo.toml
file.
Install rust from here
- Clone the repo
git clone https://github.com/anirudhakulkarni/Live-Snapshot
- Install Rust packages
cargo build
Execute the following command to run the VM:-
vmm-reference
--kernel path=/path/to/vmlinux
--port <port_no>
[--memory_path <memory_snapshot_path>]
[--cpu_path <cpu_snapshot_path>]
[--block <blkdev_config>]
[--net <netdev_config>]
[--memory <guest_memory_size>]
[--vcpu <no_of_vcpus>]
The default configuration can be updated through the command line.
The crate's Cargo.toml
controls which VMM functionalities are
available. By default, all rust-vmm crates are listed as dependencies and
therefore included. Users can play freely with the building blocks by modifying
the TOML, and the prepackaged CLI can quickly validate the altered
configurations. Advanced users can, of course, plug in their own front-end.
Example usage:
cargo run -- --kernel path=bzimage_final8 --port 10010
cargo run -- --kernel path=bzimage_final8 --port 10010 --cpu_path cpu.txt --memory_path mem.txt
We demonstrate ability to pause and resume a Linux VM (focal fossa) running on a KVM hypervisor. We start a VM from a bzimage. We start a python script that prints a progress bar and then take a snapshot of the VM. We then transfer the state of the VM via USB to another machine and resume our snapshot from there. We then exit the VM. The previous commands, disk and output continues as previously. You may find the original video link
On i79750-H processor with 8GB RAM here are the benchmarks for a VM having 2 CPUs and 256MB RAM:-
Average over 100 runs | Standard deviation over 100 runs | |
---|---|---|
Boot time | 881.55 ms | 44.507 ms |
Restore from snapshot | 300.26 ms | 57.046 ms |
Snapshot time | 2.82 sec | 0.56sec |
Upon increasing memory size, time taken to take snapshot and restore time both increases linearly.
Distributed under the MIT License. See
LICENSE
for more information.
Anirudha - @4n1rudh4 - kulkarnianirudha8 [at] gmail [dot] com