Commit 32906417 authored by Mike Hibler's avatar Mike Hibler

Hack to support command line arguments to MFS boots: if the "path" column

in the os_info row contains a space, everything after the space is considered
arguments.  Note that these arguments can be overridden by those in the
nodes table for def_boot and next_boot (but not temp_boot, which has no
corresponding boot_path and boot_cmd_line fields--something that should be
fixed, at the same time moving all these *_boot fields into node_attributes
and out of nodes).
parent bf12c0c2
/*
* EMULAB-COPYRIGHT
* Copyright (c) 2000-2007 University of Utah and the Flux Group.
* Copyright (c) 2000-2008 University of Utah and the Flux Group.
* All rights reserved.
*/
......@@ -141,11 +141,13 @@ query_bootinfo_db(struct in_addr ipaddr, int version, boot_what_t *info)
/*
* If we received a query from a node whose PXE boot program is
* not pxeboot, then it must be coming out of PXEWAIT and we need
* to tell it to reboot again to pick up the new PXE boot program.
* not an "Emulab pxeboot", then the node may be coming out of PXEWAIT
* and we need to tell it to reboot again to pick up the new PXE boot
* program. An "Emulab pxeboot" is one that speaks bootinfo.
*
* XXX if "pxeboot" occurs in the string anywhere we assume it is
* a varient of our pxeboot and we don't do the reboot.
* XXX note that an "Emulab pxeboot" is currently identified by
* its not being the default pxeboot and its path containing the
* string "pxeboot" anywhere.
*/
if (DEFINED(PXE_BOOT_PATH) &&
strstr(row[PXE_BOOT_PATH], "pxeboot") == NULL) {
......@@ -178,6 +180,10 @@ query_bootinfo_db(struct in_addr ipaddr, int version, boot_what_t *info)
rval = 1;
}
if (DEFINED(NEXT_BOOT_CMDLINE)) {
/*
* XXX note that this will override any cmdline
* specified in the osid path. Should append instead?
*/
strncpy(info->cmdline,
row[NEXT_BOOT_CMDLINE], MAX_BOOT_CMDLINE-1);
}
......@@ -232,6 +238,10 @@ query_bootinfo_db(struct in_addr ipaddr, int version, boot_what_t *info)
rval = 1;
}
if (DEFINED(DEF_BOOT_CMDLINE)) {
/*
* XXX note that this will override any cmdline
* specified in the osid path. Should append instead?
*/
strncpy(info->cmdline,
row[DEF_BOOT_CMDLINE], MAX_BOOT_CMDLINE-1);
}
......@@ -345,7 +355,14 @@ parse_mfs_path(char *str, boot_what_t *info)
{
struct hostent *he;
struct in_addr hip;
char *path;
char *path, *args;
/* treat anything after a space as the command line */
args = strchr(str, ' ');
if (args != NULL) {
*args++ = '\0';
strncpy(info->cmdline, args, MAX_BOOT_CMDLINE-1);
}
/* no hostname, just copy string as is */
path = strchr(str, ':');
......
/*
* EMULAB-COPYRIGHT
* Copyright (c) 2000-2007 University of Utah and the Flux Group.
* Copyright (c) 2000-2008 University of Utah and the Flux Group.
* All rights reserved.
*
* boot/bootwhat.h from the OSKit.
* Derived from boot/bootwhat.h in the OSKit.
*/
#ifndef _OSKIT_BOOT_BOOTWHAT_H_
#define _OSKIT_BOOT_BOOTWHAT_H_
#ifndef _EMULAB_BOOTWHAT_H_
#define _EMULAB_BOOTWHAT_H_
#define BOOTWHAT_DSTPORT 6969
#define BOOTWHAT_SRCPORT 9696
......@@ -41,7 +41,7 @@ typedef struct boot_info {
#define BIOPCODE_BOOTWHAT_INFO 5 /* Request for bootinfo */
/* Version */
#define BIVERSION_CURRENT 1 /* Old version is zero */
#define BIVERSION_CURRENT 1 /* First version is zero */
/* Status */
#define BISTAT_SUCCESS 0
......@@ -100,6 +100,6 @@ typedef struct boot_what {
#define BIBOOTWHAT_TYPE_MFS 7 /* Boot an MFS from server:/path */
/* Flags */
#define BIBOOTWHAT FLAGS_CMDLINE 0x01 /* Kernel to boot */
#define BIBOOTWHAT_FLAGS_CMDLINE 0x01 /* Kernel to boot */
#endif /* _OSKIT_BOOT_BOOTWHAT_H_ */
#endif /* _EMULAB_BOOTWHAT_H_ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment