<div dir="ltr"><div>Hi,</div><div>there is a behavioral change I try to track down that affects virt-aa-helper.</div><div><br></div><div>TL;DR:</div><div>- it seems backingStore info gets added "later" in recent versions which causes issues in virt-aa-helper</div><div><br></div><div>Details:</div><div>For a guest containing a qcow2 disk like this:</div><div>    <disk type='file' device='disk'></div><div>      <driver name='qemu' type='qcow2'/></div><div>      <source file='/var/lib/uvtool/libvirt/images/kvmguest-artful-normal.qcow'/></div><div>      <target dev='vda' bus='virtio'/></div><div>    </disk></div><div>    </div><div>And said qcow disk having a backing file:</div><div>$ qemu-img info /var/lib/uvtool/libvirt/images/kvmguest-artful-normal.qcow</div><div>image: /var/lib/uvtool/libvirt/images/kvmguest-artful-normal.qcow</div><div>[...]</div><div>backing file: /var/lib/uvtool/libvirt/images/x-uvt-b64-Y29tLnVidW50dS5jbG91ZC5kYWlseTpzZXJ2ZXI6MTcuMTA6cHBjNjRlbCAyMDE3MDcxMw==</div><div><br></div><div>Now when instantiating the guest this gets the backingStore info added like:</div><div>      <backingStore type='file' index='1'></div><div>        <format type='qcow2'/></div><div>        <source file='/var/lib/uvtool/libvirt/images/x-uvt-b64-Y29tLnVidW50dS5jbG91ZC5kYWlseTpzZXJ2ZXI6MTcuMTA6cHBjNjRlbCAyMDE3MDcxMw=='/></div><div>        <backingStore/></div><div>      </backingStore></div><div><br></div><div>But this now seems to come in "too late" for virt-aa-helper.</div><div>That tool is reading the guest definition to create custom rules for that guest that opens up the apparmor profile.</div><div>And in relation to the devices the following in src/security/virt-aa-helper.c is the important part:</div><div>Loops over disks and in those "down" the chain of backing stores:</div><div> 929     for (i = 0; i < ctl->def->ndisks; i++) {</div><div> [...]</div><div> 947         if (virDomainDiskDefForeachPath(disk, true, add_file_path, &buf) < 0)</div><div><br></div><div>If you pass virt-aa-helper as in libvirt 3.5 a full snippet with backingStore info it behaves the same as back in 2.5 emmitting a rule for the backing store.</div><div>But when starting a guest on libvirt 3.5 this does no more work, so it seems that on instantiating the guest</div><div>Past (2.5)</div><div>1. add backingStore info to guest representation</div><div>2. virt-aa-helper parses guest representation and creates rules</div><div>3. guest starts fine</div><div><br></div><div>changed to now (3.5):</div><div>1. virt-aa-helper parses guest representation and creates rules</div><div>2. add backingStore info to guest representation</div><div>3. guest fails to start as the apparmor rule to allow it access to its backing file is missing.</div><div><br></div><div>I've verified that recent libvirt properly adds the backingStore eventually (by disabling the apparmor profile and then starting the guest). Once fully started the live xml representation has the backing store info added.</div><div>But as outlined above, at the point virt-aa-helper runs now the necessary backingStore data seems to be missing.</div><div><br></div><div>I couldn't find the related change or a way to fix it so far, so any hints are welcome.</div><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><span style="color:rgb(136,136,136);font-size:12.8px">Christian Ehrhardt</span><div style="color:rgb(136,136,136);font-size:12.8px">Software Engineer, Ubuntu Server</div><div style="color:rgb(136,136,136);font-size:12.8px">Canonical Ltd</div></div></div></div></div>
</div>