Add serial/local-tty auto-discovery capability
This series brings support for the auto-discovery of serial ports, both on the gateway side, and the test machine side:
- The gateway needs to associate serial ports to a machine
- The test machine needs to know which serial port is connected to the gateway
Feature 1. can be accomplished by having the test machine print the machine id on the serial console (SALAD.machine_id=xxxxxx
), while feature 2 is implemented by allowing a test machine to ping the gateway (SALAD.ping
) on all the serial ports, and wait for an answer (SALAD.pong
). The first port that answers is picked for registration!
Feature 2. is however a little more complex in practice, because once the kernel is using a serial port as a console, reading from it fails. The solution is to use stdout/stdin when /dev/console is bound to a serial port, but the issue is that I do not know yet how to detect that. My current solution is to use stdout/stdin when checking the configuration, and to expect no serial console when registering the machine.
That's it!