Skip to content

Commit

Permalink
[autoboot] Introduce "skip-san-boot" option
Browse files Browse the repository at this point in the history
For some install-to-SAN scenarios, the OS needs to be able to reboot
to reread the partition table.  On this second boot attempt, the SAN
disk will not be empty and so iPXE will attempt to boot from it,
rather than falling back to the OS' installation media.

Work around this problem by introducing the "skip-san-boot" option,
similar in spirit to "keep-san".

Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
  • Loading branch information
hansendc authored and mcb30 committed Oct 21, 2010
1 parent 246624c commit 053d286
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
12 changes: 10 additions & 2 deletions src/include/ipxe/dhcp.h
Expand Up @@ -293,11 +293,19 @@ struct dhcp_client_uuid {
*
* If set to a non-zero value, iPXE will not detach any SAN drive
* after failing to boot from it. (This option is required in order
* to perform a Windows Server 2008 installation direct to an iSCSI
* target.)
* to perform an installation direct to an iSCSI target.)
*/
#define DHCP_EB_KEEP_SAN DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0x08 )

/** Skip booting from SAN drive
*
* If set to a non-zero value, iPXE will skip booting from any SAN
* drive. (This option is sometimes required in conjunction with @c
* DHCP_EB_KEEP_SAN in order to perform an installation direct to an
* iSCSI target.)
*/
#define DHCP_EB_SKIP_SAN_BOOT DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0x09 )

/*
* Tags in the range 0x10-0x7f are reserved for feature markers
*
Expand Down
21 changes: 17 additions & 4 deletions src/usr/autoboot.c
Expand Up @@ -136,6 +136,14 @@ struct setting keep_san_setting __setting = {
.type = &setting_type_int8,
};

/** The "skip-san-boot" setting */
struct setting skip_san_boot_setting __setting = {
.name = "skip-san-boot",
.description = "Do not boot the SAN drive after connecting",
.tag = DHCP_EB_SKIP_SAN_BOOT,
.type = &setting_type_int8,
};

/**
* Boot using root path
*
Expand Down Expand Up @@ -171,10 +179,15 @@ int boot_root_path ( const char *root_path ) {
goto err_describe;
}

printf ( "Booting from SAN device %#02x\n", drive );
rc = san_boot ( drive );
printf ( "Boot from SAN device %#02x failed: %s\n",
drive, strerror ( rc ) );
/* Boot from SAN device */
if ( fetch_intz_setting ( NULL, &skip_san_boot_setting) != 0 ) {
printf ( "Skipping boot from SAN device %#02x\n", drive );
} else {
printf ( "Booting from SAN device %#02x\n", drive );
rc = san_boot ( drive );
printf ( "Boot from SAN device %#02x failed: %s\n",
drive, strerror ( rc ) );
}

/* Leave drive registered, if instructed to do so */
if ( fetch_intz_setting ( NULL, &keep_san_setting ) != 0 ) {
Expand Down

0 comments on commit 053d286

Please sign in to comment.