[libvirt] [PATCH 2/2] lxc: Clean up /.oldroot

Radostin Stoyanov rstoyanov1 at gmail.com
Sun Apr 15 15:30:11 UTC 2018


Remove the /.oldroot directory after it has been unmounted (at the end
of lxcContainerSetupPivotRoot). Ignore errors silently.

Signed-off-by: Radostin Stoyanov <rstoyanov1 at gmail.com>
---
 src/lxc/lxc_container.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index 665b93a0a..dd4e38703 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -1811,6 +1811,9 @@ static int lxcContainerSetupPivotRoot(virDomainDefPtr vmDef,
     if (lxcContainerUnmountSubtree("/.oldroot", true) < 0)
         goto cleanup;
 
+    if (virFileRemove("/.oldroot", 0, 0) < 0)
+        VIR_DEBUG("Failed to remove /.oldroot after start");
+
     ret = 0;
 
  cleanup:
-- 
2.14.3




More information about the libvir-list mailing list