mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-09-05 17:58:14 +00:00
Implement IPMI enablement through redfish
Newer firmware will disable IPMI by default. If a user is using bmcsetup, they are preparing explictly to use with IPMI, so use redfish to turn on the IPMI.
This commit is contained in:
@@ -1 +1 @@
|
||||
SUBSYSTEM=="usb", ATTRS{idVendor}=="04b3", ATTRS{idProduct}=="4010", RUN+="/sbin/setupimmnic"
|
||||
SUBSYSTEM=="net", ATTRS{idVendor}=="04b3", ATTRS{idProduct}=="4010", RUN+="/sbin/setupimmnic"
|
||||
|
@@ -687,6 +687,19 @@ while [ $idev -gt 0 ]; do
|
||||
done &
|
||||
fi
|
||||
done
|
||||
export user
|
||||
export bmcp
|
||||
if [ -e /tmp/xcchostnic ]; then
|
||||
INTERFACE=$(cat /tmp/xcchostnic)
|
||||
export INTERFACE
|
||||
# Wrap in a network namespace to avoid external meddling
|
||||
ip netns add mgt
|
||||
ip link set dev $INTERFACE netns mgt
|
||||
ip netns exec mgt bash /usr/sbin/enableipmiusingredfish.py
|
||||
ip netns exec mgt ip link set dev $INTERFACE netns 1
|
||||
/usr/sbin/setupimmnic
|
||||
fi
|
||||
|
||||
|
||||
# remove the bmc configuration information before exit
|
||||
rm -f /tmp/ipmicfg.xml
|
||||
|
26
xCAT-genesis-scripts/usr/sbin/enableipmiusingredfish.py
Executable file
26
xCAT-genesis-scripts/usr/sbin/enableipmiusingredfish.py
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/python
|
||||
import base64
|
||||
import httplib
|
||||
import os
|
||||
import subprocess
|
||||
import ssl
|
||||
|
||||
iface = os.environ['INTERFACE']
|
||||
# This should be run in an isolated context. Since cert validation
|
||||
# is currently not in the cards, we are realistically at the mercy
|
||||
# of the OS routing table
|
||||
subprocess.check_call(['/sbin/ip', 'link', 'set', iface, 'up'])
|
||||
subprocess.check_call(['/sbin/ip', 'addr', 'add', 'dev', iface, '169.254.95.120/24'])
|
||||
subprocess.check_call(['/sbin/ip', 'route', 'add', '169.254.95.0/24', 'dev', iface])
|
||||
client = httplib.HTTPSConnection('169.254.95.118', context=ssl._create_unverified_context())
|
||||
headers = {
|
||||
'Authorization': 'Basic {0}'.format(base64.b64encode(':'.join((os.environ['user'], os.environ['bmcp'])))),
|
||||
'Content-Type': 'application/json',
|
||||
'Host': '169.254.95.118',
|
||||
}
|
||||
client.request('PATCH', '/redfish/v1/Managers/1/NetworkProtocol', '{"IPMI": {"ProtocolEnabled": true}}', headers)
|
||||
rsp = client.getresponse()
|
||||
rsp.read()
|
||||
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
#!/bin/sh
|
||||
/sbin/ip link set usb0 up
|
||||
/sbin/ip addr add dev usb0 169.254.95.120/24
|
||||
/sbin/ip route add 169.254.95.0/24 dev usb0
|
||||
/sbin/ip link set $INTERFACE up
|
||||
/sbin/ip addr add dev $INTERFACE 169.254.95.120/24
|
||||
/sbin/ip route add 169.254.95.0/24 dev $INTERFACE
|
||||
echo -n $INTERFACE > /tmp/xcchostnic
|
||||
|
Reference in New Issue
Block a user