]> git.proxmox.com Git - pve-container.git/commitdiff
vzdump:lxc: unshare mount namespace
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Thu, 17 Sep 2015 11:07:00 +0000 (13:07 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 17 Sep 2015 11:51:42 +0000 (13:51 +0200)
Enter a new mount namespace for stop and snapshot backups
where we need to mount the container to a temporary
location.

src/PVE/VZDump/LXC.pm

index c9a75dd5fa8c0505cdf4326fba5b8cb13a00a26f..2d4b85a84204c44104e266672f13e421a9c9005f 100644 (file)
@@ -152,6 +152,13 @@ sub prepare {
     } else {
        die "unknown mode '$mode'\n"; # should not happen
     }
+
+    if ($mode ne 'suspend') {
+       # If we preform mount operations, let's unshare the mount namespace
+       # to not influence the running host.
+       PVE::Tools::unshare(PVE::Tools::CLONE_NEWNS);
+       PVE::Tools::run_command(['mount', '--make-rprivate', '/']);
+    }
 }
 
 sub lock_vm {