Bug 497131

Summary: svirt fails to relabel qcow2 backing files
Product: [Fedora] Fedora Reporter: Mark McLoughlin <markmc>
Component: libvirtAssignee: Mark McLoughlin <markmc>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: berrange, clalance, crobinso, dwalsh, itamar, jbao, veillard, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-10-02 11:23:05 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On:    
Bug Blocks: 498969    

Description Mark McLoughlin 2009-04-22 09:41:38 EDT
If you create a qcow2 image with a backing file:

  $> qemu-img create -b f11-beta.qcow2 -f qcow2 f11-beta.snap1.qcow2

and configure a domain to use it:

    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/f11-beta.snap2.qcow2'/>
      <target dev='hda' bus='ide'/>

and start it:

  $>  virsh start f11-beta
  error: Failed to start domain f11-beta
  error: internal error unable to start guest: qemu: could not open disk image /var/lib/libvirt/images/f11-beta.snap2.qcow2

type=AVC msg=audit(1240410685.659:86): avc:  denied  { read } for  pid=9537 comm="qemu-kvm" name="f11-beta.qcow2" dev=dm-0 ino=3466427 scontext=system_u:system_r:svirt_t:s0:c280,c287 tcontext=system_u:object_r:virt_image_t:s0 tclass=file

The problem is obvious - we're re-labelling the qcow2 image, but not its backing file.

Note, the backing file should be read-only for all guests which use a qcow2 image backed by it.
Comment 1 Bug Zapper 2009-06-09 10:24:30 EDT
This bug appears to have been reported against 'rawhide' during the Fedora 11 development cycle.
Changing version to '11'.

More information and reason for this action is here:
Comment 2 Mark McLoughlin 2009-09-24 03:25:04 EDT
*** Bug 525362 has been marked as a duplicate of this bug. ***
Comment 3 Mark McLoughlin 2009-09-25 09:31:07 EDT
Patches posted upstream for this:


It's fairly invasive so, while I'll backport it to F12, I won't be backporting it to F11.
Comment 4 Mark McLoughlin 2009-10-01 11:19:17 EDT
Okay, I've backported this to F-12 and will build it later today

* Thu Oct  1 2009 Mark McLoughlin <markmc@redhat.com> - 0.7.1-8
- Re-label qcow2 backing files (#497131)

Patch is http://gitorious.org/~markmc/libvirt/fedora/commit/5bb2da190b
Comment 5 Mark McLoughlin 2009-10-02 11:23:05 EDT
This is in rawhide now