Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance bmcsetup logic for openbmc #2990

Merged
merged 3 commits into from May 9, 2017
Merged

enhance bmcsetup logic for openbmc #2990

merged 3 commits into from May 9, 2017

Conversation

zet809
Copy link

@zet809 zet809 commented May 5, 2017

Include 3 main modification:

  1. add isopenbmc attribute for the getbmcconfig command send by getipmi script in xcat-genesis-scripts
  2. modify bmcsetup script to disable unsupported ipmitool in-band command for openbmc
  3. in bmcconfig.pm, read bmc information from openbmc table if the request come from an openbmc.
  4. read default password with key openbmc from passwd table if the request come from an openbmc.

Before modifying:

[p9euh02 /]# ipmitool lan print 1
Set in Progress         : Set Complete
...
IP Address              : 10.6.9.200
Subnet Mask             : 255.0.0.0
MAC Address             : 70:e2:84:14:24:74
Default Gateway IP      : 10.0.0.101
...

Configuring BMC:

[p9euh02 /]# /bin/bmcsetup
ipmitool version 1.8.18
Invalid channel: 16
/bin/bmcsetup: line 151:  3709 Terminated              allowcred.awk
<167>May  8 05:24:45 xcat.genesis.bmcsetup: BMC Information obtained from xCAT
<167>May  8 05:24:45 xcat.genesis.bmcsetup: NUMBMCS=1 ==> BMC IP=10.6.9.254/255.0.0.0, GW=10.0.0.101, VLAN=off
<166>May  8 05:24:45 xcat.genesis.bmcsetup: IPMIVER=2.0, IPMIMFG=42817, XPROD=16975
<166>May  8 05:24:45 xcat.genesis.bmcsetup: Auto detecting LAN channel...
<166>May  8 05:24:45 xcat.genesis.bmcsetup: Detected LAN channel 1
Setting LAN IP Address to 10.6.9.254
Setting LAN Subnet Mask to 255.0.0.0
Setting LAN Default Gateway IP to 10.0.0.101
<167>May  8 05:24:47 xcat.genesis.bmcsetup: snooze for 1 second...

After modifying:

[p9euh02 /]# ipmitool lan print 1
Set in Progress         : Set Complete
...
IP Address              : 10.6.9.254
Subnet Mask             : 255.0.0.0
MAC Address             : 70:e2:84:14:24:74
Default Gateway IP      : 10.0.0.101
...

For the task #2810

@zet809 zet809 added this to the 2.13.4 milestone May 5, 2017
@@ -161,6 +168,7 @@ logger -s -t $log_label -p local4.info "IPMIVER=$IPMIVER, IPMIMFG=$IPMIMFG, XPRO
#
# IPMIMFG=2 = IBM
# IPMIMFG=0 = OpenPower
# IPMIMFG=42817 and XPROD=16975 = OpenBMC
#
if [ "$IPMIMFG" == 2 ]; then #IBM
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is very important, but in some cases in this file we use strings for comparisons and in some cases integers. Should we make this consistent:
if [ "$xxxx" == "yyy" ]
if [ "$xxxx" == yyy ]

Copy link
Author

@zet809 zet809 May 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, @gurevichmark , thx very much for the comments. You are right we shall keep the consistent. I do that for the OpenBMC part.
But for others, UT is needed if there is any modifications. But I don't thnk we need to put too much effort to verify it on multiple kind of servers, right? What is your idea?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I agree. Maybe just change the code that gets executed for this PR.

Copy link
Contributor

@gurevichmark gurevichmark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this file, we use both = and == in if [] statements. Functionally they are equivalent.
Should we make them the same for readability ?
Also people online suggest that = should be used because == is not POSIX compliant. (dash, in particular, does not recognize it) http://stackoverflow.com/questions/2600281/what-is-the-difference-between-operator-and-in-bash/2601583#2601583

@zet809 zet809 changed the title [DO NOT MERGE]enhance bmcsetup logic for openbmc enhance bmcsetup logic for openbmc May 8, 2017
@@ -258,13 +266,20 @@ elif [ "$IPMIMFG" == "674" ]; then # DELL
ipmitool delloem lan set shared with lom$BMCPORT &>/dev/null
ipmitool delloem lan set shared with failover all loms &>dev/null
fi
elif [ "$IPMIMFG" = "42817" -a "$XPROD" = "16975" ]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment here, # IBM OpenPower systems running OpenBMC

fi

if [ -z "$ISOPENBMC" ]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest that we test for OpenBMC and override the default, and be consistent with this. So default to non-openbmc and then override for OpenBMC always...

Example:


LAN_MED_TYPE="802.3" 
if [ ! -z "${ISOPENBMC+x}" ]; then 
    # OpenBMC overrides
    LAN_MED_TYPE="Other LAN"
    # other here...  
fi 

However, it looks like nothing else is defined at this time to put into this statement, but perhaps it will set the stage for future additions.

TRIES=0
bmc_config_rc=0
# Set Channel Access to apply network setting
#while ! ipmitool -d $idev lan set $LANCHAN access on; do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line should be deleted.

# update the node status to 'bmcready' for openbmc, no more configuration is needed.
if [ ! -z "$ISOPENBMC" ]; then
# To enable network configuration for openbmc
let idev=0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to set this idev=0 if it seems to never increase or change...?

if [ ! -z "$XCATMASTER" ]; then
if [ "$bmc_config_rc" = "0" ]; then
# Wait for some time for the new network setting is ready
snooze
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we check with firmware team about this snooze, it will default to 1 second, is it even needed?

@@ -29,10 +29,17 @@ for LANCHAN in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16; do
done
BMCMAC=`ipmitool lan print $LANCHAN|grep ^MAC|awk '{print $4}'` #bmcconfig may opt to use DHCP, if so we need to feed up the mac address
#TODO: need a way to get the DUID the service processor may use, perhaps reserve that for 'ibmsetup' since spec doesn't touch ipv6?

IPMIMFG=`ipmitool mc info |grep "^Manufacturer ID"|awk '{print $4}'`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we consider having a common file to move some of the common functions into another place?

[vhu@victorvm7 test]$ cat ipmi_common 
#!/bin/sh

IPMIMFG="42817"
XPROD="16975"

if [ "$IPMIMFG" == "42817" -a "$XPROD" == "16975" ]; then
    ISOPENBMC=1
else
    ISOPENBMC=0
fi

If we source it in another file, we will get the variables set....

[vhu@victorvm7 test]$ cat getipmi 
#!/bin/sh 

echo "BEFORE: ISOPENBMC=$ISOPENBMC"

. ./ipmi_common

echo "AFTER:ISOPENBMC=$ISOPENBMC"

Result:

[vhu@victorvm7 test]$ ./getipmi 
BEFORE: ISOPENBMC=
AFTER:ISOPENBMC=1

One downside is that we can't just use relative path . ./ipmi_common and we have to make sure we don't get "File not found..."

@@ -96,20 +96,24 @@ sub process_request {
my $request = shift;
my $callback = shift;
my $node = $request->{'_xcat_clienthost'}->[0];
my $open_table = "ipmi";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This variable name doesn't really make sense.. "open table"... Suggest bmc_mgmt_type ?

@zet809
Copy link
Author

zet809 commented May 9, 2017

Hi, @vhu, I had modified based on some of your comments.
Not sure what happened, I can not reply your comments directly, so reply here.

  1. For the question about snooze, I hadn't asked Firmware, but my verification shows that the network can not work immediately after applied. Wait for 1 seconds works for our p9euh01 and p9euh02 server.
  2. Use a common file, I agree with you that it is a good idea. But this code section doesn't work for both getipmi and bmcsetup. So I didn't modify it.
  3. For the line 'set access on', the command will be supported by Firmware later, I can comment it out when it is supported. So, I didn't delete that line.
    Thx!

Copy link
Member

@whowutwut whowutwut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @zet809 , I am ok with the changes. Can merge in and give it more tries...

@gurevichmark gurevichmark merged commit 7271df0 into xcat2:master May 9, 2017
bmc_config_rc=0
# Set Channel Access to apply network setting
#while ! ipmitool -d 0 lan set $LANCHAN access on; do
while ! ipmitool -d 0 raw 0x06 0x40 $LANCHAN 0x42 0x44 > /dev/null; do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zet809 I just followed the github issue you opened, I think we should add some comments and point to the openbmc issue so that we don't forgot why we are doing this raw 0x06 0x40 workaround...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants