~raharper/curtin/trunk.fix-bcache-sysfs-write-failures-on-remove

Viewing all changes in revision 517.

  • Committer: Scott Moser
  • Date: 2017-08-03 16:46:08 UTC
  • mfrom: (508.2.20 trunk.tgt-cleanup)
  • Revision ID: smoser@ubuntu.com-20170803164608-4de4u4wlrm34ggbc
tools/jenkins-runner: improve tgtd cleanup logic

The previous tgtd cleanup logic was hard to follow at best. It was buggy
in that it would always kill the TGT_PID process even if it didn't start it.
both cleanup lines ended with:
  <condition> || [ -n "${TGT_PID}" ] && kill -9 ${TGT_PID}
which will always run the 'kill' if TGT_PID is non-empty.

Also:
 * clean up the output of tools/jenkins-runner by redirecting
   the find-tgt.d to a file so you don't see its debug messages.
 * use modulus to get a port in the right range.
 * improve the picking of a port and then checking to see if it was used.
   I believe a race condition where tgt wasn't listening on the port when
   netstat would run lead to false positives for failures where a
   sleep would have sufficed.
 * remove the tgt socket file(s) if it was created.

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: