From 5c8010ccef4dcc91d572ee09e5ce1c7cbf575581 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Mon, 20 Jun 2005 06:38:06 +0000 Subject: initial dmraid support --- perl-install/fs/dmraid.pm | 55 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 perl-install/fs/dmraid.pm (limited to 'perl-install/fs/dmraid.pm') 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; -- cgit v1.2.1