summaryrefslogtreecommitdiffstats
path: root/discover/platform.c
diff options
context:
space:
mode:
authorSamuel Mendoza-Jonas <sam.mj@au1.ibm.com>2015-01-21 16:12:14 +1100
committerSamuel Mendoza-Jonas <sam.mj@au1.ibm.com>2015-05-05 15:03:46 +1000
commita3e3b66fbcb18174fc54ffd771ef3a38c9f8defd (patch)
tree50b135545e3c6972b8bf9a9c49634165fc92cc52 /discover/platform.c
parentec12bbd7bbfb3dd31dbd987ecff463542d54542f (diff)
downloadtalos-petitboot-a3e3b66fbcb18174fc54ffd771ef3a38c9f8defd.tar.gz
talos-petitboot-a3e3b66fbcb18174fc54ffd771ef3a38c9f8defd.zip
petitboot: Implement ordered boot options
Move petitboot to a more familiar 'boot-order' based autoboot system. The discover server now reads multiple values from the petitboot,bootdev parameter and adds them in order to config->autoboot_opts. Boot priority is determined by the options' position in the list. On the client, nc-config now recognises the new boot order, and allows the user to add, remove, and reorder the devices in the list. Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
Diffstat (limited to 'discover/platform.c')
-rw-r--r--discover/platform.c32
1 files changed, 14 insertions, 18 deletions
diff --git a/discover/platform.c b/discover/platform.c
index 4451589..74e2a82 100644
--- a/discover/platform.c
+++ b/discover/platform.c
@@ -62,16 +62,13 @@ static void dump_config(struct config *config)
for (i = 0; i < config->network.n_dns_servers; i++)
pb_log(" dns server %s\n", config->network.dns_servers[i]);
- if (config->boot_device)
- pb_log(" boot device %s\n", config->boot_device);
-
- if (config->n_boot_priorities)
- pb_log(" boot priority order:\n");
-
- for (i = 0; i < config->n_boot_priorities; i++) {
- struct boot_priority *prio = &config->boot_priorities[i];
- pb_log(" %10s: %d\n", device_type_name(prio->type),
- prio->priority);
+ for (i = 0; i < config->n_autoboot_opts; i++) {
+ if (config->autoboot_opts[i].boot_type == BOOT_DEVICE_TYPE)
+ pb_log(" boot device %d: %s\n", i,
+ device_type_name(config->autoboot_opts[i].type));
+ else
+ pb_log(" boot device %d: uuid: %s\n",
+ i, config->autoboot_opts[i].uuid);
}
pb_log(" IPMI boot device 0x%02x%s\n", config->ipmi_bootdev,
@@ -109,17 +106,16 @@ void config_set_defaults(struct config *config)
config->network.n_interfaces = 0;
config->network.dns_servers = NULL;
config->network.n_dns_servers = 0;
- config->boot_device = NULL;
config->safe_mode = false;
config->lang = NULL;
- config->n_boot_priorities = 2;
- 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 = 0;
- config->boot_priorities[1].type = DEVICE_TYPE_ANY;
- config->boot_priorities[1].priority = 1;
+ config->n_autoboot_opts = 2;
+ config->autoboot_opts = talloc_array(config, struct autoboot_option,
+ config->n_autoboot_opts);
+ config->autoboot_opts[0].boot_type = BOOT_DEVICE_TYPE;
+ config->autoboot_opts[0].type = DEVICE_TYPE_NETWORK;
+ config->autoboot_opts[1].boot_type = BOOT_DEVICE_TYPE;
+ config->autoboot_opts[1].type = DEVICE_TYPE_ANY;
config->ipmi_bootdev = 0;
config->ipmi_bootdev_persistent = false;
OpenPOWER on IntegriCloud