summaryrefslogtreecommitdiffstats
path: root/perl-install/patch/patch-2006-fix-parsing-dmraid.pl
blob: 4e42dde56d4392cda4e19bc3b1429887f092e7d9 (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
log::l("PATCH: 2006-fix-parsing-dmraid");

use fsedit;
package fsedit;

my $old_handle_dmraid = \&handle_dmraid;

undef *handle_dmraid;
*handle_dmraid = sub {
    my ($drives) = @_;

    @$drives > 1 or return;

    devices::make($_->{device}) foreach @$drives;

    require fs::dmraid;

    log::l("PATCH: 2006-fix-parsing-dmraid (inside handle_dmraid)");

    undef *fs::dmraid::_raid_devices_raw;
    *fs::dmraid::_raid_devices_raw = sub {
	map {
	    chomp;
	    log::l("got: $_");
	    my %l; @l{qw(pv format vg level status size)} = split(':');
	    if_(defined $l{size}, \%l);
	} fs::dmraid::call_dmraid('-ccr');
    };


    undef *fs::dmraid::_sets_raw;
    *fs::dmraid::_sets_raw = sub {
	map {
	    chomp;
	    log::l("got: $_");
	    my %l; @l{qw(name size stride level status subsets devs spares)} = split(':');
	    if_(defined $l{spares}, \%l);
	} fs::dmraid::call_dmraid('-ccs');
    };

    &$old_handle_dmraid;
};