Commit 45838cbd authored by Leigh B. Stoller's avatar Leigh B. Stoller

Small changes to support shared nodes; physnodes that support sharing

by allowing virtual nodes from multiple experiments at the same time.
parent 8ee40c55
#!/usr/bin/perl -w
#
# EMULAB-COPYRIGHT
# Copyright (c) 2004-2008 University of Utah and the Flux Group.
# Copyright (c) 2004-2009 University of Utah and the Flux Group.
# All rights reserved.
#
use English;
......@@ -396,7 +396,7 @@ sub doboot()
warning("Error adding new user $login");
next;
}
if (PLAB() && ! -e $hdir) {
if ($doit && !os_mkdir($hdir, "0755")) {
warning("Error creating user homedir");
......@@ -405,12 +405,13 @@ sub doboot()
chown($uid, $gid, $hdir)
if ($doit);
}
#
# Might be a local node that does not mount /user from ops.
# Or a remote node.
#
$doupdate = 1
if (! -e "$hdir/.ssh");
if (! -e "$hdir/.ssh" || ! -d "$hdir/.ssh");
# Add to DB only if successful.
$PWDDB{$login} = "$uid:$serial";
......@@ -430,11 +431,20 @@ sub doboot()
my $sshdir = "$homedir/.ssh";
my $forward = "$homedir/.forward";
# Sanity; this does not always happen correctly.
my $cmd = "$CHMOD 755 $homedir";
if (system($cmd) != 0) {
warning("Failed $cmd: $!");
}
#
# Create .ssh dir and populate it with an authkeys file.
# XXX as a sanity check, do nothing if tmcd gaves us
# no keys for any user. Means that something went wrong.
#
TBNewsshKeyfile($sshdir, $uid, $gid, 0,
@{$pubkeys{$login}});
@{$pubkeys{$login}})
if (keys(%pubkeys));
#
# Give user a .forward back to emulab.
......
#!/usr/bin/perl -w
#
# EMULAB-COPYRIGHT
# Copyright (c) 2004 University of Utah and the Flux Group.
# Copyright (c) 2004-2009 University of Utah and the Flux Group.
# All rights reserved.
#
use English;
......@@ -422,11 +422,35 @@ sub jailmount()
# the unmounts. In the meantime, the physical node might change its
# mount set, but we will not care (of course, if a dir is unmounted
# from the pnode, something is probably going to break).
#
dbmopen(%MDB, $MOUNTDB, 0444);
#
my %MOUNTS = ();
dbmopen(%SDB, $JAILDB, 0644);
while (my ($remote, $path) = each %MDB) {
if (SHAREDHOST()) {
my @tmccresults;
if (tmcc(TMCCCMD_ACCT, undef, \@tmccresults) < 0) {
warn("Could not get account info from server!\n");
return -1;
}
foreach my $str (@tmccresults) {
if ($str =~ /^ADDUSER LOGIN=([-\w]+) .* HOMEDIR=([^\s]+)/) {
$MOUNTS{$2} = $2;
}
}
my ($pid, $eid, $myname) = check_nickname();
$MOUNTS{"/proj/$pid"} = "/proj/$pid"
if ($pid);
}
else {
dbmopen(%MDB, $MOUNTDB, 0444);
while (my ($remote, $path) = each %MDB) {
$MOUNTS{$remote} = $path;
}
dbmclose(%MDB);
}
while (my ($remote, $path) = each %MOUNTS) {
$local = "$rootpath$path";
if (! -e $local) {
......@@ -447,7 +471,6 @@ sub jailmount()
}
$SDB{$remote} = $local;
}
dbmclose(%MDB);
dbmclose(%SDB);
return 0;
}
......
......@@ -30,6 +30,7 @@ use Exporter;
SIMTRAFGEN SIMHOST ISDELAYNODEPATH JAILHOST DELAYHOST STARGATE
ISFW FAKEJAILED LINUXJAILED GENVNODE GENVNODETYPE GENVNODEHOST
SHAREDHOST
CONFDIR LOGDIR TMDELAY TMJAILNAME TMSIMRC TMCC TMCCBIN
TMNICKNAME TMSTARTUPCMD FINDIF
......@@ -386,8 +387,10 @@ sub SIMHOST() { if ($role eq "simhost") { return 1; } else { return 0; } }
sub SIMTRAFGEN(){ if (-e ISSIMTRAFGENPATH()) { return 1; } else { return 0; } }
# A jail host?
sub JAILHOST() { if ($role eq "virthost") { return 1; } else { return 0; } }
sub GENVNODEHOST() { if ($role eq "virthost") { return 1; } else { return 0; } }
sub JAILHOST() { return (($role eq "virthost" ||
$role eq "sharedhost") ? 1 : 0); }
sub GENVNODEHOST() { if ($role eq "virthost") { return 1; } else { return 0; }}
sub SHAREDHOST() { return ($role eq "sharedhost" ? 1 : 0); }
# A delay host? Either a delay node or a node using linkdelays
sub DELAYHOST() { if (-e ISDELAYNODEPATH()) { return 1; } else { return 0; } }
......
#!/usr/bin/perl -w
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2006 University of Utah and the Flux Group.
# Copyright (c) 2000-2009 University of Utah and the Flux Group.
# All rights reserved.
#
# Kernel, jail, netstat, route, ifconfig, ipfw, header files.
......@@ -16,7 +16,8 @@ use Fcntl ':flock';
# Drag in path stuff so we can find emulab stuff. Also untaints path.
BEGIN { require "/etc/emulab/paths.pm"; import emulabpaths; }
use libsetup qw(REMOTE LOCALROOTFS TMTOPOMAP TMLTMAP TMLTPMAP TBDebugTimeStamp);
use libsetup qw(REMOTE SHAREDHOST
LOCALROOTFS TMTOPOMAP TMLTMAP TMLTPMAP TBDebugTimeStamp);
use libtmcc;
#
......@@ -643,7 +644,7 @@ sub mkrootfs($)
# more efficient (less tmcd work), and besides, the physnode starts with
# exactly the same accounts.
#
if (REMOTE()) {
if (REMOTE() || SHAREDHOST()) {
mysystem("cp -p $ETCJAIL/group $path/root/etc");
mysystem("cp -p $ETCJAIL/master.passwd $path/root/etc");
mysystem("pwd_mkdb -p -d $path/root/etc $path/root/etc/master.passwd");
......@@ -951,8 +952,8 @@ sub cleanup()
}
# Unmounts.
if (!REMOTE()) {
# If this fails, fail, we do want to continue. Dangerous!
if (! REMOTE()) {
# If this fails, fail, we do not want to continue. Dangerous.
system("$BINDIR/rc/rc.mounts ".
"-j $vnodeid foo $NFSMOUNT_REMOTE shutdown");
......
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