Commit a2ae7028 authored by Ryan Jackson's avatar Ryan Jackson

Return frisbee server IP in loadinfo

parent c8f791b9
......@@ -26,4 +26,4 @@
* NB: See ron/libsetup.pm. That is version 4! I'll merge that in.
*/
#define DEFAULT_VERSION 2
#define CURRENT_VERSION 30
#define CURRENT_VERSION 31
......@@ -140,6 +140,8 @@ loadone() {
echo "Loading image #$NUM"
ADDRESS=`echo $LOADINFO | sed -e 's/.*ADDR=\([^[:space:]]*\).*/\1/'`
SERVER=`echo $LOADINFO | sed -e 's/.*SERVER=\([^[:space:]]*\).*/\1/'`
SERVER=${SERVER:-$BOSSIP}
PARTITION=`echo $LOADINFO | sed -e 's/.*PART=\([^[:space:]]*\).*/\1/'`
PARTITION=${PARTITION:-'0'}
PARTOS=`echo $LOADINFO | sed -e 's/.*PARTOS=\([^[:space:]]*\).*/\1/'`
......@@ -339,8 +341,8 @@ loadone() {
echo "Running /usr/local/bin/imageunzip -o -O -W 32 $ZFILL $imagefile /dev/${DISK}s${PARTITION}"
/usr/local/bin/imageunzip -o -O -W 32 $ZFILL $imagefile /dev/${DISK}s${PARTITION}
else
echo "Running $BINDIR/frisbee $LOADIP $MEMARGS $ZFILL $SLICE $MCASTIF $MCASTADDR /dev/$DISK at `date`"
$BINDIR/frisbee $LOADIP $MEMARGS $ZFILL $SLICE $MCASTIF $MCASTADDR /dev/$DISK
echo "Running $BINDIR/frisbee -S $SERVER $MEMARGS $ZFILL $SLICE $MCASTIF $MCASTADDR /dev/$DISK at `date`"
$BINDIR/frisbee -S $SERVER $MEMARGS $ZFILL $SLICE $MCASTIF $MCASTADDR /dev/$DISK
fi
fstat=$?
......@@ -395,9 +397,6 @@ STATUS=`$BINDIR/tmcc status`
BOSSIP=`echo $BOSSINFO | awk '{ print $2 }'`
# XXX should be part of loadinfo
LOADIP="-S $BOSSIP"
if [ -x /usr/sbin/ntpdate ]; then
/usr/sbin/ntpdate -b $BOSSIP >/dev/null 2>&1
fi
......
......@@ -133,6 +133,7 @@ write_image()
local slice=$3
local zfill=$4
local ptype=$5
local server=$6
local port=""
local imagefile=""
local frisbee_opts="$FRISBEE_OPTS"
......@@ -207,7 +208,8 @@ write_image()
$BINDIR/tmcc state RELOADING
if [ $protocol = frisbee ]; then
$BINDIR/frisbee -m $address -p $port $frisbee_opts $disk
[ -n "$server" ] || server=$BOSSIP
$BINDIR/frisbee -m $address -p $port -S $server $frisbee_opts $disk
rc=$?
if [ $rc -ne 0 ]; then
......@@ -233,6 +235,7 @@ handle_loadinfo()
{
local LOADINFO="$@"
local ADDRESS=`get_value "$LOADINFO" ADDR`
local SERVER=`get_value "$LOADINFO" SERVER`
local PARTOS=`get_value "$LOADINFO" PARTOS`
local PARTITION=`get_value "$LOADINFO" PART`
PARTITION=${PARTITION:-'0'}
......@@ -305,7 +308,7 @@ handle_loadinfo()
zapsuperblocks /dev/$DISK
fi
write_image $ADDRESS /dev/$DISK $PARTITION $ZFILL $PTYPE
write_image $ADDRESS /dev/$DISK $PARTITION $ZFILL $PTYPE $SERVER
rc=$?
if [ $rc -ne 0 ]; then
echo "Failed to write image to disk, status $rc"
......@@ -397,7 +400,7 @@ $BINDIR/get_edd_map > $BOOTDIR/edd_map 2>/dev/null
FRISBEE_OPTS="-S $BOSSIP"
if [ -e $BOOTDIR/myip ]; then
FRISBEE_OPTS="$FRISBEE_OPTS -i `cat $BOOTDIR/myip`"
FRISBEE_OPTS="-i `cat $BOOTDIR/myip`"
fi
IMAGEUNZIP_OPTS="-o -O -W 32"
......
......@@ -3841,6 +3841,7 @@ COMMAND_PROTOTYPE(doloadinfo)
char buf[MYBUFSIZE];
char *bufp = buf, *ebufp = &buf[sizeof(buf)];
char *disktype, *useacpi, *useasf, address[MYBUFSIZE];
char server_address[MYBUFSIZE];
char mbrvers[51];
char *loadpart, *OS, *prepare;
int disknum, nrows, zfill;
......@@ -3912,11 +3913,12 @@ COMMAND_PROTOTYPE(doloadinfo)
OS = row[2];
prepare = row[8];
res2 = mydb_query("select load_address,frisbee_pid from subboss_images as i "
res2 = mydb_query("select load_address,frisbee_pid,IP from subboss_images as i "
"left join subbosses as s on s.subboss_id = i.subboss_id "
"left join interfaces as n on n.node_id = s.subboss_id "
"where s.node_id = '%s' and s.service = 'frisbee' and "
"i.imageid = '%s' and i.load_address != '' and "
"i.sync != 1", 2, reqp->nodeid, row[7]);
"n.role='ctrl' and i.sync != 1", 3, reqp->nodeid, row[7]);
if (!res2) {
error("doloadinfo: %s: DB Error getting subboss info!\n",
......@@ -3927,6 +3929,7 @@ COMMAND_PROTOTYPE(doloadinfo)
frisbee_pid = 0;
address[0] = '\0';
server_address[0] = '\0';
if (mysql_num_rows(res2)) {
row2 = mysql_fetch_row(res2);
......@@ -3936,12 +3939,16 @@ COMMAND_PROTOTYPE(doloadinfo)
if (row2[1] && row2[1][0])
frisbee_pid = atoi(row2[1]);
strcpy(server_address, row2[2]);
} else {
if (row[0] && row[0][0])
strcpy(address, row[0]);
if (row[3] && row[3][0])
frisbee_pid = atoi(row[3]);
strcpy(server_address, BOSSNODE_IP);
}
mysql_free_result(res2);
......@@ -3960,6 +3967,8 @@ COMMAND_PROTOTYPE(doloadinfo)
OUTPUT(address, sizeof(address),
"%s/spewimage.php?imageid=%s&access_key=%s",
TBBASE, row[7], row[6]);
server_address[0] = 0;
}
else {
/*
......@@ -3984,6 +3993,11 @@ COMMAND_PROTOTYPE(doloadinfo)
bufp += OUTPUT(bufp, ebufp - bufp,
"ADDR=%s PART=%s PARTOS=%s", address, loadpart, OS);
if (server_address[0] && (vers >= 31)) {
bufp += OUTPUT(bufp, ebufp - bufp,
" SERVER=%s", server_address);
}
/*
* Remember zero-fill free space, mbr version fields, and access_key
......
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