summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2005-02-16 12:36:07 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2005-02-16 12:36:07 +0000
commit1f95f7f4122d16ee2db2702a67a69a7063e900bb (patch)
treeb31b778f106c9eaafc3956b0d6546881bc21c0f4
parent4fcd3702b1c6b9a745cc0399526bb78c4507847c (diff)
downloadcontrol-center-1f95f7f4122d16ee2db2702a67a69a7063e900bb.tar
control-center-1f95f7f4122d16ee2db2702a67a69a7063e900bb.tar.gz
control-center-1f95f7f4122d16ee2db2702a67a69a7063e900bb.tar.bz2
control-center-1f95f7f4122d16ee2db2702a67a69a7063e900bb.tar.xz
control-center-1f95f7f4122d16ee2db2702a67a69a7063e900bb.zip
update
-rw-r--r--ChangeLog10
1 files changed, 9 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index c86d0bc8..43b0886f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,12 @@
-2005-02-15 20:45 Thierry Vignaud <tvignaud@mandrakesoft.com>
+2005-02-15 20:50 tvignaud
+
+ * credits2po: update
+
+2005-02-15 20:45 tvignaud
+
+ * ChangeLog: [no log message]
+
+2005-02-15 20:45 tvignaud
* drakconf.spec: 10.2-0.7mdk
/a> 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286
package raid; # $Id$

use diagnostics;
use strict;

#-######################################################################################
#- misc imports
#-######################################################################################
use common;
use fs::type;
use fs::get;
use run_program;
use devices;
use modules;

sub max_nb() { 31 }

sub check_prog {
    my ($in) = @_;
    $::prefix ? whereis_binary('mdadm') : $in->do_pkgs->ensure_binary_is_installed('mdadm', 'mdadm');
}

sub new {
    my ($raids, %opts) = @_;
    my $md_part = { %opts };
    add2hash_($md_part, { 'chunk-size' => '64', disks => [], 
			  fs_type => 'ext3',
			  device => first(free_mds($raids)), 
			  notFormatted => 1, level => 1 });
    push @$raids, $md_part;
    foreach (@{$md_part->{disks}}) {
	$_->{raid} = $md_part->{device};
	fs::type::set_pt_type($_, 0xfd);
	delete $_->{mntpoint};
    }
    update($md_part);
    $md_part;
}

sub add {
    my ($md_part, $part) = @_;
    $md_part->{isMounted} and die N("Can not add a partition to _formatted_ RAID %s", $md_part->{device});
    inactivate_and_dirty($md_part);
    set_isFormatted($part, 0);
    $part->{raid} = $md_part->{device};
    delete $part->{mntpoint};
    push @{$md_part->{disks}}, $part;
    update($md_part);
}

sub delete {
    my ($raids, $md_part) = @_;
    inactivate_and_dirty($md_part);
    delete $_->{raid} foreach @{$md_part->{disks}};
    @$raids = grep { $_ != $md_part } @$raids;
    write_conf($raids) if $::isStandalone;
}

sub change_device {
    my ($md_part, $new_device) = @_;
    if ($new_device ne $md_part->{device}) {
	inactivate_and_dirty($md_part);
	$md_part->{device} = $new_device;
	$_->{raid} = $new_device foreach @{$md_part->{disks}};
    }
}

sub removeDisk {
    my ($raids, $part) = @_;
    my $md_part = fs::get::device2part($part->{raid}, $raids);
    inactivate_and_dirty($md_part);
    fs::type::set_isFormatted($part, 0);
    delete $part->{raid};
    my $disks = $md_part->{disks};
    @$disks = grep { $_ != $part } @$disks;
    if (@$disks) {
	update($md_part);
    } else {
	@$raids = grep { $_ != $md_part } @$raids;
    }
    write_conf($raids) if $::isStandalone;
}

sub updateSize {
    my ($part) = @_;
    local $_ = $part->{level};
    my @l = map { $_->{size} } @{$part->{disks}};

    $part->{size} = do {
	if (/0|linear/) { sum @l }
	elsif (/1/)     { min @l }
	elsif (/4|5/)   { min(@l) * (@l - 1) }
	elsif (/6/)     { min(@l) * (@l - 2) }
    };
}

sub allmodules {
    [ 'raid0', 'raid1', 'raid10', 'raid456' ];
}

sub module {
    my ($part) = @_;
    my $level = $part->{level};
    log::l("level $level");

    if (member($level, 4, 5, 6)) {
	'raid456';
    } elsif ($level =~ /^\d+$/) {
	"raid$level";
    } else {
	$level;
    }
}


sub update {
    updateSize($_) foreach @_;
}

sub make {
    my ($raids, $part) = @_;    

    return if is_active($part->{device});

    inactivate_and_dirty($part);

    isRAID($_) and make($raids, $_) foreach @{$part->{disks}};
    eval { modules::load(module($part)) };

    whereis_binary('mdadm') or die 'mdadm not installed';

    my $dev = devices::make($part->{device});