Neelesh Gupta [Mon, 28 Oct 2013 07:16:12 +0000 (12:46 +0530)]
test/parser: Add new test cases to pxe parser
Adding new cases to the pxe parser code of having conffile file without
complete URL and determining conffile names using mac and ip addresses
passed from the udhcpc.
Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Neelesh Gupta [Mon, 28 Oct 2013 07:15:59 +0000 (12:45 +0530)]
test/parser: Update test cases as per new parser requesting conf files
Update the parser test code/cases as per new prototyping of parse()
function which doesn't require buf and len to be passed from the caller,
instead reading the configuration data either embedded or from file to
a parser's known conffile.
Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Neelesh Gupta [Mon, 28 Oct 2013 07:15:21 +0000 (12:45 +0530)]
discover: Change parsers to explicitly request configuration files
Add a new function parser_request_url() to read the data from
configuration files present remotely. We deprecate
iterate_parser_files() and download_config() functions along with the
'filenames' and 'method' members of the 'parser' structure so that
individual parsers would now require to request the configuration files
data from the parser code and doesn't necessarily export the list of
configuration files.
Add the support to handle incoming DHCP event, done by passing all the
relevant environment variables of the udhcpc to the discover code.
Also, update the pxe parser code to populate the list of configuration
file names as per PXELINUX convention of fallback names using mac and ip
addresses of the booting machine.
Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Fri, 1 Nov 2013 02:33:02 +0000 (10:33 +0800)]
lib/log: Always flush after writing logs
We're currently seeing empty log files from the discover server. Rather
than only flishing if the server was compiled with debugging enabled,
always perform the fflush.
Jeremy Kerr [Fri, 25 Oct 2013 06:34:30 +0000 (14:34 +0800)]
discover/network: Allow for arbitrary-sized netlink messages
Currently, we drop any netlink data beyond our 4096-byte buffer. This
means that we can only parse a limited number of network interfaces.
This change uses recvmsg with MSG_PEEK to determine the size of an
incoming netlink message before doing the actual recvmsg. This way, we
can realloc our buffer to suit.
Jeremy Kerr [Tue, 15 Oct 2013 02:25:23 +0000 (10:25 +0800)]
discover: Don't free clients on write failure
Currently, if we see an error when writing to a client, we free the
client immediately. This means that any pending reads will be discarded.
Additionally, if a client disconnects before we have finished the writes in
discover_server_process_connection, we won't register the waiter to read
from the socket.
Instead of freeing the client on write failure, this change sets a flag
(se we don't continue to write), and we rely on the read EOF to free the
client. This means we don't drop incoming messages.
Jeremy Kerr [Fri, 11 Oct 2013 07:16:39 +0000 (15:16 +0800)]
ui/ncurses: Use 'x' as exit key
Because terminals will send escape-sequences starting with escape,
ncurses will pause after receiving a signle escape, to detect
these sequences. This introduces a 1-second delay when exiting the
petitboot UI.
Jeremy Kerr [Thu, 10 Oct 2013 07:35:35 +0000 (15:35 +0800)]
ui/ncurses: Defer item creation until boot editor is done
Currently, when creating new menu entries, we create an empty item, add
it to the menu, then run the boot editor. This means that cancelling the
edit will leave an empty item in the menu.
This change defers the creation until the boot editor is done. To do
this, we modify the on_open callback to take a menu rather than an item,
and pass NULL boot data to the editor.
Jeremy Kerr [Wed, 9 Oct 2013 04:02:08 +0000 (12:02 +0800)]
Add system info messages
Add a little infrastructure for communicating information about the
system to the petitboot UIs. We just send some identifying info (type
and identifier), as well as the interfaces.
Jeremy Kerr [Wed, 9 Oct 2013 05:19:58 +0000 (13:19 +0800)]
discover: Don't call config_set_autoboot before config_init
Change f611bde3 shifted the config_init until after process_init, as we
need to run processes during config init. We also needed to move the
config_set_autoboot invocation too.
Jeremy Kerr [Tue, 1 Oct 2013 04:27:35 +0000 (12:27 +0800)]
discover: Add device_{request,release}_write
Add a pair of functions to the parser API to allow write access to the
underlying device. We'll use this in the GRUB2 parser to implement
environment persistence.
Jeremy Kerr [Fri, 27 Sep 2013 06:16:10 +0000 (14:16 +0800)]
discover: Add test_data member to struct discover_context
We have parsers passing discover_contexts around, which we want to hook
into the test framework. Add a void * member, which the test code can
use to reference the test.
Jeremy Kerr [Thu, 26 Sep 2013 05:51:10 +0000 (13:51 +0800)]
discover/boot: Download resources in parallel
Now that we can download asynchronously, we can download boot resources
in parallel. This also means we don't need a state machine; we're either
not done (loads are still pending) or done.
discover/boot: Implement asynchronous boot() process
The current boot process handled by boot() function is implemented such
that it blocks on the boot resources being downloaded which blocks
the discover process until the download completes. This patch
re-implements the boot() function using callback mechanism and
asynchronous notifications so that boot() returns to continue the
discover process while the download is in progress.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com>
A new load_url_async() function handles retrieving the resources by
forking an external process which currently blocks the parent waiting
for the process to complete. This patch modifies the load_*() functions
to handle it asynchronously by providing the exit callback and returning
without waiting for the child process to exit.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com>
Jeremy Kerr [Tue, 24 Sep 2013 09:31:50 +0000 (17:31 +0800)]
discover: Check for devices with duplicate serial properties
If we have multipath devices present in the system, we'll end up with
duplicate mounts, parse results and boot options. This change adds a
check to see if we've encountered a device with this serial number
previously.
Jeremy Kerr [Tue, 17 Sep 2013 05:02:05 +0000 (13:02 +0800)]
discover/grub2: Create 'conditional' statements
Rather than holding the condition and conditional-statements in struct
grub2_statment_if, create a new conditional type that contains these. We
can then use this to implement elif statements.