+ my $dataset = $scfg->{pool};
+ my $pool = ($dataset =~ s!/.*$!!r);
+
+ my $dataset_mounted = sub {
+ my $mounted = 0;
+ my $dataset_dec = PVE::ProcFSTools::decode_mount($dataset);
+ my $mounts = eval { PVE::ProcFSTools::parse_proc_mounts() };
+ warn "$@\n" if $@;
+ foreach my $mp (@$mounts) {
+ my ($what, $dir, $fs) = @$mp;
+ next if $fs ne 'zfs';
+ # check for root-dataset of storage or any child-dataset.
+ # root-dataset could have 'canmount=off'. If any child is mounted
+ # heuristically assume that `zfs mount -a` was successful
+ next if $what !~ m!^$dataset_dec(?:/|$)!;
+ $mounted = 1;
+ last;
+ }
+ return $mounted;
+ };