File no-unmount-for-lxc-machines.patch of Package virt-sandbox

From d4dcfc61a2828253239e28d114f5194d94f128fb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= <cbosdonnat@suse.com>
Date: Mon, 11 Dec 2017 18:34:04 +0100
Subject: [sandbox] init: no unmount for lxc machines

An lxc machine tries to unmount all host mounts when shutting down.
When the machine is running confined by apparmor, this results in
a flurry of denied unmout messages that are uninportant.

To avoid this, only do the unmount for the qemu machines.
---
 libvirt-sandbox/libvirt-sandbox-init-common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: libvirt-sandbox-0.6.0/libvirt-sandbox/libvirt-sandbox-init-common.c
===================================================================
--- libvirt-sandbox-0.6.0.orig/libvirt-sandbox/libvirt-sandbox-init-common.c
+++ libvirt-sandbox-0.6.0/libvirt-sandbox/libvirt-sandbox-init-common.c
@@ -595,7 +595,8 @@ static GVirSandboxRPCPacket *gvir_sandbo
      * opportunistically sync + unmount here too.
      */
     sync_data();
-    umount_fs();
+    if (!getenv("LIBVIRT_LXC_UUID"))
+        umount_fs();
 
     if (!gvir_sandbox_rpcpacket_encode_header(pkt, error))
         goto error;
@@ -1453,7 +1454,7 @@ int main(int argc, char **argv) {
 
     sync_data();
 
-    if (poweroff) {
+    if (poweroff && !getenv("LIBVIRT_LXC_UUID")) {
         umount_fs();
         reboot(RB_POWER_OFF);
         /* Should not be reached, but if it is, kernel will panic anyway */
openSUSE Build Service is sponsored by