diff options
author | Matt Spinler <spinler@us.ibm.com> | 2017-02-15 13:19:43 -0600 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2017-02-22 03:34:38 +0000 |
commit | 3c784b669c2cf9686d55e6b01cc43672f6a4d9bb (patch) | |
tree | 146ac2ad46eea48c26bb3a2313476017a1c6759f | |
parent | d92101d54d284ee4cf8fd06aa8f1bba9d7612e0d (diff) | |
download | phosphor-mrw-tools-3c784b669c2cf9686d55e6b01cc43672f6a4d9bb.tar.gz phosphor-mrw-tools-3c784b669c2cf9686d55e6b01cc43672f6a4d9bb.zip |
Inventory.pm: Point chassis at the motherboard
Give the chassis MRW target the same inventory name as
the motherboard. Requested by the FRU management code.
For multi-chassis systems, this will probably need to be
revisited.
Change-Id: I3bbfe552a31e5a3aa3059c7ff2b6c8a3e414eb7a
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
-rw-r--r-- | Inventory.pm | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Inventory.pm b/Inventory.pm index b5d4144..9f37f3b 100644 --- a/Inventory.pm +++ b/Inventory.pm @@ -138,6 +138,8 @@ sub makeOBMCNames #We want card1, not card-1 removeHyphensFromInstanceNum($inventory); + + pointChassisAtMotherboard($targetObj, $inventory); } @@ -328,6 +330,33 @@ sub renameSegmentWithTargetType } +#FRU management code needs the node/chassis item to point +#to the motherboard and not /system/chassis. Can revisit this +#for multi-chassis systems if they ever show up. +sub pointChassisAtMotherboard +{ + my ($targetObj, $inventory) = @_; + my $newName = undef; + + for my $item (@$inventory) { + my $type = $targetObj->getTargetType($item->{TARGET}); + if ($type eq "card-motherboard") { + $newName = $item->{OBMC_NAME}; + last; + } + } + + for my $item (@$inventory) { + if ($targetObj->getType($item->{TARGET}) eq "NODE") { + if (defined $newName) { + $item->{OBMC_NAME} = $newName; + } + last; + } + } +} + + #Removes the instance number from the OBMC_NAME segments #where only 1 of those segments exists because numbering isn't #necessary to distinguish them. |