Bug 1572295

Summary: RFE: virsh: Export snapshot to new VM (clone from snapshot)
Product: [Community] Virtualization Tools Reporter: Medic Momcilo <momcilo>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: NEW --- QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: eblake, libvirt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Medic Momcilo 2018-04-26 16:01:19 UTC
As far as I can tell, virsh snapshots contain enough information to create new VM from the snapshot (RAM and disk are saved).

When cloning from snapshot, we would get same results as we would when reverting to a snapshot, but in a new VM.

Main benefit would be easy backups.

We could just take snapshot and save it externally with ability to restore to it at any time.

Hope it's clear what the intention is behind this RFE.

I would gladly provide more information if needed.

Comment 1 Eric Blake 2018-04-26 16:23:00 UTC
It almost sounds like you are asking for a way to clone a new live VM from a snapshot of an existing live VM, while leaving the existing VM running.  This is extremely dangerous, as having two distinct VMs running at the same time, but sharing resources such as hostname, entropy pool, network connections, ... from the point in time where the snapshot was created, will create chaos if not security holes.  Cloning a new VM is best done on an offline VM, through specialized tools such as virt-sysprep, which handle all the implications of scrubbing the new VM to be distinct enough from the original.

If you are NOT asking for two parallel VMs, then you are merely asking for a way to revert back to the state recorded in a snapshot, but then you don't need a new VM.  And yes, being able to revert to a snapshot is a desirable property of any snapshot system (the fact that libvirt can currently do it for internal snapshots but not for external snapshots is a deficiency, already tracked in other bug reports).

At any rate, the act of properly cloning a VM (particularly a live one) involves too much knowledge about the contents of the guest being cloned, so that libvirt will never do that (rather, it's a task for tools higher in the stack, like virt-sysprep).