[Libvir] save/restore support for KVM

Daniel P. Berrange berrange at redhat.com
Fri Aug 10 16:55:03 UTC 2007


On Fri, Aug 10, 2007 at 12:36:05PM -0400, Jim Paris wrote:
> Daniel Veillard wrote:
> > On Thu, Aug 09, 2007 at 10:55:10PM +0100, Daniel P. Berrange wrote:
> > > Just been committed to KVM repos I see. Should be an easy patch to backport
> > > too. As long as we can detect failure if this is missing & report it back 
> > > then I'm fine depending on this.
> > 
> >   Would checking for the kvm version from the console sufficient ? Since KVM
> > makes even more releases than libvirt in average I guess that would be 
> > fine.
> 
> I'm not sure the kvm qemu binary even reports the kvm version
> anywhere.  I'll ask on kvm-devel to see if qemu/VERSION could get
> updated with each KVM release.
> 
> > > > - I append the domain's UUID at the end of the migration image. 
> > > >   This doesn't affect KVM at all (it ignores the extra data).
> > > >   Does that seem reasonable?  It's unclear how the saved image
> > > >   is supposed to get associated with a particular VM configuration
> > > >   without doing something like this.
> > > 
> > > Actually I'd store the entire XML config appended to the end of the image.
> > > Its quite possible the saved image may be restored on a different machine
> > > so libvirt will need the XML config there & its not much work to automatically
> > > append it all & use it when restoring later.
> > 
> >   +1 . The only problem is that the XML has no predefined size, so it may be
> > hard to stack more stuff behind it. I would ask first on the KVM list to check
> > if it's okay to add a variable lenght data structure at the end, they might
> > want to extend it in the future and that would be hard to handle.
> 
> I think appending unrelated data to the migration image is a bit of a
> hack anyway.  A better plan would be a file containing
>   <header> <XML config> <migration data>
> 
> On save, libvirt writes <header> and <XML config>, then closes it and
> uses "dd of=path oflag=append conv=notrunc" or just "cat >> path" as
> the migration command.
> 
> On restore, libvirt reads the header and XML config, and then
> feeds the remaining migration data to KVM using "-incoming stdio".
> I had wanted to avoid the trouble of feeding data via stdin, but
> maybe a well placed dup2(fd,STDIN_FILENO) would do the trick
> automatically.

That sounds like a reasonable plan

> This file format would also make it easier for e.g. virt-manager to
> determine that a file is a valid libvirt restore image.

A little magic in the first couple of bytes would be handy - thats what
we check currently for Xen.

Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 




More information about the libvir-list mailing list