Comment 8 for bug 1004606

Revision history for this message
Davide Guerri (davide-guerri) wrote :

The path, excluding extension, is the same as the original image.
Unfortunately the extension can be chosen by the user:

"Name
The name for this snapshot. If the name is specified when initially creating the snapshot, then the snapshot will have that particular name. If the name is omitted when initially creating the snapshot, then libvirt will make up a name for the snapshot, based on the time when it was created."
  (from http://libvirt.org/formatsnapshot.html) with the name parameter)

Assuming my_dom disk image is stored under /nfs/diskimages/my_dom.img, a command like the following:

# snapshot-create-as my_dom my_snap --disk-only

will create /nfs/diskimages/my_dom.my_snap changing domain definition XML to use this file instead of /nfs/diskimages/my_dom.img (/nfs/diskimages/my_dom.img will be a backing file for /nfs/diskimages/my_dom.my_snap)

However I fear it's not that simple because even if I try to use a snapshot name like mysnap.img, snaphot still fails because the original image name is removed from the apparmour profile dinamically created/maintained by libvirt under /etc/apparmor.d/libvirt. The original filename is replaced with the new image name.

So, to sum up, I think the following might be needed in order to make disk-only snapshot work

 1) virt-aa-helper (/etc/apparmor.d/usr.lib.libvirt.virt-aa-helper) should be able to read virtual machine image files even if the extension isn't imq/qcow2/...
 2) dynamically created profiles for libvirt (/etc/apparmor.d/libvirt/libvirt-XXXX.files) should retain the old image filename

Please, be aware that after the "snapshot-create" command fails, the corresponding profile under /etc/apparmor.d/libvirt/ isn't coherent anymore with the real filename for virtual images.