Commit 2eab9b24 authored by Mike Hibler's avatar Mike Hibler

The latest in logic to have findSpareDisks not use the system disk.

If an available partition device (aka, the 4th partition on the system disk)
represents less than 5% of the spare space we have found, ignore it.

This will allow us to continue to use the 4th partition on the system
disk of the d710s (450GB or so) and the second disk (250GB), but not use
the 2nd partition (3GB), which would make us thrash about on the system
disk even more than usual.

Mostly this is for the new HP server boxes, so it doesn't pick up the 10GB
left over on the (virtual) system disk when we have 21TB available on the
second (virtual) disk.

Another hack til blockstores rule the world...
parent a8e34fc3
...@@ -225,6 +225,10 @@ my $MAXROUTETTABLE = 255; ...@@ -225,6 +225,10 @@ my $MAXROUTETTABLE = 255;
# Whether or not to use only unpartitioned (unused) disks to form the Xen VG. # Whether or not to use only unpartitioned (unused) disks to form the Xen VG.
my $LVM_FULLDISKONLY = 0; my $LVM_FULLDISKONLY = 0;
# Whether or not to use partitions only when they are big.
my $LVM_ONLYLARGEPARTS = 1;
my $LVM_LARGEPARTPCT = 5;
# LVM snapshots suck. # LVM snapshots suck.
my $DOSNAP = 0; my $DOSNAP = 0;
...@@ -490,21 +494,74 @@ sub rootPreConfig($) ...@@ -490,21 +494,74 @@ sub rootPreConfig($)
print "Creating volume group...\n" print "Creating volume group...\n"
if ($debug); if ($debug);
#
# Total up potential maximum size
#
my $maxtotalSize = 0;
my $sizeThreshold = 0;
foreach my $dev (keys(%devs)) {
if (defined($devs{$dev}{"size"})) {
$maxtotalSize += $devs{$dev}{"size"};
} else {
foreach my $part (keys(%{$devs{$dev}})) {
$maxtotalSize += $devs{$dev}{$part}{"size"};
}
}
}
if ($maxtotalSize > 0) {
$sizeThreshold = int($maxtotalSize * $LVM_LARGEPARTPCT / 100.0);
}
# #
# Find available devices of sufficient size, prepare them, # Find available devices of sufficient size, prepare them,
# and incorporate them into a volume group. # and incorporate them into a volume group.
# #
my $blockdevs = "";
my $totalSize = 0; my $totalSize = 0;
my $blockdevs = "";
foreach my $dev (keys(%devs)) { foreach my $dev (keys(%devs)) {
#
# Whole disk is available
#
if (defined($devs{$dev}{"size"})) { if (defined($devs{$dev}{"size"})) {
$blockdevs .= " " . $devs{$dev}{"path"}; $blockdevs .= " " . $devs{$dev}{"path"};
$totalSize += $devs{$dev}{"size"}; $totalSize += $devs{$dev}{"size"};
} }
elsif ($LVM_FULLDISKONLY == 0) { #
# Disk contains partitions that are available
#
else {
foreach my $part (keys(%{$devs{$dev}})) { foreach my $part (keys(%{$devs{$dev}})) {
$blockdevs .= " " . $devs{$dev}{$part}{"path"}; my $psize = $devs{$dev}{$part}{"size"};
$totalSize += $devs{$dev}{$part}{"size"}; my $ppath = $devs{$dev}{$part}{"path"};
#
# XXX one way to avoid using the system disk, just ignore
# all partition devices. However, in cases where the
# remainder of the system disk represents the majority of
# the available space (e.g., Utah d710s), this is a bad
# idea.
#
if ($LVM_FULLDISKONLY) {
print STDERR "WARNING: not using $ppath for LVM (is a partition)\n";
next;
}
#
# XXX another heurstic to try to weed out the system
# disk whenever feasible: if a partition device represents
# less than some percentage of the max possible space,
# avoid it.
#
if ($LVM_ONLYLARGEPARTS && $psize < $sizeThreshold) {
print STDERR "WARNING: not using $ppath for LVM (too small)\n";
next;
}
#
# It ran the gauntlet of feeble filters, use it!
#
$blockdevs .= " " . $ppath;
$totalSize += $psize;
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment