-Select first available unit number rather than highest, to fill in gaps left by old devices being removed
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@6402 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
42ac6c627c
commit
d36e947c5d
@ -606,10 +606,10 @@ sub chvm {
|
||||
}
|
||||
}
|
||||
if($scsiCont) {
|
||||
$scsiUnit = getHighestUnit($scsiCont->{key},$devices);
|
||||
$scsiUnit = getAvailUnit($scsiCont->{key},$devices);
|
||||
}
|
||||
if($ideCont) {
|
||||
$ideUnit = getHighestUnit($ideCont->{key},$devices);
|
||||
$ideUnit = getAvailUnit($ideCont->{key},$devices);
|
||||
}
|
||||
unless ($hyphash{$hyp}->{datastoremap}) { validate_datastore_prereqs([],$hyp); }
|
||||
push @devChanges, create_storage_devs($node,$hyphash{$hyp}->{datastoremap},$addSizes,$scsiCont,$scsiUnit,$ideCont,$ideUnit);
|
||||
@ -659,15 +659,21 @@ sub chvm {
|
||||
|
||||
}
|
||||
|
||||
sub getHighestUnit {
|
||||
sub getAvailUnit {
|
||||
my $contKey = shift;
|
||||
my $devices = shift;
|
||||
my $highestUnit = 0;
|
||||
my %usedids;
|
||||
$usedids{7}=1;
|
||||
$usedids{'7'}=1; #TODO: figure out which of these is redundant, the string or the number variant
|
||||
for my $device (@$devices) {
|
||||
if(($device->{controllerKey} eq $contKey) && ($device->{unitNumber} >= $highestUnit)) {
|
||||
$highestUnit = $device->{unitNumber}+1;
|
||||
if($device->{controllerKey} eq $contKey) {
|
||||
$usedids{$device->{unitNumber}}=1;
|
||||
}
|
||||
}
|
||||
my $highestUnit=0;
|
||||
while ($usedids{$highestUnit}) {
|
||||
$highestUnit++;
|
||||
}
|
||||
return $highestUnit;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user