Andrew Martin
2015-Apr-14 15:17 UTC
[libvirt-users] Update on-disk XML after virsh snapshot-create-as
Hello, I am using "virsh snapshot-create-as" to create external snapshots of running VMs using libvirt 1.0.2 on Ubuntu 12.04 and libvirt 1.2.2 on Ubuntu 14.04. This works well for creating the snapshots, but I notice that the on-disk XML file in /etc/libvirt/qemu is not updated with the new disk image file after the snapshot is created. This appears to be very similar to https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1403841, but occurs on both 12.04 and 14.04 so I am not sure it is the same bug. This presents a problem if the virtual machine host is suddenly powered off since a subsequent boot will find the VM using an older image file to boot rather than the most recent snapshot. Is it safe for me to use an external wrapper script that does the following to ensure the on-disk XML is up-to-date: virsh snapshot-create-as .... virsh dumpxml > /etc/libvirt/qemu/<domain>.xml Is it safe for me to overwrite the contents of /etc/libvirt/qemu/<domain>.xml manually while the VM is running? Thanks, Andrew Martin
Eric Blake
2015-Apr-14 15:26 UTC
Re: [libvirt-users] Update on-disk XML after virsh snapshot-create-as
On 04/14/2015 09:17 AM, Andrew Martin wrote:> Hello, > > I am using "virsh snapshot-create-as" to create external snapshots of running > VMs using libvirt 1.0.2 on Ubuntu 12.04 and libvirt 1.2.2 on Ubuntu 14.04. This > works well for creating the snapshots, but I notice that the on-disk XML file > in /etc/libvirt/qemu is not updated with the new disk image file after the > snapshot is created. This appears to be very similar to > https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1403841, but occurs on > both 12.04 and 14.04 so I am not sure it is the same bug.There have been some bug fixes in newer libvirt; for example, commit 9f97485 (v1.2.12) is relevant. I'm not sure why your vendor is not backporting these fixes to the build shipped in Ubuntu, but you can manually run a newer libvirt to work around the problem.> > This presents a problem if the virtual machine host is suddenly powered off > since a subsequent boot will find the VM using an older image file to boot > rather than the most recent snapshot. Is it safe for me to use an external > wrapper script that does the following to ensure the on-disk XML is up-to-date: > virsh snapshot-create-as .... > virsh dumpxml > /etc/libvirt/qemu/<domain>.xmlNo. That is not safe.> > Is it safe for me to overwrite the contents of /etc/libvirt/qemu/<domain>.xml > manually while the VM is running?Not at all. http://wiki.libvirt.org/page/FAQ#Where_are_VM_config_files_stored.3F_How_do_I_edit_a_VM.27s_XML_config.3F Instead, if you are still suffering from a build of libvirt that fails to update the files in /etc when taking a snapshot, do some other action that DOES update /etc (such as changing the domain description), or at a bare minimum use 'virsh define' instead of manually writing into /etc yourself. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Andrew Martin
2015-Apr-14 15:51 UTC
Re: [libvirt-users] Update on-disk XML after virsh snapshot-create-as
----- Original Message -----> From: "Eric Blake" <eblake@redhat.com> > To: "Andrew Martin" <amartin@xes-inc.com>, libvirt-users@redhat.com > Sent: Tuesday, April 14, 2015 10:26:50 AM > Subject: Re: [libvirt-users] Update on-disk XML after virsh snapshot-create-as > > On 04/14/2015 09:17 AM, Andrew Martin wrote: > > Hello, > > > > I am using "virsh snapshot-create-as" to create external snapshots of > > running > > VMs using libvirt 1.0.2 on Ubuntu 12.04 and libvirt 1.2.2 on Ubuntu 14.04. > > This > > works well for creating the snapshots, but I notice that the on-disk XML > > file > > in /etc/libvirt/qemu is not updated with the new disk image file after the > > snapshot is created. This appears to be very similar to > > https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1403841, but occurs > > on > > both 12.04 and 14.04 so I am not sure it is the same bug. > > There have been some bug fixes in newer libvirt; for example, commit > 9f97485 (v1.2.12) is relevant. I'm not sure why your vendor is not > backporting these fixes to the build shipped in Ubuntu, but you can > manually run a newer libvirt to work around the problem.I am unaware of a 3rd-party vendor that backports newer releases of libvirt for Ubuntu - is there one you would recommend? Currently, for 14.04 I am using the packages from the Ubuntu repository, and for 12.04 I built newer versions of libvirt myself in this PPA: https://launchpad.net/~xespackages/+archive/ubuntu/virtualization Is there a better way to keep up-to-date with libvirt releases on Ubuntu LTS?> > > > > This presents a problem if the virtual machine host is suddenly powered off > > since a subsequent boot will find the VM using an older image file to boot > > rather than the most recent snapshot. Is it safe for me to use an external > > wrapper script that does the following to ensure the on-disk XML is > > up-to-date: > > virsh snapshot-create-as .... > > virsh dumpxml > /etc/libvirt/qemu/<domain>.xml > > No. That is not safe. > > > > > Is it safe for me to overwrite the contents of > > /etc/libvirt/qemu/<domain>.xml > > manually while the VM is running? > > Not at all. > http://wiki.libvirt.org/page/FAQ#Where_are_VM_config_files_stored.3F_How_do_I_edit_a_VM.27s_XML_config.3F > > Instead, if you are still suffering from a build of libvirt that fails > to update the files in /etc when taking a snapshot, do some other action > that DOES update /etc (such as changing the domain description), or at a > bare minimum use 'virsh define' instead of manually writing into /etc > yourself. >Thanks for this clarification. It looks like the following would update both the running and on-disk configs? virsh desc <domain> --config --live --new-desc "<new description here>" Thanks, Andrew
Apparently Analagous Threads
- Re: Update on-disk XML after virsh snapshot-create-as
- Re: Update on-disk XML after virsh snapshot-create-as
- Can't specify filename.xml when using virsh dumpxml
- virsh snapshot-create and blockcopy
- libvirtd does not update VM .xml configurations on filesystem after virsh snapshot/blockcommit