From d3e95283e69d3099fe9f36e56be1f645f565c843 Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Thu, 11 Dec 2014 16:38:21 +0800 Subject: discover: Integrate ipmi bootdev settings into the priority system Currently, we expose the boot device priorities through an array in struct config, which will either be the default (network -> disk), or a single device type specified by the IPMI code. Rather than hide the implementation details in this array, we'd like to expose the details of the machine configuration instead. This allows user visibility of the real boot configuration (for example, if an IPMI boot preference is set). This change removes the priority array, and replaces it with the ipmi_bootdev data (and a persistent flag). We update the default-conflict-resolution code to reflect the priorities between IPMI and UUID preferences. Signed-off-by: Jeremy Kerr --- discover/platform.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'discover/platform.c') diff --git a/discover/platform.c b/discover/platform.c index 0a221e2..7275a5f 100644 --- a/discover/platform.c +++ b/discover/platform.c @@ -91,6 +91,10 @@ static void dump_config(struct config *config) prio->priority); } + pb_log(" IPMI boot device 0x%02x%s\n", config->ipmi_bootdev, + config->ipmi_bootdev_persistent ? " (persistent)" : ""); + + pb_log(" language: %s\n", config->lang ?: ""); } @@ -130,10 +134,13 @@ void config_set_defaults(struct config *config) config->boot_priorities = talloc_array(config, struct boot_priority, config->n_boot_priorities); config->boot_priorities[0].type = DEVICE_TYPE_NETWORK; - config->boot_priorities[0].priority = 2; - config->boot_priorities[1].type = DEVICE_TYPE_DISK; + config->boot_priorities[0].priority = 0; + config->boot_priorities[1].type = DEVICE_TYPE_ANY; config->boot_priorities[1].priority = 1; + config->ipmi_bootdev = 0; + config->ipmi_bootdev_persistent = false; + config->debug = config_debug_on_cmdline(); } @@ -175,8 +182,10 @@ const struct platform *platform_get(void) void platform_finalise_config(void) { - if (platform && platform->finalise_config) - platform->finalise_config(platform); + const struct config *config = config_get(); + + if (platform && config && platform->finalise_config) + platform->finalise_config(platform, config); } int platform_get_sysinfo(struct system_info *info) -- cgit v1.2.1