Commit eebd0c07 authored by Leigh B. Stoller's avatar Leigh B. Stoller
Browse files

Minor changes to allow jails to report start command status so that

batch jobs will end! There were two problems; 1) The socket was
744, so mere users were not able to run tmcc. 2) libsetup was not
even using the proxy socket cause it was never looking for it.
parent 55db053e
......@@ -20,7 +20,7 @@ use Exporter;
bootsetup nodeupdate startcmdstatus whatsmynickname dosyncserver
TBBackGround TBForkCmd vnodejailsetup plabsetup vnodeplabsetup
dorouterconfig jailsetup dojailconfig JailedMounts findiface
tmccdie tmcctimeout libsetup_getvnodeid dotrafficconfig
tmcctimeout libsetup_getvnodeid dotrafficconfig
ixpsetup dokeyhash donodeid
OPENTMCC CLOSETMCC RUNTMCC MFS REMOTE JAILED PLAB LOCALROOTFS IXP
......@@ -73,6 +73,11 @@ my $inplab;
#
my $inixp;
#
# Inside, there might be a tmcc proxy socket.
#
my $tmccproxy;
# Load up the paths. Its conditionalized to be compatabile with older images.
# Note this file has probably already been loaded by the caller.
BEGIN
......@@ -98,6 +103,22 @@ BEGIN
die("Bad data in vnodeid: $vnodeid");
}
$injail = 1;
#
# Temporary. Will move to tmcc library.
#
if (-e "$BOOTDIR/proxypath") {
open(PP, "$BOOTDIR/proxypath");
$tmccproxy = <PP>;
close(PP);
if ($tmccproxy =~ /^([-\w\.\/]+)$/) {
$tmccproxy = $1;
}
else {
die("Bad data in tmccproxy path: $tmccproxy");
}
}
}
# Determine if running inside a Plab vserver.
......@@ -293,9 +314,8 @@ my $eid = "";
my $vname = "";
# Control tmcc error condition and timeout. Dynamic, not lexical!
$tmccdie = 1;
$tmcctimeout = 0;
my $TMCCTIMEO = 30; # Default timeout on remote nodes.
my $TMCCTIMEO = 30; # Default timeout on remote nodes.
# When on the MFS, we do a much smaller set of stuff.
# Cause of the way the packages are loaded (which I do not understand),
......@@ -359,13 +379,15 @@ sub OPENTMCC($;$$)
if ($tmcctimeout) {
$options .= " -t $tmcctimeout";
}
if (defined($tmccproxy)) {
$options .= " -l $tmccproxy";
}
my $foo = sprintf("%s -v %d $options $NODE $vn $cmd $args |",
TMCC, TMCD_VERSION);
if (!open(TM, $foo)) {
print STDERR "Cannot start TMCC: $!\n";
die("\n") if $tmccdie;
return undef;
}
return (*TM);
......@@ -384,7 +406,6 @@ sub CLOSETMCC($) {
else {
print STDERR "Error closing TMCC pipe: $!\n";
}
die("\n") if $tmccdie;
return 0;
}
return 1;
......
......@@ -685,6 +685,13 @@ sub startproxy($)
# -l option specified all over.
#
$ENV{'TMCCUNIXPATH'} = $insidepath;
#
# The above is good only for direct decendents of the init process.
# So, the above will be phased out in favor of a file in the usual
# place to clue the client in.
#
mysystem("echo $insidepath > $dir/root/${BOOTDIR}/proxypath");
select(undef, undef, undef, 0.2);
return 0;
......
......@@ -20,7 +20,7 @@ use Exporter;
bootsetup nodeupdate startcmdstatus whatsmynickname dosyncserver
TBBackGround TBForkCmd vnodejailsetup plabsetup vnodeplabsetup
dorouterconfig jailsetup dojailconfig JailedMounts findiface
tmccdie tmcctimeout libsetup_getvnodeid dotrafficconfig
tmcctimeout libsetup_getvnodeid dotrafficconfig
ixpsetup dokeyhash donodeid
OPENTMCC CLOSETMCC RUNTMCC MFS REMOTE JAILED PLAB LOCALROOTFS IXP
......@@ -73,6 +73,11 @@ my $inplab;
#
my $inixp;
#
# Inside, there might be a tmcc proxy socket.
#
my $tmccproxy;
# Load up the paths. Its conditionalized to be compatabile with older images.
# Note this file has probably already been loaded by the caller.
BEGIN
......@@ -98,6 +103,22 @@ BEGIN
die("Bad data in vnodeid: $vnodeid");
}
$injail = 1;
#
# Temporary. Will move to tmcc library.
#
if (-e "$BOOTDIR/proxypath") {
open(PP, "$BOOTDIR/proxypath");
$tmccproxy = <PP>;
close(PP);
if ($tmccproxy =~ /^([-\w\.\/]+)$/) {
$tmccproxy = $1;
}
else {
die("Bad data in tmccproxy path: $tmccproxy");
}
}
}
# Determine if running inside a Plab vserver.
......@@ -293,9 +314,8 @@ my $eid = "";
my $vname = "";
# Control tmcc error condition and timeout. Dynamic, not lexical!
$tmccdie = 1;
$tmcctimeout = 0;
my $TMCCTIMEO = 30; # Default timeout on remote nodes.
my $TMCCTIMEO = 30; # Default timeout on remote nodes.
# When on the MFS, we do a much smaller set of stuff.
# Cause of the way the packages are loaded (which I do not understand),
......@@ -359,13 +379,15 @@ sub OPENTMCC($;$$)
if ($tmcctimeout) {
$options .= " -t $tmcctimeout";
}
if (defined($tmccproxy)) {
$options .= " -l $tmccproxy";
}
my $foo = sprintf("%s -v %d $options $NODE $vn $cmd $args |",
TMCC, TMCD_VERSION);
if (!open(TM, $foo)) {
print STDERR "Cannot start TMCC: $!\n";
die("\n") if $tmccdie;
return undef;
}
return (*TM);
......@@ -384,7 +406,6 @@ sub CLOSETMCC($) {
else {
print STDERR "Error closing TMCC pipe: $!\n";
}
die("\n") if $tmccdie;
return 0;
}
return 1;
......
......@@ -30,6 +30,7 @@ typedef int socklen_t;
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <time.h>
#include <assert.h>
#include <sys/types.h>
......@@ -650,6 +651,7 @@ beproxy(char *localpath, struct in_addr serverip, char *partial)
perror("binding unix domain socket");
exit(-1);
}
chmod(localpath, S_IRWXU|S_IRWXG|S_IRWXO);
if (listen(sock, 5) < 0) {
perror("listen on unix domain socket");
exit(-1);
......
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