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

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

parent fe081316
...@@ -178,7 +178,8 @@ sub Resolve($) ...@@ -178,7 +178,8 @@ sub Resolve($)
my $blob = { "hrn" => "${PGENIDOMAIN}." . $node->node_id(), my $blob = { "hrn" => "${PGENIDOMAIN}." . $node->node_id(),
"uuid" => $node->uuid(), "uuid" => $node->uuid(),
"role" => $node->role(), "role" => $node->role(),
"hostname" => $node->node_id() . ".${OURDOMAIN}", "hostname" =>
GeniUtil::FindHostname($node->node_id()),
"physctrl" => "physctrl" =>
Interface->LookupControl( $node->phys_nodeid() )->IP(), Interface->LookupControl( $node->phys_nodeid() )->IP(),
"urn" => GeniHRN::Generate( $OURDOMAIN, "urn" => GeniHRN::Generate( $OURDOMAIN,
......
...@@ -140,7 +140,8 @@ sub Resolve($) ...@@ -140,7 +140,8 @@ sub Resolve($)
my $blob = { "hrn" => "${PGENIDOMAIN}." . $node->node_id(), my $blob = { "hrn" => "${PGENIDOMAIN}." . $node->node_id(),
"uuid" => $node->uuid(), "uuid" => $node->uuid(),
"role" => $node->role(), "role" => $node->role(),
"hostname" => $node->node_id() . ".${OURDOMAIN}", "hostname" =>
GeniUtil::FindHostname($node->node_id()),
"physctrl" => "physctrl" =>
Interface->LookupControl($node->phys_nodeid())->IP(), Interface->LookupControl($node->phys_nodeid())->IP(),
"urn" => GeniHRN::Generate($OURDOMAIN, "urn" => GeniHRN::Generate($OURDOMAIN,
......
...@@ -667,14 +667,14 @@ sub Create($$$$$$) ...@@ -667,14 +667,14 @@ sub Create($$$$$$)
$hrn = "${PGENIDOMAIN}." . $vnode->node_id(); $hrn = "${PGENIDOMAIN}." . $vnode->node_id();
$sliver_uuid = $vnode->uuid(); $sliver_uuid = $vnode->uuid();
$resource_id = $vnode->node_id(); $resource_id = $vnode->node_id();
$hostname = $vnode->node_id() . ".${OURDOMAIN}"; $hostname = GeniUtil::FindHostname($vnode->node_id());
$sshdport = $vnode->sshdport(); $sshdport = $vnode->sshdport();
} }
else { else {
$hrn = "${PGENIDOMAIN}." . $node->node_id(); $hrn = "${PGENIDOMAIN}." . $node->node_id();
$sliver_uuid = $node->uuid(); $sliver_uuid = $node->uuid();
$resource_id = $node->node_id(); $resource_id = $node->node_id();
$hostname = $node->node_id() . ".${OURDOMAIN}"; $hostname = GeniUtil::FindHostname($node->node_id());
} }
# #
......
...@@ -11,7 +11,7 @@ use Exporter; ...@@ -11,7 +11,7 @@ use Exporter;
use vars qw(@ISA @EXPORT); use vars qw(@ISA @EXPORT);
@ISA = "Exporter"; @ISA = "Exporter";
@EXPORT = qw(NewUUID GENI_PURGEFLAG); @EXPORT = qw(NewUUID GENI_PURGEFLAG FindHostname);
use English; use English;
use Data::Dumper; use Data::Dumper;
...@@ -19,12 +19,14 @@ use XML::Simple; ...@@ -19,12 +19,14 @@ use XML::Simple;
use GeniHRN; use GeniHRN;
# Configure variables # Configure variables
my $TB = "@prefix@"; my $TB = "@prefix@";
my $TBOPS = "@TBOPSEMAIL@"; my $TBOPS = "@TBOPSEMAIL@";
my $OURDOMAIN = "@OURDOMAIN@"; my $OURDOMAIN = "@OURDOMAIN@";
my $UUIDGEN = "@UUIDGEN@"; my $UUIDGEN = "@UUIDGEN@";
my $user = "geniuser"; my $ELABINELAB = "@ELABINELAB@";
my $group = "GeniSlices"; my $OUTERBOSS_NODENAME = "@OUTERBOSS_NODENAME@";
my $user = "geniuser";
my $group = "GeniSlices";
sub GENI_PURGEFLAG() { return 1; } sub GENI_PURGEFLAG() { return 1; }
...@@ -117,5 +119,16 @@ sub LookupNode($) ...@@ -117,5 +119,16 @@ sub LookupNode($)
return Node->Lookup($nodeid); 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... # _Always_ make sure that this 1 is at the end of the file...
1; 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