summaryrefslogtreecommitdiffstats
path: root/discover
Commit message (Collapse)AuthorAgeFilesLines
...
* discover/grub2: Implement parserJeremy Kerr2013-09-241-1/+39
| | | | | | | | Add our simple parser to handle a grub2 script. Since we're not building a parse tree at the moment (we have no reduce rules), we just have a simple word-based %union for our tokens. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Initial grub2 lexerJeremy Kerr2013-09-243-0/+186
| | | | | | Add a simple flex lexer to tokenise our grub2 config files. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/boot: Add booting status messageJeremy Kerr2013-09-231-0/+13
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/boot: Allow printf formatting in update_statusJeremy Kerr2013-09-231-3/+9
| | | | | | | It'd be nice to include arbitrary format strings here, so do a taloc_vasprintf in update_status. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/boot: Fix log message with no newlineJeremy Kerr2013-09-231-1/+1
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: clear default_timeout waiter on timeoutJeremy Kerr2013-09-231-0/+2
| | | | | | We don't want cancel_default to try to remove an already-removed waiter. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Don't register multiple boot_timeout waitersJeremy Kerr2013-09-231-2/+8
| | | | | | | Rather than adding another timeout waiter, just override handler->default_boot_option and extend the timeout a little. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/pxe: Implement default optionsJeremy Kerr2013-09-201-4/+24
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Implement device prioritiesJeremy Kerr2013-09-191-4/+37
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: register network devices with the device handlerJeremy Kerr2013-09-193-14/+29
| | | | | | | We'd like to correlate incoming network boot options with a device, so register the interface with the device hander. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/network: Manage network->interfaces with {add,remove}_interfaceJeremy Kerr2013-09-191-2/+14
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/network: ignore devices with zero MTUJeremy Kerr2013-09-191-1/+6
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Remove unnecessary event passingJeremy Kerr2013-09-197-491/+467
| | | | | | | | | | | | | | | Currently, we pass "events" between the udev, user-event and device-handler layers. These events all get sent through device_handler_event, then de-multiplexed to an appropriate handler, depending on their source. Instead, just export relevant device_handler functions, and have the (old) event sources call these functions directly. This also means we can include a lot more of the device hander code in the parser tests. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/boot: Fix use-after-free in boot()Jeremy Kerr2013-09-191-2/+2
| | | | | | We need boot_task for kexec_reboot. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/log: Cleanup log APIJeremy Kerr2013-09-191-9/+10
| | | | | | | | | | Rather than exposing log internals (through always_flush and set_stream), do all logging init through pb_log_init(). If pb_log_init() hasn't been called, pb_log will drop messages. Also, add a pb_debug() function, specifically for debugging information. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Consolidate device path, name and ID.Jeremy Kerr2013-09-193-31/+9
| | | | | | | | | | | | This change cleans up our usage of device path, names and IDs. Device ID is the kernel name for the device. We also expose this through lookup_by_name. Device path is the path to the dev node (ie, always starts with /dev/), and is only used for mounting. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: populate udev device typesJeremy Kerr2013-09-182-0/+23
| | | | | | Now that we have device types, populate from the udev info. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/pb-config: Add autoboot timeout to configuration varsJeremy Kerr2013-09-182-3/+1
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/pxe: check for a valid boot option before addingJeremy Kerr2013-09-061-1/+2
| | | | | | | | | | If we didn't find any valid boot options in the pxe buffer, we'll call discover_context_add_boot_option with a NULL boot option. This change adds a check before we try to add the boot option, and a test to verify this situation. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/yaboot-parser: Handle 'partition=' directive overrideNeelesh Gupta2013-08-301-4/+16
| | | | | | | | | | | | | | | In a yaboot conf file, we may see a device= directive that actually specifies a partition (eg, sda1) rather than the underlying block device (sda). If we then encounter a partition= directive, we don't handle the resolution of the partition correctly, as we simply append the partition number to the device= string. This change implements a smarter handling of the partition= directive, where we strip away any partition information from the device= parameter first. Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/process: Add dry_run argument to process_initJeremy Kerr2013-08-201-1/+1
| | | | | | | Implement dry-run behaviour on the discover server by passing a bool to process_init. UIs don't need to support dry runs. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/process: replace pb_run_cmdJeremy Kerr2013-08-194-143/+94
| | | | | | | This change replaces the pb_run_cmd() function with proper usage of the process API. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/process: replace pb_run_cmd_pipeJeremy Kerr2013-08-192-14/+36
| | | | | | Replace pb_run_cmd_pipe with process_create / process_run_sync. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/boot: talloc struct boot_taskJeremy Kerr2013-08-191-38/+34
| | | | | | | | | Rather than using the stack for struct boot_task, talloc one instead. This gives us a short-lived context (active for the boot() process only), and we don't need to use the externally-provided context directly. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: remove unused user_event_triggerJeremy Kerr2013-08-193-14/+0
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/waiter: remove waitset_destroyJeremy Kerr2013-08-191-1/+0
| | | | | | We can rely on the ctx free to destroy the waitset. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/file: Add sensible perms when using replace_fileJeremy Kerr2013-08-161-0/+3
| | | | | | Rather than no access at all, use a default of 0644. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/network: free buffers from resolv.conf updateJeremy Kerr2013-08-161-7/+8
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/network: fix incorrect nameserver directive in resolv.confJeremy Kerr2013-08-161-1/+1
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* network: handle DNS configJeremy Kerr2013-08-081-0/+57
| | | | | | If we have a dns config option, update resolv.conf Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/file: Add replace_file()Jeremy Kerr2013-08-082-0/+44
| | | | | | Add a function to atomically replace a file. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: separate file-reading code into file.cJeremy Kerr2013-08-084-53/+103
| | | | | | | We'll need to read files in the network config code, so add a 'file' object, containing the read_file function. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: remove libparser objectJeremy Kerr2013-08-081-21/+14
| | | | | | | | There's no real need for a separate libparser object. Our tests pull-in the parsers directly, and the discover server is the only thing that actually links to libparser.ro. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* config: Split interface configuration from network configurationJeremy Kerr2013-08-081-7/+7
| | | | | | | | This change moves the interface configuration into its own 'struct interface_config'. We also remove the _config suffix from the network and interface members. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/yaboot: implement default optionsJeremy Kerr2013-08-071-0/+7
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/yaboot: fix device parsingJeremy Kerr2013-08-071-67/+72
| | | | | | | | | | | | | | | A couple of fixes for yaboot's device-handling code. Firstly, we need to use 'device=' rather than 'root=', as the latter is purely for ybin, to define where the yaboot binary goes. Secondly, we need to respect global and option-specific device= parameters. To do this, we keep all boot_image and initrd strings in the state, and create the actual resources in yaboot_finish. Add a test for all override cases, and fix the incorrect boot= parsing in the rh8 test. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/yaboot: Allow all image options to be overridden by global optionsJeremy Kerr2013-08-071-29/+73
| | | | | | | | | | All of the image options should be overridable by global options. Instead of building the boot_args during yaboot_process_pair, we add discovered data into the state struct, then create the boot args from this data during yaboot_finish Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: fix segfault on failed boot image loadJeremy Kerr2013-08-011-2/+3
| | | | | | | | | | If the boot image fails to load, we end up calling talloc_free on an unitialised are of stack (boot_task.local_initrd). Move the initialisers a little earlier, so we always NULL pointers before potentially freeing. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* parser/yaboot: Fix check for image presenceJeremy Kerr2013-07-311-1/+2
| | | | | | | | | | In the cleanup of yaboot option state, 3fb8fb6fb, we change from checking opt->boot_image to opt, to indicate that we're parsing an image section. We missed one check, which is causing a segfault due to the null opt. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Hookup --no-autoboot to configGeoff Levand2013-07-231-0/+3
| | | | | | | Add new routine config_set_autoboot(), and use it to set the --no-autoboot option. Signed-off-by: Geoff Levand <geoff@infradead.org>
* discover: Add --no-autoboot optionGeoff Levand2013-07-231-3/+10
| | | | | | | Add the command line option --no-autoboot to pb-discover and update the pb-discover manpage. Signed-off-by: Geoff Levand <geoff@infradead.org>
* discover: Log autoboot timeoutGeoff Levand2013-07-231-3/+5
| | | | Signed-off-by: Geoff Levand <geoff@infradead.org>
* discover: Rename default_enabledGeoff Levand2013-07-231-4/+4
| | | | | | | Rename default_enabled to autoboot_enabled for consistency with pb-config. Signed-off-by: Geoff Levand <geoff@infradead.org>
* discover: Add grub.cfg path for openSUSEGeoff Levand2013-07-231-0/+1
| | | | Signed-off-by: Geoff Levand <geoff@infradead.org>
* automake: Add $(EXEEXT) to .ro objectsGeoff Levand2013-07-231-1/+1
| | | | Signed-off-by: Geoff Levand <geoff@infradead.org>
* discover: Don't free URL in load_urlJeremy Kerr2013-07-231-1/+0
| | | | | | | | | | | | | Previously, load_url took a char * argument, from which it parsed a newly allocated URL, and freed the URL before returning. Commit 5be946c changed load_url (then load_file) to accept a parsed URL instead of a char *, but didn't remove the free. Any URLs passed to load_url are currently being unintionally free()ed. This change removes the invalid free. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/pxe: remove debug statementJeremy Kerr2013-07-231-1/+0
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/pxe: Handle initrdsJeremy Kerr2013-07-231-1/+25
| | | | | | | We may see initrds specified on the kernel argument line, or as their own configuration directive. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/pxe-parser: All options are name <space> value pairsJeremy Kerr2013-07-041-0/+3
| | | | | | Abort the pair parse if we don't have both a name and a value. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/device-handler: hook up autoboot_enabled config varJeremy Kerr2013-07-021-1/+2
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
OpenPOWER on IntegriCloud