summaryrefslogtreecommitdiffstats
path: root/perl-install/fs/dmraid.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2005-06-20 06:38:06 +0000
committerPascal Rigaux <pixel@mandriva.com>2005-06-20 06:38:06 +0000
commit5c8010ccef4dcc91d572ee09e5ce1c7cbf575581 (patch)
tree79155bc13a056fee32077819a34692198b6b4984 /perl-install/fs/dmraid.pm
parenta00c3995a27103b97534c3957dff9441874fd9ce (diff)
downloaddrakx-5c8010ccef4dcc91d572ee09e5ce1c7cbf575581.tar
drakx-5c8010ccef4dcc91d572ee09e5ce1c7cbf575581.tar.gz
drakx-5c8010ccef4dcc91d572ee09e5ce1c7cbf575581.tar.bz2
drakx-5c8010ccef4dcc91d572ee09e5ce1c7cbf575581.tar.xz
drakx-5c8010ccef4dcc91d572ee09e5ce1c7cbf575581.zip
initial dmraid support
Diffstat (limited to 'perl-install/fs/dmraid.pm')
-rw-r--r--perl-install/fs/dmraid.pm55
1 files changed, 55 insertions, 0 deletions
diff --git a/perl-install/fs/dmraid.pm b/perl-install/fs/dmraid.pm
new file mode 100644
index 000000000..1a0268014
--- /dev/null
+++ b/perl-install/fs/dmraid.pm
@@ -0,0 +1,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;