[pve-devel] [PATCH pve-container 2/9] extract umount mountpoint form umount_all
Wolfgang Link
w.link at proxmox.com
Wed Nov 18 09:29:59 CET 2015
so there is also the capability to single mp
---
src/PVE/LXC.pm | 31 ++++++++++++++++++++-----------
1 file changed, 20 insertions(+), 11 deletions(-)
diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index beec884..d6cea24 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -2022,6 +2022,25 @@ sub check_ct_modify_config_perm {
return 1;
}
+sub umount_mp {
+ my($mount_path, $noerr) = @_;
+
+ return if !PVE::ProcFSTools::is_mounted($mount_path);
+
+ eval {
+ PVE::Tools::run_command(['umount', '-d', $mount_path]);
+ };
+ if (my $err = $@) {
+ if ($noerr) {
+ warn $err;
+ } else {
+ die $err;
+ }
+ }
+
+ return undef;
+}
+
sub umount_all {
my ($vmid, $storage_cfg, $conf, $noerr) = @_;
@@ -2039,18 +2058,8 @@ sub umount_all {
my $mount_path = "$rootdir/$mount";
$mount_path =~ s!/+!/!g;
- return if !PVE::ProcFSTools::is_mounted($mount_path);
+ $umount_mp($mount_path, $noerr);
- eval {
- PVE::Tools::run_command(['umount', '-d', $mount_path]);
- };
- if (my $err = $@) {
- if ($noerr) {
- warn $err;
- } else {
- die $err;
- }
- }
});
}
--
2.1.4
More information about the pve-devel
mailing list