blob: 1a02680144e523743c475d8ed25f75f121358d9b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
package fs::dmraid; # $Id$
use diagnostics;
use strict;
#-######################################################################################
#- misc imports
#-######################################################################################
use common;
use modules;
use devices;
use fs::type;
use run_program;
init() or log::l("dmraid::init failed");
sub init() {
eval { modules::load('dm-mirror') };
devices::init_device_mapper();
if ($::isInstall) {
run_program::run('dmraid', '-ay');
}
1;
}
sub check {
my ($in) = @_;
$in->do_pkgs->ensure_binary_is_installed('dmraid', 'dmraid') or return;
init();
1;
}
sub pvs_and_vgs() {
map {
my @l = split(':');
{ pv => $l[0], format => $l[1], vg => $l[2], level => $l[3], status => $l[4] };
} run_program::get_stdout('dmraid', '-rcc');
}
sub vgs() {
map {
my $dev = "mapper/$_->{vg}";
my $vg = fs::subpart_from_wild_device_name("/dev/$dev");
add2hash($vg, { media_type => 'hd', prefix => $dev, bus => "dm_$_->{format}" });
$vg;
} grep { $_->{status} eq 'ok' } uniq_ { $_->{vg} } pvs_and_vgs();
}
sub pvs() {
map { $_->{pv} } grep { $_->{status} eq 'ok' } pvs_and_vgs();
}
1;
|