summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2014-12-11 16:38:21 +0800
committerJeremy Kerr <jk@ozlabs.org>2014-12-15 15:47:40 +0800
commitd3e95283e69d3099fe9f36e56be1f645f565c843 (patch)
tree42e2f2c71ede42c9922a327b26340b5909f65b5a /lib
parentf69fabee4a120cebaeff2359350e62bd960088f4 (diff)
downloadtalos-petitboot-d3e95283e69d3099fe9f36e56be1f645f565c843.tar.gz
talos-petitboot-d3e95283e69d3099fe9f36e56be1f645f565c843.zip
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 <jk@ozlabs.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/pb-config/pb-config.c3
-rw-r--r--lib/pb-protocol/pb-protocol.c14
-rw-r--r--lib/types/types.h6
3 files changed, 22 insertions, 1 deletions
diff --git a/lib/pb-config/pb-config.c b/lib/pb-config/pb-config.c
index fbaa7cb..a2272f4 100644
--- a/lib/pb-config/pb-config.c
+++ b/lib/pb-config/pb-config.c
@@ -74,6 +74,9 @@ struct config *config_copy(void *ctx, const struct config *src)
else
dest->boot_device = NULL;
+ dest->ipmi_bootdev = src->ipmi_bootdev;
+ dest->ipmi_bootdev_persistent = src->ipmi_bootdev_persistent;
+
if (src->lang && strlen(src->lang))
dest->lang = talloc_strdup(dest, src->lang);
else
diff --git a/lib/pb-protocol/pb-protocol.c b/lib/pb-protocol/pb-protocol.c
index 866673d..4398248 100644
--- a/lib/pb-protocol/pb-protocol.c
+++ b/lib/pb-protocol/pb-protocol.c
@@ -284,6 +284,8 @@ int pb_protocol_config_len(const struct config *config)
len += 4 + optional_strlen(config->boot_device);
+ len += 4 + 4; /* ipmi_bootdev, ipmi_bootdev_persistent */
+
len += 4 + optional_strlen(config->lang);
return len;
@@ -488,6 +490,11 @@ int pb_protocol_serialise_config(const struct config *config,
pos += pb_protocol_serialise_string(pos, config->boot_device);
+ *(uint32_t *)pos = __cpu_to_be32(config->ipmi_bootdev);
+ pos += 4;
+ *(uint32_t *)pos = config->ipmi_bootdev_persistent;
+ pos += 4;
+
pos += pb_protocol_serialise_string(pos, config->lang);
assert(pos <= buf + buf_len);
@@ -934,9 +941,14 @@ int pb_protocol_deserialise_config(struct config *config,
if (read_string(config, &pos, &len, &str))
goto out;
-
config->boot_device = str;
+ if (read_u32(&pos, &len, &config->ipmi_bootdev))
+ goto out;
+ if (read_u32(&pos, &len, &tmp))
+ goto out;
+ config->ipmi_bootdev_persistent = !!tmp;
+
if (read_string(config, &pos, &len, &str))
goto out;
diff --git a/lib/types/types.h b/lib/types/types.h
index 25bf556..f543b7f 100644
--- a/lib/types/types.h
+++ b/lib/types/types.h
@@ -122,9 +122,15 @@ struct config {
bool autoboot_enabled;
unsigned int autoboot_timeout_sec;
struct network_config network;
+
struct boot_priority *boot_priorities;
unsigned int n_boot_priorities;
+
char *boot_device;
+
+ unsigned int ipmi_bootdev;
+ bool ipmi_bootdev_persistent;
+
char *lang;
/* not user-settable */
OpenPOWER on IntegriCloud