[pve-devel] [PATCH pve-container 3/9] add function umount_raw_file
Dietmar Maurer
dietmar at proxmox.com
Wed Nov 18 11:45:38 CET 2015
This looks a bit strange to me, because
1.) we use 'umount' with -d flag, so there is no need to call losetup -d
2.) You should use avtivate_volume/deactivate_volume instead of
directly calling rbd commands.
> +sub umount_raw_file {
> + my ($mountpoint, $dev, $mounted) = @_;
> +
> + if ($mounted) {
> + umount_mp($mountpoint, 1);
> + }
> +
> + if ($dev) {
> + if (($dev =~ m!^/dev/loop\d+!) && !$mounted) {
> +
> + PVE::Tools::run_command(['losetup', '-d', $dev]);
> + warn $@ if $@;
> +
> + } elsif ($dev =~ m!^/dev/rbd\d+!) {
> +
> + PVE::Tools::run_command(['rbd', 'unmap', $dev]);
> + warn $@ if $@;
> +
> + }
> + }
> +}
> +
> sub umount_mp {
> my($mount_path, $noerr) = @_;
>
> --
> 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