From def534e73f7cbb83ed13ca77fe99847811c7d592 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 28 Apr 2021 16:43:11 -0400 Subject: [PATCH] Fixes for boot by DHCP and by MAC --- .../genesis/initramfs/opt/confluent/bin/rungenesis | 1 + confluent_server/confluent/discovery/core.py | 11 +++++++---- .../confluent/discovery/protocols/ssdp.py | 7 +++++-- genesis/97genesis/install-base | 1 + 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/confluent_osdeploy/genesis/initramfs/opt/confluent/bin/rungenesis b/confluent_osdeploy/genesis/initramfs/opt/confluent/bin/rungenesis index 7139c6e4..4579a5f3 100644 --- a/confluent_osdeploy/genesis/initramfs/opt/confluent/bin/rungenesis +++ b/confluent_osdeploy/genesis/initramfs/opt/confluent/bin/rungenesis @@ -59,6 +59,7 @@ hostname $nodename ifidx=$(cat /tmp/confluent.ifidx) ifname=$(ip link |grep ^$ifidx:|awk '{print $2}') ifname=${ifname%:} +autoconfigmethod=$(grep ipv4_method /etc/confluent/confluent.deploycfg |awk '{print $2}') if [ "$autoconfigmethod" = "dhcp" ]; then echo -n "Attempting to use dhcp to bring up $ifname..." dhclient $ifname diff --git a/confluent_server/confluent/discovery/core.py b/confluent_server/confluent/discovery/core.py index 34fc39e4..1b3fab7a 100644 --- a/confluent_server/confluent/discovery/core.py +++ b/confluent_server/confluent/discovery/core.py @@ -1,4 +1,4 @@ -# Copyright 2016-2017 Lenovo +# Copyright 2016-2021 Lenovo # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -912,8 +912,11 @@ def get_nodename_from_chained_smms(cfg, handler, info): nodename = newnodename return nodename -def get_node_by_uuid(uuid): - return nodes_by_uuid.get(uuid, None) +def get_node_by_uuid_or_mac(uuidormac): + node = pxe.macmap.get(uuidormac, None) + if node is not None: + return node + return nodes_by_uuid.get(uuidormac, None) def get_nodename_from_enclosures(cfg, info): nodename = None @@ -1305,7 +1308,7 @@ def start_detection(): if rechecker is None: rechecktime = util.monotonic_time() + 900 rechecker = eventlet.spawn_after(900, _periodic_recheck, cfg) - eventlet.spawn_n(ssdp.snoop, None, None, ssdp, get_node_by_uuid) + eventlet.spawn_n(ssdp.snoop, None, None, ssdp, get_node_by_uuid_or_mac) def stop_autosense(): for watcher in list(autosensors): diff --git a/confluent_server/confluent/discovery/protocols/ssdp.py b/confluent_server/confluent/discovery/protocols/ssdp.py index de0fb8ef..43a48936 100644 --- a/confluent_server/confluent/discovery/protocols/ssdp.py +++ b/confluent_server/confluent/discovery/protocols/ssdp.py @@ -180,11 +180,14 @@ def snoop(handler, byehandler=None, protocol=None, uuidlookup=None): except Exception: continue for query in headline[-1].split('/'): + node = None if query.startswith('uuid='): curruuid = query.split('=', 1)[1].lower() node = uuidlookup(curruuid) - if not node: - break + elif query.startswith('mac='): + currmac = query.split('=', 1)[1].lower() + node = uuidlookup(currmac) + if node: # Do not bother replying to a node that # we have no deployment activity # planned for diff --git a/genesis/97genesis/install-base b/genesis/97genesis/install-base index a5a408e9..ab6138ff 100644 --- a/genesis/97genesis/install-base +++ b/genesis/97genesis/install-base @@ -26,5 +26,6 @@ dracut_install /usr/lib/udev/rules.d/10-dm.rules /usr/sbin/dmsetup /usr/lib/udev #dracut_install /usr/lib/opa-fm/bin/opafmd #dracut_install /usr/sbin/opensm /usr/libexec/opensm-launch dracut_install /usr/lib64/libibverbs/libhfi1verbs-rdmav25.so /etc/libibverbs.d/hfi1verbs.driver /etc/libibverbs.d/mlx4.driver /etc/libibverbs.d/mlx5.driver /usr/lib64/libibverbs/libmlx4-rdmav25.so /usr/lib64/libibverbs/libmlx5-rdmav25.so +inst /usr/lib/dracut/modules.d/40network/net-lib.sh /lib/net-lib.sh #dracut_install mstflint This would have mlx update support, but it incurs gigantic dependencies, libicudata