[pve-devel] [PATCH 1/2] add is mounted check befor try to unmount disk.

Dietmar Maurer dietmar at proxmox.com
Wed Sep 2 18:40:07 CEST 2015


I would like to avoid running external programs for that.
Please can you try to use somethgink like:

PVE::Storage::NFSPlugin::read_proc_mounts()

Maybe we can move that function to PVE::ProcFSTools, and the is_mounted()
helper to PVE::Tools?

> +sub is_mounted {
> +    my ($mountpoint) = @_;
> +
> +    return !system("mount | grep -e \"$mountpoint \" > /dev/null");
> +}
> +
>  sub umount_all {
>      my ($vmid, $storage_cfg, $conf, $noerr) = @_;
>  
> @@ -1931,7 +1937,8 @@ sub umount_all {
>  	my $mount_path = "$rootdir/$mount";
>  	$mount_path =~ s!/+!/!g;
>  
> -	# fixme: test if mounted?
> +	return if !is_mounted($mount_path);
> +
>  	eval {
>  	    PVE::Tools::run_command(['umount', '-d', $mount_path]);
>  	};
> -- 
> 2.1.4
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 



More information about the pve-devel mailing list