import latest fedora sources
Signed-off-by: Joel Savitz <jsavitz@redhat.com>
This commit is contained in:
parent
c6f043ba45
commit
0c33fe3512
125
fix-dhcp-mode.patch
Normal file
125
fix-dhcp-mode.patch
Normal file
@ -0,0 +1,125 @@
|
||||
From c624c9dfe03c0e066eea1240b4b9ca8f3ed07eb8 Mon Sep 17 00:00:00 2001
|
||||
From: John Chung <john.chung@arm.com>
|
||||
Date: Fri, 26 May 2023 22:03:50 +0800
|
||||
Subject: [PATCH] Redfish-finder cannot work in DHCP mode
|
||||
|
||||
dmidecode output didn't provide Redfish Service Address in dhcp mode.
|
||||
It will fail to match domain name to ip address. Move to fetch DHCP
|
||||
server ip address from nmcli output.
|
||||
|
||||
dmidecode output :
|
||||
|
||||
Handle 0x0021, DMI type 42, 129 bytes
|
||||
Management Controller Host Interface
|
||||
Host Interface Type: Network
|
||||
Device Type: USB
|
||||
idVendor: 0x0b05
|
||||
idProduct: 0x1976
|
||||
Protocol ID: 04 (Redfish over IP)
|
||||
Service UUID: 24913078-eeb7-5842-b08b-732425cc09ea
|
||||
Host IP Assignment Type: DHCP
|
||||
Host IP Address Format: IPv4
|
||||
Redfish Service IP Discovery Type: DHCP
|
||||
Redfish Service IP Address Format: IPv4
|
||||
Redfish Service Hostname: bmc.host.interface
|
||||
|
||||
Signed-off-by: John Chung <john.chung@arm.com>
|
||||
---
|
||||
redfish-finder | 43 +++++++++++++++++++++++++++++++++++--------
|
||||
1 file changed, 35 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/redfish-finder b/redfish-finder
|
||||
index 461eff9..b869a9b 100755
|
||||
--- a/redfish-finder
|
||||
+++ b/redfish-finder
|
||||
@@ -203,6 +203,7 @@ class ServiceConfig():
|
||||
def __init__(self, cursor):
|
||||
self.address = []
|
||||
self.mask = []
|
||||
+ self.dhcp_format = []
|
||||
try:
|
||||
cursor = cursor_consume_next(cursor, "Redfish Service IP Discovery Type: ")
|
||||
if cursor == None:
|
||||
@@ -220,16 +221,21 @@ class ServiceConfig():
|
||||
self.address.append(ipaddress.IPv6Address(unicode(cursor.split()[0], "utf-8")))
|
||||
cursor = cursor_consume_next(cursor, "IPv6 Mask: ")
|
||||
self.mask.append(ipaddress.IPv4Address(unicode(cursor.split()[0], "utf-8")))
|
||||
+ cursor = cursor_consume_next(cursor, "Redfish Service Port: ")
|
||||
+ self.port = int(cursor.split()[0])
|
||||
+ cursor = cursor_consume_next(cursor, "Redfish Service Vlan: ")
|
||||
+ self.vlan = int(cursor.split()[0])
|
||||
elif cursor.split()[0] == "DHCP":
|
||||
self.assigntype = AssignType.DHCP
|
||||
+ cursor = cursor_consume_next(cursor, "Redfish Service IP Address Format: ")
|
||||
+ if cursor.split()[0] == "IPv4":
|
||||
+ self.dhcp_format.append("DHCP4")
|
||||
+ elif cursor.split()[0] == "IPv6":
|
||||
+ self.dhcp_format.append("DHCP6")
|
||||
else:
|
||||
# Support the other types later
|
||||
print("redfish-finder: Unable to parse SMBIOS Service Config info")
|
||||
return None
|
||||
- cursor = cursor_consume_next(cursor, "Redfish Service Port: ")
|
||||
- self.port = int(cursor.split()[0])
|
||||
- cursor = cursor_consume_next(cursor, "Redfish Service Vlan: ")
|
||||
- self.vlan = int(cursor.split()[0])
|
||||
cursor = cursor_consume_next(cursor, "Redfish Service Hostname: ")
|
||||
|
||||
#
|
||||
@@ -338,7 +344,7 @@ class OSServiceData():
|
||||
# Method to read in /etc/hosts, remove old redfish entries
|
||||
# and insert new ones based on ServiceConfig
|
||||
#
|
||||
- def update_redfish_info(self):
|
||||
+ def update_redfish_info(self, conn):
|
||||
# strip any redfish localhost entry from host_entries
|
||||
# as well as any entries for the smbios exported host name
|
||||
for h in self.host_entries:
|
||||
@@ -351,8 +357,14 @@ class OSServiceData():
|
||||
|
||||
# Now add the new entries in
|
||||
addresses=""
|
||||
- for i in self.sconf.address:
|
||||
- addresses = addresses + str(i) + " "
|
||||
+ if self.sconf.assigntype == AssignType.DHCP:
|
||||
+ for i in self.sconf.dhcp_format:
|
||||
+ dhcp_ip = conn.get_dhcp_server_identifier(i)
|
||||
+ addresses = addresses + str(dhcp_ip) + " "
|
||||
+ else:
|
||||
+ for i in self.sconf.address:
|
||||
+ addresses = addresses + str(i) + " "
|
||||
+
|
||||
newentry = addresses + " " + self.constant_name
|
||||
newentry = newentry + " " + self.sconf.hostname
|
||||
self.host_entries.append(newentry)
|
||||
@@ -436,6 +448,21 @@ class nmConnection():
|
||||
def get_property(self, prop):
|
||||
return self.properties[prop]
|
||||
|
||||
+ #
|
||||
+ # Get DHCP server identifier
|
||||
+ #
|
||||
+ def get_dhcp_server_identifier(self, dhcp_format):
|
||||
+ propstr = subprocess.check_output(["nmcli", "-f", dhcp_format, "con", "show", self.ifc.getifcname()])
|
||||
+ lines = propstr.splitlines()
|
||||
+ for data in lines:
|
||||
+ elements = data.decode("utf-8").split()
|
||||
+ if len(elements) < 2:
|
||||
+ continue
|
||||
+ for key in elements:
|
||||
+ if key == "dhcp_server_identifier":
|
||||
+ return elements[3]
|
||||
+ return None
|
||||
+
|
||||
#
|
||||
# Using this object, run nmcli to update the os so that the
|
||||
# interface represented here is in sync with our desired
|
||||
@@ -523,7 +550,7 @@ def main():
|
||||
if conn.sync_to_os() == False:
|
||||
sys.exit(1)
|
||||
print("redfish-finder: Adding redfish host info to OS config")
|
||||
- svc.update_redfish_info()
|
||||
+ svc.update_redfish_info(conn)
|
||||
if svc.output_redfish_config() == False:
|
||||
sys.exit(1)
|
||||
print("redfish-finder: Done, BMC is now reachable via hostname redfish-localhost")
|
27
hostconfig-dhcp-parse.patch
Normal file
27
hostconfig-dhcp-parse.patch
Normal file
@ -0,0 +1,27 @@
|
||||
commit 581327fd45351dd53c06a26517bb7f92e19d8f31
|
||||
Author: Charles Rose <charles.rose@dell.com>
|
||||
Date: Mon Aug 31 17:40:08 2020 -0500
|
||||
|
||||
fix parsing HostConfig for DHCP
|
||||
|
||||
assigntype.append(AssignType.DHCP) fails for DHCP because
|
||||
assigntype [] is not set.
|
||||
|
||||
Signed-off-by: Charles Rose <charles.rose@dell.com>
|
||||
|
||||
diff --git a/redfish-finder b/redfish-finder
|
||||
old mode 100644
|
||||
new mode 100755
|
||||
index 9a185b3..461eff9
|
||||
--- a/redfish-finder
|
||||
+++ b/redfish-finder
|
||||
@@ -123,8 +123,8 @@ class HostConfig():
|
||||
cursor = cursor_consume_next(cursor, "Host IP Assignment Type: ")
|
||||
if cursor == None:
|
||||
raise RuntimeError("redfish-finder: Unable to parse SMBIOS Host IP Assignment Type")
|
||||
+ self.assigntype = []
|
||||
if cursor.split()[0] == "Static":
|
||||
- self.assigntype = []
|
||||
self.assigntype.append(AssignType.STATIC)
|
||||
cursor = cursor_consume_next(cursor, "Host IP Address Format: ")
|
||||
if cursor.split()[0] == "IPv4":
|
20
redfish-finder-python3.patch
Normal file
20
redfish-finder-python3.patch
Normal file
@ -0,0 +1,20 @@
|
||||
commit 59fc5f964bf6971da552d059520d7798fccbd4fc
|
||||
Author: Neil Horman <nhorman@hmswarspite.think-freely.org>
|
||||
Date: Tue Nov 12 08:53:50 2019 -0500
|
||||
|
||||
fixup interpreter to be python3
|
||||
|
||||
This should never have been there, platform-python is an old distro-ism.
|
||||
|
||||
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
|
||||
|
||||
diff --git a/redfish-finder b/redfish-finder
|
||||
index 6637d92..9a185b3 100644
|
||||
--- a/redfish-finder
|
||||
+++ b/redfish-finder
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/usr/libexec/platform-python
|
||||
+#!/usr/bin/python3
|
||||
|
||||
import sys
|
||||
import os
|
5
redfish-finder.rpmlintrc
Normal file
5
redfish-finder.rpmlintrc
Normal file
@ -0,0 +1,5 @@
|
||||
# .rpmlintrc
|
||||
|
||||
# Ignore spelling errors
|
||||
addFilter("spelling-error.*")
|
||||
|
64
redfish-finder.spec
Normal file
64
redfish-finder.spec
Normal file
@ -0,0 +1,64 @@
|
||||
Name: redfish-finder
|
||||
Version: 0.4
|
||||
Release: %autorelease
|
||||
Summary: Utility for parsing SMBIOS information and configuring canonical BMC access
|
||||
BuildArch: noarch
|
||||
|
||||
License: GPL-2.0-or-later
|
||||
URL: https://github.com/nhorman/redfish-finder
|
||||
Source: %url/archive/V%{version}/%{name}-%{version}.tar.gz
|
||||
|
||||
# Fix shabang python interpreter: https://github.com/nhorman/redfish-finder/commit/59fc5f964bf6971da552d059520d7798fccbd4fc
|
||||
Patch0: redfish-finder-python3.patch
|
||||
|
||||
# Fix parsing HostConfig for DHCP: https://github.com/nhorman/redfish-finder/commit/581327fd45351dd53c06a26517bb7f92e19d8f31
|
||||
Patch1: hostconfig-dhcp-parse.patch
|
||||
|
||||
# Fix DHCP mode: https://github.com/nhorman/redfish-finder/commit/c624c9dfe03c0e066eea1240b4b9ca8f3ed07eb8
|
||||
Patch2: fix-dhcp-mode.patch
|
||||
|
||||
# Support AutoConfig mode: https://github.com/nhorman/redfish-finder/commit/f6248933605e051992e5a0c29b2c9753e0dc4e76
|
||||
Patch3: support-autoconf-mode.patch
|
||||
|
||||
BuildRequires: systemd-rpm-macros
|
||||
|
||||
Requires: python3
|
||||
Requires: NetworkManager
|
||||
Requires: dmidecode
|
||||
|
||||
%description
|
||||
Scans Smbios information for type 42 management controller information, and uses
|
||||
that to configure the appropriate network interface so that the BMC is
|
||||
canonically accessible via the host name redfish-localhost
|
||||
|
||||
%prep
|
||||
%autosetup
|
||||
|
||||
%build
|
||||
#noop here
|
||||
|
||||
%install
|
||||
install -D -p -m 0755 redfish-finder %{buildroot}/%{_bindir}/redfish-finder
|
||||
install -D -p -m 0644 redfish-finder.1 %{buildroot}/%{_mandir}/man1/redfish-finder.1
|
||||
install -D -p -m 0644 ./redfish-finder.service %{buildroot}/%{_unitdir}/redfish-finder.service
|
||||
|
||||
%post
|
||||
%systemd_post redfish-finder.service
|
||||
|
||||
%preun
|
||||
%systemd_preun redfish-finder.service
|
||||
|
||||
%postun
|
||||
%systemd_postun_with_restart redfish-finder.service
|
||||
|
||||
|
||||
%files
|
||||
%doc README.md
|
||||
%license COPYING
|
||||
%{_bindir}/redfish-finder
|
||||
%{_mandir}/man1/redfish-finder.1.*
|
||||
%{_unitdir}/redfish-finder.service
|
||||
|
||||
|
||||
%changelog
|
||||
%autochangelog
|
1
sources
Normal file
1
sources
Normal file
@ -0,0 +1 @@
|
||||
SHA512 (redfish-finder-0.4.tar.gz) = 5a38e2f2888cd9cdedd877a09ffd954dd7631f546c4e58fbcb523835b4c0905dd6d4288e6fca2e545740467e177b38895646f746a49f070b9f450a5390a0429d
|
91
support-autoconf-mode.patch
Normal file
91
support-autoconf-mode.patch
Normal file
@ -0,0 +1,91 @@
|
||||
From f6248933605e051992e5a0c29b2c9753e0dc4e76 Mon Sep 17 00:00:00 2001
|
||||
From: John Chung <john.chung@arm.com>
|
||||
Date: Sun, 28 May 2023 16:32:05 +0800
|
||||
Subject: [PATCH] Support to configure AutoConf mode
|
||||
|
||||
Get IP address by DHCP server. If fails, fallback to use IP address
|
||||
from smbios type 42. And redfish service ip address is based on type
|
||||
42 records.
|
||||
|
||||
dmidecode output :
|
||||
|
||||
Handle 0x0075, DMI type 42, 130 bytes
|
||||
Management Controller Host Interface
|
||||
Host Interface Type: Network
|
||||
Device Type: USB
|
||||
idVendor: 0x0b05
|
||||
idProduct: 0x1976
|
||||
Protocol ID: 04 (Redfish over IP)
|
||||
Service UUID: c95cab2a-6de0-45f4-8b3b-726c3794b26b
|
||||
Host IP Assignment Type: AutoConf
|
||||
Host IP Address Format: IPv4
|
||||
IPv4 Address: 169.254.11.12
|
||||
IPv4 Mask: 255.255.0.0
|
||||
Redfish Service IP Discovery Type: AutoConf
|
||||
Redfish Service IP Address Format: IPv4
|
||||
IPv4 Redfish Service Address: 169.254.201.45
|
||||
IPv4 Redfish Service Mask: 255.255.0.0
|
||||
Redfish Service Port: 443
|
||||
Redfish Service Vlan: 0
|
||||
Redfish Service Hostname: bmc.host.interface
|
||||
|
||||
Signed-off-by: John Chung <john.chung@arm.com>
|
||||
---
|
||||
redfish-finder | 19 +++++++++++++------
|
||||
1 file changed, 13 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/redfish-finder b/redfish-finder
|
||||
index b869a9b..31045dd 100755
|
||||
--- a/redfish-finder
|
||||
+++ b/redfish-finder
|
||||
@@ -124,8 +124,12 @@ class HostConfig():
|
||||
if cursor == None:
|
||||
raise RuntimeError("redfish-finder: Unable to parse SMBIOS Host IP Assignment Type")
|
||||
self.assigntype = []
|
||||
- if cursor.split()[0] == "Static":
|
||||
- self.assigntype.append(AssignType.STATIC)
|
||||
+ if cursor.split()[0] == "Static" or cursor.split()[0] == "AutoConf":
|
||||
+ assigntype = AssignType.STATIC
|
||||
+ if cursor.split()[0] == "AutoConf":
|
||||
+ assigntype = AssignType.AUTOCONF
|
||||
+ self.assigntype.append(assigntype)
|
||||
+
|
||||
cursor = cursor_consume_next(cursor, "Host IP Address Format: ")
|
||||
if cursor.split()[0] == "IPv4":
|
||||
cursor = cursor_consume_next(cursor, "IPv4 Address: ")
|
||||
@@ -166,11 +170,11 @@ class HostConfig():
|
||||
# attributes of the network manager connection object
|
||||
#
|
||||
def generate_nm_config(self, device, nmcon):
|
||||
- assignmap = { AssignType.STATIC: "manual", AssignType.DHCP: "auto"}
|
||||
+ assignmap = { AssignType.STATIC: "manual", AssignType.DHCP: "auto", AssignType.AUTOCONF: "auto"}
|
||||
methodp = "ipv4.method"
|
||||
for i in range(len(self.assigntype)):
|
||||
assigntype = self.assigntype[i]
|
||||
- if assigntype == AssignType.STATIC:
|
||||
+ if assigntype == AssignType.STATIC or assigntype == AssignType.AUTOCONF:
|
||||
if self.address[i].version == 4:
|
||||
methodp = "ipv4.method"
|
||||
addrp = "ipv4.addresses"
|
||||
@@ -179,7 +183,7 @@ class HostConfig():
|
||||
addrp = "ipv6.addresses"
|
||||
try:
|
||||
nmcon.update_property(methodp, assignmap[assigntype])
|
||||
- if assigntype == AssignType.STATIC:
|
||||
+ if assigntype == AssignType.STATIC or assigntype == AssignType.AUTOCONF:
|
||||
nmcon.update_property(addrp, str(self.address[i]) + "/" + str(self.network[i].prefixlen))
|
||||
except:
|
||||
print("redfish-finder: Error generating nm_config")
|
||||
@@ -208,8 +212,11 @@ class ServiceConfig():
|
||||
cursor = cursor_consume_next(cursor, "Redfish Service IP Discovery Type: ")
|
||||
if cursor == None:
|
||||
raise RuntimeError("redfish-finder: Unable to find Redfish Service Info")
|
||||
- if cursor.split()[0] == "Static":
|
||||
+ if cursor.split()[0] == "Static" or cursor.split()[0] == "AutoConf":
|
||||
self.assigntype = AssignType.STATIC
|
||||
+ if cursor.split()[0] == "AutoConf":
|
||||
+ self.assigntype = AssignType.AUTOCONF
|
||||
+
|
||||
cursor = cursor_consume_next(cursor, "Redfish Service IP Address Format: ")
|
||||
if cursor.split()[0] == "IPv4":
|
||||
cursor = cursor_consume_next(cursor, "IPv4 Redfish Service Address: ")
|
Loading…
Reference in New Issue
Block a user