libvirt snapshot does not save source in xml

Bug #1403841 reported by krypton
14
This bug affects 1 person
Affects Status Importance Assigned to Milestone
libvirt (Ubuntu)
Fix Released
High
Unassigned
Trusty
Fix Released
High
Unassigned

Bug Description

===================================================
SRU Justification:
1. Impact: a host reboot loses domain information after a external snapshot
2. Test case: see comment #2
3. Regression potential: this patch is a direct cherrypick from upstream with no churn. It should have no side effects.
===================================================

Ubuntu 14.04.1 tls trusty

Using library: libvirt 1.2.2
Using API: QEMU 1.2.2
Running hypervisor: QEMU 2.0.0

When you create a snapshot through "virsh snapshot-create-as" when a virtual machine is on,
then the source tag in the xml is changed.

But when you reboot the HOST, then the changes in the source tag are discared (the old/previous source path is used again).

I'v reproduced this bug on a clean Ubuntu 14.04 Trusty with fully updated packages.
Could not reproduce this on a 12.04 tls, so only 14.04 is affected (with libvirt version 1.2.2)

Reproduce:

- Create VM => vm.qcow2
- Start VM
- Create snashot (through snasphot-create-as) => snapshot.qcow2
- reboot the host
- now the old source path is used again => vm.qcow2

krypton (kryptonrules)
description: updated
krypton (kryptonrules)
description: updated
Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Thanks for reporting this bug. I'd like to reproduce it. Could you please show the full commands you are using, and attach the relevant xml files?

Changed in libvirt (Ubuntu):
status: New → Incomplete
Revision history for this message
krypton (kryptonrules) wrote :

Step to reproduce:

* qemu-img create -f qcow2 /vmimages/testserver/testserver.qcow2 10G

* virt-install --noreboot --accelerate --noautoconsole --boot cdrom,hd,network,menu=on --graphics vnc,listen=127.0.0.1 --name testserver --disk path=/vmimages/testserver/testserver.qcow2,sparse=false,format=qcow2,cache=none --disk bus=ide,device=cdrom --ram 1024 --connect qemu:///system --os-type= --vcpus=1,sockets=1,cores=1,threads=1 --arch=x86_64

* virsh start testserver

* virsh snapshot-create-as testserver 1419273333 --diskspec hda,file=/vmimages/testserver/testserver_1419273333.qcow2 --disk-only --atomic

* virsh edit testserver => source is: /vmimages/testserver/testserver_1419273333.qcow2

* (reboot host) /sbin/reboot

* virsh edit testserver => source is changed back to: /vmimages/testserver/testserver.qcow2

Bug seems to be only affected with snapshot-create-as I think...

xml file in attach.

Changed in libvirt (Ubuntu):
status: Incomplete → New
Revision history for this message
krypton (kryptonrules) wrote :

Hi Serge,

did you had the time to investigate this bug ?

note: I'd notice an update through apt-get of libvirt-bin (version 1.2.2 package 1.3.7 to 1.3.8), I'd tested it, but not solved.

Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Sorry, I have not, hopefully I can track down the regression next week. Can you confirm whether (a) this is basically the same as bug 1401570, and (b) whether like that bug it is fixed in 14.10?

Changed in libvirt (Ubuntu):
importance: Undecided → High
status: New → Triaged
Revision history for this message
krypton (kryptonrules) wrote :

Yes, this entry is the same as bug 1401570 (I could'nt find an option to delete that duplicate).

And I can confirm that this bug IS FIXED in 14.10 (libvirt 1.2.8)

Changed in libvirt (Ubuntu Trusty):
importance: Undecided → High
status: New → Confirmed
Changed in libvirt (Ubuntu):
status: Triaged → Fix Released
Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Seems like comit 9036b31aeddb could be a candidate for a fix.

Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Tested with that patch, but problem not solved.

Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Ah, I was misreading my results. That patch does solve this bug.

The remaining problem was that the snapshot was failing due to apparmor constraints. When the apparmor policy is re-calculated to add the permissions to the new snapshot, the permission to the underlying disk is removed. (I worked around it by adding /var/lib/libvirt/images/** rw to /etc/apparmor.d/libvirt/TEMPLATE)

Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

If I'm understanding the git log correctly, tracking of full backing
chains for disk sources is simply not yet implemented in 1.2.2. (See
commit 4f20226664 for the start of that feature). That sadly places the
apparmor issue out of scope for 14.04.

I will push a fix for the core issue (using commit 9036b31a) to trusty-proposed.
That will have to wait until the package currently baking gets proposed
to trusty-updates.

description: updated
Revision history for this message
krypton (kryptonrules) wrote :

Thanks for fixing the problem !
But how can we install the fix ? (I've updated my 14.04 to te latest version and bug still applied)

Or do we have to wait for the bug to be applied through apt?

Revision history for this message
Chris J Arges (arges) wrote : Please test proposed package

Hello krypton, or anyone else affected,

Accepted libvirt into trusty-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/libvirt/1.2.2-0ubuntu13.1.10 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in libvirt (Ubuntu Trusty):
status: Confirmed → Fix Committed
tags: added: verification-needed
Revision history for this message
krypton (kryptonrules) wrote :

I've tested the proposed package libvirt 1.2.2-0ubuntu13.1.10 on trusty and I can confirm that the bug is solved in this package number.

tags: added: verification-done
removed: verification-needed
krypton (kryptonrules)
Changed in libvirt (Ubuntu Trusty):
status: Fix Committed → Fix Released
status: Fix Released → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package libvirt - 1.2.2-0ubuntu13.1.10

---------------
libvirt (1.2.2-0ubuntu13.1.10) trusty-proposed; urgency=medium

  * 9035-qemu-snapshot-save-persistent-domain-config: upstream fix for a
    regression where persistent domain config was not saved after an external
    snapshot. (LP: #1403841)
  * 9036-dont-fail-without-cpu-model.patch: fix virsh safe with cpu mode =
    host-passthrough (LP: #1262641)
 -- Serge Hallyn <email address hidden> Tue, 10 Feb 2015 14:34:16 -0600

Changed in libvirt (Ubuntu Trusty):
status: Fix Committed → Fix Released
Revision history for this message
Adam Conrad (adconrad) wrote : Update Released

The verification of the Stable Release Update for libvirt has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.