Commit 9d161d2f authored by Jonathon Duerig's avatar Jonathon Duerig

When running inside of an elabinelab, use the outer elab to prefix hostnames.

parent fe081316
......@@ -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;
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