Skip to content

Live snapshot functionality for VMs on vmm-reference codebase. Pause and play VMs with a click!

License

Apache-2.0, BSD-3-Clause licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
BSD-3-Clause
LICENSE-BSD-3-CLAUSE
Notifications You must be signed in to change notification settings

anirudhakulkarni/Live-Snapshot

Live Snapshot and Restore

A KVM based service to save snapshot of a running VM and restore VM from saved snapshot
Report Bug

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Demo
  5. Result
  6. License

About The Project

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:-

  1. Starting an VM

Let's the user to start a VM from an raw bzimage saved in the disk. Here's the complete workflow:-

  1. Saving the snapshot

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:-

  1. Restoring VM from snapshot

Let's the user to run a VM from an already saved snapshot. Here's the complete workflow:-

(back to top)

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

Getting Started

The library is made entirely in rust. You need to install rust to use this library and packages mentioned in the Cargo.toml file.

Prerequisites

Install rust from here

Installation

  1. Clone the repo
    git clone https://github.com/anirudhakulkarni/Live-Snapshot
  2. Install Rust packages
     cargo build

(back to top)

Usage

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:

  1. Running from bzimage

cargo run -- --kernel path=bzimage_final8 --port 10010  
  1. Running from snapshot

cargo run -- --kernel path=bzimage_final8 --port 10010 --cpu_path cpu.txt --memory_path mem.txt

(back to top)

Demo

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

Results

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

Save and Restore time

Upon increasing memory size, time taken to take snapshot and restore time both increases linearly.

(back to top)

License

Distributed under the MIT License. See LICENSE for more information.

(back to top)

Contact

Anirudha - @4n1rudh4 - kulkarnianirudha8 [at] gmail [dot] com

About

Live snapshot functionality for VMs on vmm-reference codebase. Pause and play VMs with a click!

Resources

License

Apache-2.0, BSD-3-Clause licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
BSD-3-Clause
LICENSE-BSD-3-CLAUSE

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published