[libvirt] [PATCH] qemu: snapshot: Keep non-persistent changes alive in snapshot

Madhu Pavan kmp at linux.vnet.ibm.com
Fri Oct 27 13:17:51 UTC 2017

On 10/27/2017 02:51 PM, Jiri Denemark wrote:
> On Fri, Oct 27, 2017 at 14:02:23 +0530, Kothapally Madhu Pavan wrote:
>> Restoring to a snapshot should not overwrite the persistent configuration
>> xml of a snapshot as a side effect. This patch fixes the same. Currently,
>> virDomainSnapshotDef only saves active domain definition of the guest.
>> And on restore the active domain definition is used as both active and
>> inactive domain definitions. Thiswill make the non-persistent changes
>> persistent in snapshot image. This patch allows to save inactive domain
>> definition as well and on snapshot-revert non-persistent configuration is
>> restored as is.
>> Currently, snapshot-revert is making non-presistent changes as persistent.
>> Here are the steps to reproduce.
>> Step1: virsh define $dom
>> Step2: virsh attach-device $dom $memory-device.xml --live
>> Step3: virsh snapshot-create $dom
>> Step4: virsh destroy $dom
>> Step5: virsh snapshot-revert $dom $snapshot-name
>> Step6: virsh destroy $dom
>> Step7: virsh start $dom
>> Here we still have $memory-device attached in Step2.
> I think this is actually a bit more complicated. When reverting to a
> snapshot, when reverting a snapshot we should revert both active and
> inactive configuration for backward compatibility and also because it
> makes sense. Imagine you made a snapshot of a running domain, played
> with the domain configuration and then reverted the state of the domain
> to the snapshot. Once you shutdown the domain and start it again you'd
> get a completely different machine. Of course, you actually may want
> such behavior. Thus we can't really guess whether a user wants to revert
> both active and inactive configuration or just one of them. The user
> should be able to tell us what to do (and we should revert both configs
> if no preference is given).
> However, for this to be really useful we need to store both active and
> inactive configurations when creating a snapshot of a running domain.
With the current behavior that I see from snapshot-list, I understood we 
categorize the snapshots
as "Active (running, paused)" or "config(shutoff)" depending if the 
snapshot was taken on an
active or inactive domain. With my use case what I observed was that the 
revert of active
snapshot actually overwriting inactive domain configuration. I thought 
only the "config" snapshot
alone can overwrite the inactive domain configuration. Hence this patch. 
Are you suggesting we
should have both active and inactive domain configurations to be saved 
for an active guest and
restore (both by default) OR (provide options to select)?

> Jirka

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20171027/54b143f3/attachment-0001.htm>

More information about the libvir-list mailing list