From 40a187d2aab4a192e749d06d7dde73c5cf3e59ab Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 16 Mar 2022 14:57:46 -0400 Subject: [PATCH] Reverse ordering of reboot and api arming. Technically there's room for a race condition where boot is attempted before the profile is ready, but it's highly unlikely. Conversely, there is a potential confusing race condition today where restarting a deploymennt without armed api causes it to be disarmed before the boot is attempted. --- confluent_client/bin/nodedeploy | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/confluent_client/bin/nodedeploy b/confluent_client/bin/nodedeploy index 1b11e011..210559b0 100755 --- a/confluent_client/bin/nodedeploy +++ b/confluent_client/bin/nodedeploy @@ -85,6 +85,18 @@ def main(args): sys.stderr.write('Unrecognized arguments: ' + repr(extra) + '\n') c = client.Command() c.stop_if_noderange_over(args.noderange, args.maxnodes) + errnodes = set([]) + if not args.clear and args.network and not args.prepareonly: + rc = c.simple_noderange_command(args.noderange, '/boot/nextdevice', 'network', + bootmode='uefi', + persistent=False, + errnodes=errnodes) + if errnodes: + sys.stderr.write( + 'Unable to set boot device for following nodes: {0}\n'.format( + ','.join(errnodes))) + return 1 + rc |= c.simple_noderange_command(args.noderange, '/power/state', 'boot') if args.clear: cleararm(args.noderange, c) clearpending(args.noderange, c) @@ -139,18 +151,7 @@ def main(args): armed = '' print('{0}: {1}{2}'.format(node, profile, armed)) sys.exit(0) - errnodes = set([]) if args.network and not args.prepareonly: - rc = c.simple_noderange_command(args.noderange, '/boot/nextdevice', 'network', - bootmode='uefi', - persistent=False, - errnodes=errnodes) - if errnodes: - sys.stderr.write( - 'Unable to set boot device for following nodes: {0}\n'.format( - ','.join(errnodes))) - return 1 - rc |= c.simple_noderange_command(args.noderange, '/power/state', 'boot') return rc return 0