[libvirt-users] snapshot of running vm's

Dominique Ramaekers dominique.ramaekers at cometal.be
Wed Dec 2 12:33:31 UTC 2015



> -----Oorspronkelijk bericht-----
> Van: libvirt-users-bounces at redhat.com [mailto:libvirt-users-
> bounces at redhat.com] Namens Lentes, Bernd
> Verzonden: dinsdag 1 december 2015 16:31
> Aan: libvirt-ML
> Onderwerp: [libvirt-users] snapshot of running vm's
> 
> Hi,
> 
> i'd like to create snapshots of my running vm's. I have several hosts with
> SLES11 SP4 64bit. I use libvirt 1.2.5-7.1 . VM's are Windows 7, SLES, Ubuntu,
> Opensuse.
> I use raw files for the vm's.
> I try to orientate myself by
> http://wiki.libvirt.org/page/Live-disk-backup-with-active-blockcommit .
> The hosts are backuped every night by a network based backup solution
> (Legato).
> My idea is:
> 
> - delete any existing snapshot
> - create a new snapshot
> - of course before Legato arrives
> - then Legato might come and saves my snapshot
> - next night the same
> 
> 
> Questions:
> When I delete a snapshot, is it merged automatically with its base image ?
No

> Or is it something I have to do explicitly (maybe via blockcommit) ?
When using external snapshots, the procedure works like this:
1. Create external snapshot => a new file is created ex. 'image.qcow2'
2. Backup the original file ex. 'image.raw' (this file wil not change over time. All writes are done on image.qcow2).
3. Active block commit (commits all writes done on image.qcow2 to image.raw and activate image.raw)
4. delete image.qcow2

If you do a test, you can check which file is in use by 'virsh domblklist $VM'

> How can I get rid of the unused snapshot afterwards ? just rm ?
> Because I'm doing a live backup do I need to create an external snapshot ?
> To create an external snapshot do I have to provide --disk-only ?
Yes. And it's advisible to also use --quiesce to flush the guests disk cache (the guest agent needs to be installed and running on the guest)
And optional use --no-metadata to make shure libvirt isn't following up on these snapshots. This way you can just remove the image.qcow2 with rm

> Do I have to provide --live as a parameter ?
Yes, the snapshot is done on a live guest/disk

> I tried --quiesce but got that message:
> 
> virsh # snapshot-create --domain sles11 --atomic --disk-only --quiesce
> error: argument unsupported: QEMU guest agent is not configured The system
> I'm testing with is SLES11 SP4 (host and guest).  I installed the guest agent:
> 
> vm58820-8:~ # rpm -q qemu-guest-agent
> qemu-guest-agent-2.0.2-1.35
> Is there something I have to configure ?
Yes, you have to update the guest xml with 'virsh edit $VM' and enter these lines in the devices section
<channel type='unix'>
   <source mode='bind'>
   <target type='virtio' name='org.qemu.guest_agent.0'/>
</channel>

After this, it's possible the qemu guest agent is still not working, edit the xml again and change the port number in the line
to a free port (you'll see that for example spice is using the same controller, bus and port...)
<address type='virtio-serial' controller='0' bus='0' port='1'/>



> 
> Is this way of backup a good solution ? Is there something to improve,
This way you backup disk state. Most of the times this will be great. For some applications, this isn't sufficient.
For instance, a Autodesk Vault Server has a SQL database and a separate file storage. Using Active block commit to backup
will not guarantee data concistancy. That's why Autodesk has its own 'best practice'. Here I initiate the Autodesk procedure
through a powershell script (I connect to the guest with telnet).


> something I have to take care of ?
> Is this backup consistent ?
> Does that all work with libvirt 1.2.5-7.1 or do I need a more recent version
You'll need libvirt 1.2.9 or more and Qemu 2.1 (with higher qemu's I have experienced some trouble...)


> (what I don't like because I tried already to update my libvirt but had tons of
> dependencies) ?
> 
> I know. A lot of questions. But it's a backup, and I wanted to be sure that it
> operates properly.
> 
> Thanks.
> 
> 
> Bernd
> --
> Bernd Lentes
> 
> Systemadministration
> institute of developmental genetics
> Gebäude 35.34 - Raum 208
> HelmholtzZentrum München
> bernd.lentes at helmholtz-muenchen.de
> phone: +49 (0)89 3187 1241
> fax: +49 (0)89 3187 2294
> 
> Wer Visionen hat soll zum Hausarzt gehen Helmut Schmidt
> 
> 
> Helmholtz Zentrum Muenchen
> Deutsches Forschungszentrum fuer Gesundheit und Umwelt (GmbH)
> Ingolstaedter Landstr. 1
> 85764 Neuherberg
> www.helmholtz-muenchen.de
> Aufsichtsratsvorsitzende: MinDir'in Baerbel Brumme-Bothe
> Geschaeftsfuehrer: Prof. Dr. Guenther Wess, Dr. Nikolaus Blum, Dr. Alfons
> Enhsen
> Registergericht: Amtsgericht Muenchen HRB 6466
> USt-IdNr: DE 129521671
> 
> 
> _______________________________________________
> libvirt-users mailing list
> libvirt-users at redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-users




More information about the libvirt-users mailing list