virt-aa-helper: Call virCommandRawStatus()
commitb194c3d9c70c1d3b0a53b7fa792bf5b01504ddd9
authorAndrea Bolognani <abologna@redhat.com>
Mon, 19 Aug 2019 07:05:58 +0000 (19 09:05 +0200)
committerAndrea Bolognani <abologna@redhat.com>
Mon, 19 Aug 2019 13:47:05 +0000 (19 15:47 +0200)
tree03856cfca0ed7b4f8f126682af41200f35ceb916
parent7d3a0f56b8e5af383a7e3908bb4c2904fb907d3a
virt-aa-helper: Call virCommandRawStatus()

The way we're processing the return status, using WIFEXITED() and
friends, only works when we have the raw return status; however,
virCommand defaults to processing the return status for us. Call
virCommandRawStatus() before virCommandRun() so that we get the raw
return status and the logic can actually work.

This results in guest startup failures caused by AppArmor issues
being reported much earlier: for example, if virt-aa-helper exits
with an error we're now reporting

  error: internal error: cannot load AppArmor profile 'libvirt-b20e9a8e-091a-45e0-8823-537119e98bc6'

instead of the misleading

  error: internal error: Process exited prior to exec: libvirt:
  error : unable to set AppArmor profile 'libvirt-b20e9a8e-091a-45e0-8823-537119e98bc6'
  for '/usr/bin/qemu-system-x86_64': No such file or directory

Suggested-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/security/virt-aa-helper.c