From fd301c609f3b10d2e46a174c4b9e8eba80f8b8f6 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 29 Aug 2024 08:51:22 -0400 Subject: [PATCH 1/3] Add additional log data to relaydhcp --- confluent_server/confluent/discovery/protocols/pxe.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/confluent_server/confluent/discovery/protocols/pxe.py b/confluent_server/confluent/discovery/protocols/pxe.py index f8f1254f..5e5c98d4 100644 --- a/confluent_server/confluent/discovery/protocols/pxe.py +++ b/confluent_server/confluent/discovery/protocols/pxe.py @@ -755,6 +755,9 @@ def reply_dhcp4(node, info, packet, cfg, reqview, httpboot, cfd, profile, sock=N if (not isboot) and relayip == b'\x00\x00\x00\x00': # Ignore local DHCP packets if it isn't a firmware request return + relayipa = None + if relayip != b'\x00\x00\x00\x00': + relayipa = socket.inet_ntoa(relayip) gateway = None netmask = None niccfg = netutil.get_nic_config(cfg, node, ifidx=info['netinfo']['ifidx'], relayipn=relayip) @@ -884,6 +887,8 @@ def reply_dhcp4(node, info, packet, cfg, reqview, httpboot, cfd, profile, sock=N ipinfo = 'with static address {0}'.format(niccfg['ipv4_address']) else: ipinfo = 'without address, served from {0}'.format(myip) + if relayipa: + ipinfo += ' (relayed to {} via {})'.format(relayipa, requestor[0]) if isboot: log.log({ 'info': 'Offering {0} boot {1} to {2}'.format(boottype, ipinfo, node)}) From f4f5b4d1b6869b783af722d601e7c285d036d7d3 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 29 Aug 2024 08:57:39 -0400 Subject: [PATCH 2/3] Suppress bad gateway warning if the client ip is unknown In a scenario where we are doing the 'next-server' next to a real dhcp server, but through relay, the missing gateway would be expected. Rely on the final message about 'no address' as the clue to users that something went wrong on the node side. --- confluent_server/confluent/discovery/protocols/pxe.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/confluent_server/confluent/discovery/protocols/pxe.py b/confluent_server/confluent/discovery/protocols/pxe.py index 5e5c98d4..64e64c79 100644 --- a/confluent_server/confluent/discovery/protocols/pxe.py +++ b/confluent_server/confluent/discovery/protocols/pxe.py @@ -856,7 +856,7 @@ def reply_dhcp4(node, info, packet, cfg, reqview, httpboot, cfd, profile, sock=N repview[replen - 1:replen + 1] = b'\x03\x04' repview[replen + 1:replen + 5] = gateway replen += 6 - elif relayip != b'\x00\x00\x00\x00': + elif relayip != b'\x00\x00\x00\x00' and clipn: log.log({'error': 'Relay DHCP offer to {} will fail due to missing gateway information'.format(node)}) if 82 in packet: reloptionslen = len(packet[82]) From 1f6987bafcafd737aa9f9403bdfe9989cb8c9406 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Sat, 31 Aug 2024 07:28:51 -0400 Subject: [PATCH 3/3] Fix nodedeploy -c with profile Remove vestigial statement near end, and put an up front clarification to a user trying to use both '-c' and a profile on the same command line. --- confluent_client/bin/nodedeploy | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/confluent_client/bin/nodedeploy b/confluent_client/bin/nodedeploy index 52e3a7d9..15e78f37 100755 --- a/confluent_client/bin/nodedeploy +++ b/confluent_client/bin/nodedeploy @@ -81,6 +81,12 @@ def main(args): if not args.profile and args.network: sys.stderr.write('Both noderange and a profile name are required arguments to request a network deployment\n') return 1 + if args.clear and args.profile: + sys.stderr.write( + 'The -c/--clear option should not be used with a profile, ' + 'it is a request to not deploy any profile, and will clear ' + 'whatever the current profile is without being specified\n') + return 1 if extra: sys.stderr.write('Unrecognized arguments: ' + repr(extra) + '\n') c = client.Command() @@ -166,8 +172,6 @@ def main(args): ','.join(errnodes))) return 1 rc |= c.simple_noderange_command(args.noderange, '/power/state', 'boot') - if args.network and not args.prepareonly: - return rc return 0 if __name__ == '__main__':