[libvirt] [PATCH] qemu: Do not override config XML in case of snapshot revert

Maxiwell S. Garcia maxiwell at linux.ibm.com
Wed May 15 15:22:28 UTC 2019


On Tue, May 14, 2019 at 09:38:12AM -0500, Eric Blake wrote:
> On 5/14/19 8:37 AM, Michal Privoznik wrote:
> > On 5/13/19 8:48 PM, Daniel Henrique Barboza wrote:
> >> Tried to reproduce the error using my x86 laptop but got hit by
> >> https://bugzilla.redhat.com/show_bug.cgi?id=1689216 when trying
> >> to create the snapshot using upstream code:
> >>
> 
> > 
> > Actually, I think that this is not the proper fix. The proper fix would
> > be to store both active AND inactive XMLs when creating a snapshot and
> > then restore them both on snapshot revert. While this fix may fix one
> > use case, it's not dealing with the issue properly IMO. But I'm not
> > snapshot expert really.
> 
> Sadly, if we were to modify snapshot XML to store both the active and
> inactive XML with a snapshot, all existing snapshots of a running guest
> would be incomplete (right now, the snapshot XML only allows the storage
> of a single <domain> sub-element).  I think the best we can do is store
> an active XML with a snapshot of an active domain, and an inactive XML
> with a snapshot of an offline domain. Reverting to an offline snapshot
> only has to worry about inactive XML; reverting to an online snapshot
> needs the active XML to properly restore the domain, but we then have to
> decide whether to also update the inactive XML to match the fact that
> the active XML has changed. So changing both inactive and active XML to
> describe the same state during a revert to a snapshot of an active
> domain seems like the best approach to me, short of rewriting snapshot
> XML to store two different domain definitions at once.
> 

Hi Eric,

The actual behavior of ‘snapshot revert’ changes both inactive and active
XML to describe the same state saved in the ‘snapshot create’.
The steps below were commented in a bugzilla:

1. Create a guest say VM1
2. Attach a virtual NIC to the guest :
    virsh attach-device VM1 network.xml --live
    interface will be seen in the guest.
3. Take a snapshot of the guest :
    virsh snapshot-create VM1
    Domain snapshot 1505299135 created
4. Destroy the guest
5. Now, revert back the snapshot:
    virsh snapshot-revert VM1 1505299135
    Interface is seen in the guest.
6. Now destroy the guest and start it again
Interface is still seen in the guest.
It is making the attach persistent.

So, after a revert, the guest always loses the inactive configuration.
Why do you think this behavior is the best approach?


> -- 
> Eric Blake, Principal Software Engineer
> Red Hat, Inc.           +1-919-301-3226
> Virtualization:  qemu.org | libvirt.org
> 






More information about the libvir-list mailing list