I see your point. I did a quick research and it seems to be a limitation on virt-aa-helper:
root@orpiske:/etc/libvirt/qemu# cat ubuntu_12_04\ with\ spaces.xml | /usr/lib/libvirt/virt-aa-helper -d -p 0 -r -u libvirt-61d77fad-bb1f-49fa-93e1-2b70a5cb8f4c ; echo $?
virt-aa-helper: error: bad name
virt-aa-helper: error: could not get VM definition
1
Whereas, this works:
root@orpiske:/etc/libvirt/qemu# cat ubuntu_12_04.xml | /usr/lib/libvirt/virt-aa-helper -d -p 0 -r -u libvirt-d020c07a-b8d5-40f3-b02b-3df5ed6d06b3 ; echo $?
virt-aa-helper:
/etc/apparmor.d/libvirt/libvirt-d020c07a-b8d5-40f3-b02b-3df5ed6d06b3.files
virt-aa-helper:
"/var/log/libvirt/**/ubuntu_12_04.log" w,
"/var/lib/libvirt/**/ubuntu_12_04.monitor" rw,
"/var/run/libvirt/**/ubuntu_12_04.pid" rwk,
"/run/libvirt/**/ubuntu_12_04.pid" rwk,
"/var/run/libvirt/**/*.tunnelmigrate.dest.ubuntu_12_04" rw,
"/run/libvirt/**/*.tunnelmigrate.dest.ubuntu_12_04" rw,
"/var/lib/libvirt/images/d020c07a-b8d5-40f3-b02b-3df5ed6d06b3-0.img" rw,
"/home/orpiske/vms/isos/ubuntu-12.04.3-desktop-i386.iso" r,
# don't audit writes to readonly files
deny "/home/orpiske/vms/isos/ubuntu-12.04.3-desktop-i386.iso" w,
0
I decided to dig further and I took a look at virt-aa-helper source code and it does, indeed, check if the name does not contain spaces (as well as one of /, [, ] and *). Because of that, it seems that it's unable to load/recreate (?) the profile.
Does it make sense to you? And, if yes, what would you suggest as an appropriate work-around in this case?