Commit 2d2faf1f authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Merge branch 'master' of git-public.flux.utah.edu:/flux/git/emulab-devel

parents 5a98fad5 9193739b
......@@ -2,7 +2,7 @@
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2009 University of Utah and the Flux Group.
# Copyright (c) 2000-2010 University of Utah and the Flux Group.
# All rights reserved.
#
use English;
......@@ -50,6 +50,7 @@ my $CHATSUPPORT = @CHATSUPPORT@;
my $MAILMANSUPPORT= @MAILMANSUPPORT@;
my $THISHOMEBASE= "@THISHOMEBASE@";
my $PROTOUSER = 'elabman';
my $ELABINELAB = @ELABINELAB@;
my $SAMBANODE = "fs"; # DNS makes this do the right thing in E-in-E.
my $SMBPASSWD = "/usr/local/bin/smbpasswd";
......@@ -349,6 +350,13 @@ sub AddUser()
if ($webonly) {
return 0;
}
#
# Allow for users to be initialized to frozen in an inner Emulab.
#
if ($ELABINELAB && $status eq USERSTATUS_FROZEN) {
print STDERR "Ignoring frozen user in elabinelab\n";
return 0;
}
if ($wikionly) {
$EUID = $UID;
......@@ -395,14 +403,18 @@ sub AddUser()
}
}
# shell escape.
$pswd =~ s/\$/\\\$/g;
$pswd =~ s/\*/\\\*/g;
print "Initializing user $user password on $CONTROL.\n";
if (system("$SSH -host $CONTROL $CHPASS -p '$pswd' $user")) {
fatal("Could not initialize password for user $user on $CONTROL!");
#
# Leave the password "starred" on elabinelab; safer.
#
if (!$ELABINELAB) {
# shell escape.
$pswd =~ s/\$/\\\$/g;
$pswd =~ s/\*/\\\*/g;
print "Initializing user $user password on $CONTROL.\n";
if (system("$SSH -host $CONTROL $CHPASS -p '$pswd' $user")) {
fatal("Could not initialize password for $user on $CONTROL!");
}
}
#
......@@ -620,8 +632,9 @@ sub UpdatePassword()
#
# Change on ops only if there is a real account there.
# For ELABINELAB, safer to leave the password "starred".
#
if (! $wikionly) {
if (!$wikionly && !$ELABINELAB) {
#
# Grab from the DB to avoid taint checking sillyness.
#
......@@ -927,6 +940,14 @@ sub ThawUser()
}
$sfsupdate = 1;
#
# This lets users start off as frozen in an ELABINELAB, and then
# get created later. Saves a lot of time.
#
if ($ELABINELAB &&
system("egrep -q -s '^${user}:' /etc/passwd")) {
return AddUser();
}
return UpdateUser(0);
}
......
......@@ -178,7 +178,8 @@ sub Resolve($)
my $blob = { "hrn" => "${PGENIDOMAIN}." . $node->node_id(),
"uuid" => $node->uuid(),
"role" => $node->role(),
"hostname" => $node->node_id() . ".${OURDOMAIN}",
"hostname" =>
GeniUtil::FindHostname($node->node_id()),
"physctrl" =>
Interface->LookupControl( $node->phys_nodeid() )->IP(),
"urn" => GeniHRN::Generate( $OURDOMAIN,
......
......@@ -140,7 +140,8 @@ sub Resolve($)
my $blob = { "hrn" => "${PGENIDOMAIN}." . $node->node_id(),
"uuid" => $node->uuid(),
"role" => $node->role(),
"hostname" => $node->node_id() . ".${OURDOMAIN}",
"hostname" =>
GeniUtil::FindHostname($node->node_id()),
"physctrl" =>
Interface->LookupControl($node->phys_nodeid())->IP(),
"urn" => GeniHRN::Generate($OURDOMAIN,
......
......@@ -667,14 +667,14 @@ sub Create($$$$$$)
$hrn = "${PGENIDOMAIN}." . $vnode->node_id();
$sliver_uuid = $vnode->uuid();
$resource_id = $vnode->node_id();
$hostname = $vnode->node_id() . ".${OURDOMAIN}";
$hostname = GeniUtil::FindHostname($vnode->node_id());
$sshdport = $vnode->sshdport();
}
else {
$hrn = "${PGENIDOMAIN}." . $node->node_id();
$sliver_uuid = $node->uuid();
$resource_id = $node->node_id();
$hostname = $node->node_id() . ".${OURDOMAIN}";
$hostname = GeniUtil::FindHostname($node->node_id());
}
#
......
......@@ -11,7 +11,7 @@ use Exporter;
use vars qw(@ISA @EXPORT);
@ISA = "Exporter";
@EXPORT = qw(NewUUID GENI_PURGEFLAG);
@EXPORT = qw(NewUUID GENI_PURGEFLAG FindHostname);
use English;
use Data::Dumper;
......@@ -19,12 +19,14 @@ use XML::Simple;
use GeniHRN;
# Configure variables
my $TB = "@prefix@";
my $TBOPS = "@TBOPSEMAIL@";
my $OURDOMAIN = "@OURDOMAIN@";
my $UUIDGEN = "@UUIDGEN@";
my $user = "geniuser";
my $group = "GeniSlices";
my $TB = "@prefix@";
my $TBOPS = "@TBOPSEMAIL@";
my $OURDOMAIN = "@OURDOMAIN@";
my $UUIDGEN = "@UUIDGEN@";
my $ELABINELAB = "@ELABINELAB@";
my $OUTERBOSS_NODENAME = "@OUTERBOSS_NODENAME@";
my $user = "geniuser";
my $group = "GeniSlices";
sub GENI_PURGEFLAG() { return 1; }
......@@ -117,5 +119,16 @@ sub LookupNode($)
return Node->Lookup($nodeid);
}
sub FindHostname($)
{
my ($nodeid) = @_;
my $prefix = $OURDOMAIN;
if ($ELABINELAB == 1) {
$OUTERBOSS_NODENAME =~ /^[^.]+\.(.*)$/;
$prefix = $1;
}
return $nodeid . "." . $prefix;
}
# _Always_ make sure that this 1 is at the end of the file...
1;
#!/usr/bin/perl -wT
#
# EMULAB-COPYRIGHT
# Copyright (c) 2008-2009 University of Utah and the Flux Group.
# Copyright (c) 2008-2010 University of Utah and the Flux Group.
# All rights reserved.
#
# Implements the libvnode API for OpenVZ support in Emulab.
......@@ -79,6 +79,7 @@ my $BRCTL = "/usr/sbin/brctl";
my $IPTABLES = "/sbin/iptables";
my $MODPROBE = "/sbin/modprobe";
my $RMMOD = "/sbin/rmmod";
my $VLANCONFIG = "/sbin/vconfig";
my $VZRC = "/etc/init.d/vz";
my $MKEXTRAFS = "/usr/local/etc/emulab/mkextrafs.pl";
......@@ -244,6 +245,10 @@ sub vz_rootPreConfig {
# For tunnels
mysystem("$MODPROBE ip_gre");
# For VLANs
mysystem("$MODPROBE 8021q");
system("$VLANCONFIG set_name_type VLAN_PLUS_VID_NO_PAD");
# we need this stuff for traffic shaping -- only root context can
# modprobe, for now.
mysystem("$MODPROBE sch_plr");
......@@ -322,7 +327,20 @@ sub vz_rootPreConfigNetwork {
foreach my $ifc (@{$node_ifs->{$node}}) {
next if (!$ifc->{ISVIRT});
if ($ifc->{PMAC} eq "none") {
if ($ifc->{ITYPE} eq "vlan") {
my $iface = $ifc->{IFACE};
my $vtag = $ifc->{VTAG};
my $vdev = "vlan${vtag}";
system("$VLANCONFIG add $iface $vtag");
system("$IFCONFIG $vdev up");
my $brname = "pbr$vdev";
$brs{$brname}{ENCAP} = 1;
$brs{$brname}{SHORT} = 0;
$brs{$brname}{PHYSDEV} = $vdev;
}
elsif ($ifc->{PMAC} eq "none") {
my $brname = "br" . $ifc->{VTAG};
# if no PMAC, we don't need encap on the bridge
$brs{$brname}{ENCAP} = 0;
......@@ -1154,7 +1172,13 @@ sub vz_vnodePreConfigExpNetwork {
#
my $veth = "veth$vmid.$ifc->{ID}";
my $br;
if ($ifc->{PMAC} eq "none") {
if ($ifc->{ITYPE} eq "vlan") {
my $vtag = $ifc->{VTAG};
my $vdev = "vlan${vtag}";
$br = "pbr$vdev";
}
elsif ($ifc->{PMAC} eq "none") {
$br = "br" . $ifc->{VTAG};
}
else {
......
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