Reset non-persistent disk at every shutdown and more

Hello all!
I discovered this awesome project a few weeks ago, I need to replace the commercial VDI software I’ve been using for the last 10 years because the license cost has skyrocketed.

This software has some unique features I’m trying to replicate in ON. The VM resets at every shutdown/powerup cycle, they are defined by a golden image each (AKA a template), every time a user power up a VM the template is automatically instantiated, if it is the first time the user uses that VM, or just powered up otherwise, all the VMs instantiated from the same template shares a common disk image file, in the qemu-kvm command line is used the “-snapshot=on” option, so all the modifications made by the user to the disk are lost at the VM power down. This is a nice way to have plenty of non-persistent VMs using very little of disk space.

To replicate the space saving, after having created a VM template (golden image) with a persistent disk , instantiated it and installed the OS I create a backing file to the VM image disk, import it into the datastore as non-persistent disk and use it in a new VM template for the users instances. In this way every VM instance uses a the copy of the backing disk, which is just a few kB, and not of the full disk which is many GB.

In ON the VM disk is reset only when the VM is terminated, I need to reset it at every shutdown/powerup cycle.
Is there either a way to append the snapshot option to the qemu-kvm command line in ON, or is there a way to reset a non-persistent disk every time the VM is shutted down?

For the last feature, the auto-instantiation of the VM, I decided to associate the VM templates to every users and let them instantiate the VM by themself in the user web console, settings a maximum VM instances number for the users to avoid misusing
If you know a better way to do it I’m all ears!


Hello @dariogg, it’s great to see you giving OpenNebula a try.

I noticed that you’ve managed the resources properly. Now, let’s talk about the disk reset functionality. You can easily accomplish this by using the “recover + recreate” action in OpenNebula. It’s available both in the web interface and the command line. If you choose the command line option, simply execute the following command: “onevm recover --recreate ”. By doing this, instead of a normal boot, the virtual machine will receive a command to recreate itself, resulting in a reset of the disk image as well.