[sanboot] Extend the "keep-san" option to non-iSCSI SAN protocols
This disgustingly ugly hack just keeps getting worse.
This commit is contained in:
parent
67015d1011
commit
be670840c7
|
@ -49,6 +49,10 @@ static int aoeboot ( const char *root_path ) {
|
|||
rc = int13_boot ( drive.drive );
|
||||
printf ( "Boot failed\n" );
|
||||
|
||||
/* Leave drive registered, if instructed to do so */
|
||||
if ( keep_san() )
|
||||
return rc;
|
||||
|
||||
printf ( "Unregistering BIOS drive %#02x\n", drive.drive );
|
||||
unregister_int13_drive ( &drive );
|
||||
|
||||
|
|
|
@ -50,6 +50,10 @@ static int ib_srpboot ( const char *root_path ) {
|
|||
rc = int13_boot ( drive->drive );
|
||||
printf ( "Boot failed\n" );
|
||||
|
||||
/* Leave drive registered, if instructed to do so */
|
||||
if ( keep_san() )
|
||||
return rc;
|
||||
|
||||
printf ( "Unregistering BIOS drive %#02x\n", drive->drive );
|
||||
unregister_int13_drive ( drive );
|
||||
|
||||
|
|
|
@ -4,28 +4,16 @@
|
|||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <gpxe/iscsi.h>
|
||||
#include <gpxe/settings.h>
|
||||
#include <gpxe/dhcp.h>
|
||||
#include <gpxe/netdevice.h>
|
||||
#include <gpxe/ibft.h>
|
||||
#include <gpxe/init.h>
|
||||
#include <gpxe/sanboot.h>
|
||||
#include <int13.h>
|
||||
#include <usr/autoboot.h>
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER );
|
||||
|
||||
struct setting keep_san_setting __setting = {
|
||||
.name = "keep-san",
|
||||
.description = "Preserve SAN connection",
|
||||
.tag = DHCP_EB_KEEP_SAN,
|
||||
.type = &setting_type_int8,
|
||||
};
|
||||
|
||||
static int iscsiboot ( const char *root_path ) {
|
||||
struct scsi_device *scsi;
|
||||
struct int13_drive *drive;
|
||||
int keep_san;
|
||||
int rc;
|
||||
|
||||
scsi = zalloc ( sizeof ( *scsi ) );
|
||||
|
@ -67,12 +55,8 @@ static int iscsiboot ( const char *root_path ) {
|
|||
printf ( "Boot failed\n" );
|
||||
|
||||
/* Leave drive registered, if instructed to do so */
|
||||
keep_san = fetch_intz_setting ( NULL, &keep_san_setting );
|
||||
if ( keep_san ) {
|
||||
printf ( "Preserving connection to SAN disk\n" );
|
||||
shutdown_exit_flags |= SHUTDOWN_KEEP_DEVICES;
|
||||
if ( keep_san() )
|
||||
return rc;
|
||||
}
|
||||
|
||||
printf ( "Unregistering BIOS drive %#02x\n", drive->drive );
|
||||
unregister_int13_drive ( drive );
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <gpxe/settings.h>
|
||||
#include <gpxe/dhcp.h>
|
||||
#include <gpxe/init.h>
|
||||
#include <gpxe/sanboot.h>
|
||||
#include <usr/autoboot.h>
|
||||
|
||||
struct setting keep_san_setting __setting = {
|
||||
.name = "keep-san",
|
||||
.description = "Preserve SAN connection",
|
||||
.tag = DHCP_EB_KEEP_SAN,
|
||||
.type = &setting_type_int8,
|
||||
};
|
||||
|
||||
int keep_san ( void ) {
|
||||
int keep_san;
|
||||
|
||||
keep_san = fetch_intz_setting ( NULL, &keep_san_setting );
|
||||
if ( ! keep_san )
|
||||
return 0;
|
||||
|
||||
printf ( "Preserving connection to SAN disk\n" );
|
||||
shutdown_exit_flags |= SHUTDOWN_KEEP_DEVICES;
|
||||
return 1;
|
||||
}
|
|
@ -15,4 +15,6 @@ struct sanboot_protocol {
|
|||
|
||||
#define __sanboot_protocol __table_entry ( SANBOOT_PROTOCOLS, 01 )
|
||||
|
||||
extern int keep_san ( void );
|
||||
|
||||
#endif /* _GPXE_SANBOOT_H */
|
||||
|
|
Reference in New Issue