summaryrefslogtreecommitdiffstats
path: root/src/usr
diff options
context:
space:
mode:
authorMichael Brown2017-03-26 14:12:11 +0200
committerMichael Brown2017-03-26 15:06:02 +0200
commitbb5a54b79a414082d0b39d478a8b3332c56d68e5 (patch)
treec022d5b8ed56be56414eb007273aeacd57c44d37 /src/usr
parent[block] Add dummy SAN device (diff)
downloadipxe-bb5a54b79a414082d0b39d478a8b3332c56d68e5.tar.gz
ipxe-bb5a54b79a414082d0b39d478a8b3332c56d68e5.tar.xz
ipxe-bb5a54b79a414082d0b39d478a8b3332c56d68e5.zip
[block] Add basic multipath support
Add basic support for multipath block devices. The "sanboot" and "sanhook" commands now accept a list of SAN URIs. We open all URIs concurrently. The first connection to become available for issuing block device commands is marked as the active path and used for all subsequent commands; all other connections are then closed. Whenever the active path fails, we reopen all URIs and repeat the process. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/usr')
-rw-r--r--src/usr/autoboot.c14
-rw-r--r--src/usr/pxemenu.c2
2 files changed, 9 insertions, 7 deletions
diff --git a/src/usr/autoboot.c b/src/usr/autoboot.c
index 57bf96ef..a0c79351 100644
--- a/src/usr/autoboot.c
+++ b/src/usr/autoboot.c
@@ -109,7 +109,8 @@ const struct setting skip_san_boot_setting __setting ( SETTING_SANBOOT_EXTRA,
* Boot from filename and root-path URIs
*
* @v filename Filename
- * @v root_path Root path
+ * @v root_paths Root path(s)
+ * @v root_path_count Number of root paths
* @v drive SAN drive (if applicable)
* @v flags Boot action flags
* @ret rc Return status code
@@ -120,14 +121,14 @@ const struct setting skip_san_boot_setting __setting ( SETTING_SANBOOT_EXTRA,
* provide backwards compatibility for the "keep-san" and
* "skip-san-boot" options.
*/
-int uriboot ( struct uri *filename, struct uri *root_path, int drive,
- unsigned int flags ) {
+int uriboot ( struct uri *filename, struct uri **root_paths,
+ unsigned int root_path_count, int drive, unsigned int flags ) {
struct image *image;
int rc;
/* Hook SAN device, if applicable */
- if ( root_path ) {
- drive = san_hook ( root_path, drive );
+ if ( root_path_count ) {
+ drive = san_hook ( drive, root_paths, root_path_count );
if ( drive < 0 ) {
rc = drive;
printf ( "Could not open SAN device: %s\n",
@@ -396,7 +397,8 @@ int netboot ( struct net_device *netdev ) {
}
/* Boot using next server, filename and root path */
- if ( ( rc = uriboot ( filename, root_path, san_default_drive(),
+ if ( ( rc = uriboot ( filename, &root_path, ( root_path ? 1 : 0 ),
+ san_default_drive(),
( root_path ? 0 : URIBOOT_NO_SAN ) ) ) != 0 )
goto err_uriboot;
diff --git a/src/usr/pxemenu.c b/src/usr/pxemenu.c
index 2d05d3f5..391d698a 100644
--- a/src/usr/pxemenu.c
+++ b/src/usr/pxemenu.c
@@ -378,7 +378,7 @@ int pxe_menu_boot ( struct net_device *netdev ) {
return -ENOMEM;
/* Attempt boot */
- rc = uriboot ( uri, NULL, 0, URIBOOT_NO_SAN );
+ rc = uriboot ( uri, NULL, 0, 0, URIBOOT_NO_SAN );
uri_put ( uri );
return rc;
}