summaryrefslogtreecommitdiffstats
path: root/discover
diff options
context:
space:
mode:
Diffstat (limited to 'discover')
-rw-r--r--discover/device-handler.c20
-rw-r--r--discover/platform.c1
2 files changed, 21 insertions, 0 deletions
diff --git a/discover/device-handler.c b/discover/device-handler.c
index 7f7081d..b93cdfa 100644
--- a/discover/device-handler.c
+++ b/discover/device-handler.c
@@ -441,6 +441,22 @@ static int default_option_priority(struct discover_boot_option *opt)
return 0;
}
+static bool device_allows_default(struct discover_device *dev)
+{
+ const char *dev_str;
+
+ dev_str = config_get()->boot_device;
+
+ if (!dev_str || !strlen(dev_str))
+ return true;
+
+ /* default devices are specified by UUIDs at present */
+ if (strcmp(dev->uuid, dev_str))
+ return false;
+
+ return true;
+}
+
static void set_default(struct device_handler *handler,
struct discover_boot_option *opt)
{
@@ -449,6 +465,10 @@ static void set_default(struct device_handler *handler,
if (!handler->autoboot_enabled)
return;
+ /* do we allow default-booting from this device? */
+ if (!device_allows_default(opt->device))
+ return;
+
new_prio = default_option_priority(opt);
/* A negative priority indicates that we don't want to boot this device
diff --git a/discover/platform.c b/discover/platform.c
index d745712..3ab6b7b 100644
--- a/discover/platform.c
+++ b/discover/platform.c
@@ -88,6 +88,7 @@ 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->n_boot_priorities = 2;
config->boot_priorities = talloc_array(config, struct boot_priority,
OpenPOWER on IntegriCloud