summaryrefslogtreecommitdiffstats
path: root/discover
diff options
context:
space:
mode:
authorNishanth Aravamudan <nacc@linux.vnet.ibm.com>2015-08-19 14:05:05 -0700
committerSamuel Mendoza-Jonas <sam.mj@au1.ibm.com>2015-12-18 13:06:53 +1100
commit32d3249e252fe201eb81155cbf3b800ce5cf88e0 (patch)
treeb5666989c2906d1a923d297f01208fb01ed8abbb /discover
parent45e9e7a53540e87e2129bb11fd853501131fb795 (diff)
downloadtalos-petitboot-32d3249e252fe201eb81155cbf3b800ce5cf88e0.tar.gz
talos-petitboot-32d3249e252fe201eb81155cbf3b800ce5cf88e0.zip
ui: add URL for static configurations to load a specified file
In certain configurations, e.g. automation, we want to use static networking but load a particular file, automatically and parse it as a pxelinux config file. Currently, we support something like this for DHCP based booting, but not static. Add a URL field to the UI for static configurations and reuse the logic from device_handler_process_url() to load the specified file. Signed-off-by: Nishanth Aravamudan <nacc@linux.vnet.ibm.com> Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
Diffstat (limited to 'discover')
-rw-r--r--discover/network.c11
-rw-r--r--discover/platform-powerpc.c14
-rw-r--r--discover/platform.c1
3 files changed, 21 insertions, 5 deletions
diff --git a/discover/network.c b/discover/network.c
index 0dad087..f763687 100644
--- a/discover/network.c
+++ b/discover/network.c
@@ -336,7 +336,8 @@ static void configure_interface_dhcp(struct interface *interface)
return;
}
-static void configure_interface_static(struct interface *interface,
+static void configure_interface_static(struct network *network,
+ struct interface *interface,
const struct interface_config *config)
{
int rc;
@@ -370,6 +371,12 @@ static void configure_interface_static(struct interface *interface,
interface->name);
}
+ if (config->static_config.url) {
+ pb_log("config URL %s\n", config->static_config.url);
+ device_handler_process_url(network->handler,
+ config->static_config.url);
+ }
+
return;
}
@@ -438,7 +445,7 @@ static void configure_interface(struct network *network,
configure_interface_dhcp(interface);
} else if (config->method == CONFIG_METHOD_STATIC) {
- configure_interface_static(interface, config);
+ configure_interface_static(network, interface, config);
}
}
diff --git a/discover/platform-powerpc.c b/discover/platform-powerpc.c
index 7370d7d..5abc4d7 100644
--- a/discover/platform-powerpc.c
+++ b/discover/platform-powerpc.c
@@ -310,7 +310,7 @@ static int parse_one_interface_config(struct config *config,
} else if (!strcmp(tok, "static")) {
ifconf->method = CONFIG_METHOD_STATIC;
- /* ip/mask, [optional] gateway */
+ /* ip/mask, [optional] gateway, [optional] url */
tok = strtok_r(NULL, ",", &saveptr);
if (!tok)
goto out_err;
@@ -323,6 +323,12 @@ static int parse_one_interface_config(struct config *config,
talloc_strdup(ifconf, tok);
}
+ tok = strtok_r(NULL, ",", &saveptr);
+ if (tok) {
+ ifconf->static_config.url =
+ talloc_strdup(ifconf, tok);
+ }
+
} else {
pb_log("Unknown network configuration method %s\n", tok);
goto out_err;
@@ -575,10 +581,12 @@ static char *iface_config_str(void *ctx, struct interface_config *config)
str = talloc_asprintf_append(str, "dhcp");
} else if (config->method == CONFIG_METHOD_STATIC) {
- str = talloc_asprintf_append(str, "static,%s%s%s",
+ str = talloc_asprintf_append(str, "static,%s%s%s%s%s",
config->static_config.address,
config->static_config.gateway ? "," : "",
- config->static_config.gateway ?: "");
+ config->static_config.gateway ?: "",
+ config->static_config.url ? "," : "",
+ config->static_config.url ?: "");
}
return str;
}
diff --git a/discover/platform.c b/discover/platform.c
index 5f448f1..fc0930d 100644
--- a/discover/platform.c
+++ b/discover/platform.c
@@ -60,6 +60,7 @@ static void dump_config(struct config *config)
pb_log(" static:\n");
pb_log(" ip: %s\n", ifconf->static_config.address);
pb_log(" gw: %s\n", ifconf->static_config.gateway);
+ pb_log(" url: %s\n", ifconf->static_config.url);
}
}
OpenPOWER on IntegriCloud